393 Commits

Author SHA1 Message Date
Carlos Martín Nieto
3b27e16d08 Add Repository.merge_commits()
This allows you to merge arbitrary commits, returning an index, which is
useful when dealing with bare repos in which we want to merge.
2014-10-30 15:04:51 +01:00
Carlos Martín Nieto
b8efdde626 Merge pull request #434 from carlosmn/diff-refactor
Repository: make use of peel for diff()
2014-10-10 11:57:18 +02:00
Carlos Martín Nieto
fa20589fe9 Merge pull request #424 from kyriakosoikonomakos/ssh-agent
authenticate using ssh agent
2014-10-10 11:44:05 +02:00
Carlos Martín Nieto
b98e9e85de Reference: implement peel()
This makes both objects and references peelable via the same interface,
simplifying how to get to the wanted type.
2014-10-07 20:27:01 +02:00
Kyriakos Oikonomakos
3e87adaccd authenticate using ssh agent 2014-09-15 18:14:20 +01:00
J. David Ibáñez
c997037c7b Get ready for 0.21.3 release 2014-09-15 12:39:27 +02:00
J. David Ibáñez
51da3b767d Merge remote-tracking branch 'carlos/archive' 2014-09-08 10:03:57 +02:00
Carlos Martín Nieto
81104d4df2 pypy3 does not have the AttributeError/TypeError difference 2014-09-06 19:38:16 +02:00
Carlos Martín Nieto
ab730cb1d4 Provide a method to write a tree to an archive
Add Repository.write_archive() to write a given tree to an archive. As
there are many customisation options, we only provide a method to write
to an archive which is created by the user.
2014-09-06 18:59:15 +02:00
J. David Ibáñez
82167827bc Merge remote-tracking branch 'carlos/reference-update' 2014-09-05 17:11:32 +02:00
Carlos Martín Nieto
a3e7a115f4 Provide method for deleting a remote
Fixes #418
2014-09-04 15:57:05 +02:00
Carlos Martín Nieto
747e7c2136 Repository: make head read-only and introduce set_head()
Following from the previous commits, make 'head' read-only and provide a
method to update head while providing a message.

The checkout() codepath which switches branches has been updated to
provide a reflog entry which mimics git's.
2014-09-04 01:58:05 +02:00
Carlos Martín Nieto
cd08425927 Move blame to cffi
This requires fairly little work on the pygit2 side to kick off all the
searching on the libgit2 side, so it's a fairly good candidate.

This changes the return value for the commit ids to Oid instead of
strings, which is what we generally try to return.
2014-08-31 22:35:32 +02:00
Carlos Martín Nieto
4d053cf066 Get rid of a settable Reference.target
Updating the target of a reference is not like setting a property. It
involves appending to the reflog under the same lock, so we must do it
all the same time. Thus setting the target becomes a function which
takes the new target and what the use would like to add to the reflog.
2014-08-28 01:25:21 +02:00
Carlos Martín Nieto
f35f58ca45 Get rid of Reference.append_log()
We do not want this as it is riddled with race conditions.
2014-08-28 01:25:21 +02:00
J. David Ibáñez
fe5c9d68c3 Merge remote-tracking branch 'djmattyg007/branches_are_references' 2014-08-26 10:15:33 +02:00
J. David Ibáñez
617dd34f5e Merge remote-tracking branch 'carlos/checkout-branch' 2014-08-26 10:09:32 +02:00
Carlos Martín Nieto
b550027234 Fix cloning a repository with a particular branch to checkout
We were missing a cast to bytes. Add a test for this option as well and
remove the old commented-out test for checkout_branch, which is
superseded by this one and whose last bit seemed confused about what the
option means.

This fixes #399
2014-08-25 13:58:41 +02:00
djmattyg007
14bcce0dcf Add test for checking out local branches with a Branch object.
This differs from the only other test which uses a Reference object.
This test only succeeds because of the previous commit.
2014-08-23 11:52:58 +10:00
Matthew Duggan
0813ec7923 Fix use of skipIf. 2014-08-18 21:17:36 +09:00
Matthew Duggan
bedd9ee315 Don't test refcounts in pypy as they don't make sense there 2014-08-18 21:13:03 +09:00
Matthew Duggan
9ce6a26db3 Add some tests for refcounts to check for leaks 2014-08-18 18:23:10 +09:00
Carlos Martín Nieto
2a429aae98 config: only return the config key in iteration
At its core, the config is a key-value storage with peculiar key
equality rules. Make it behave more like a python dictionary and return
the key on iteration.
2014-07-24 18:43:54 +02:00
J. David Ibáñez
57e25c1a4a index: replace has_conflicts by conflicts returning None 2014-07-22 10:50:30 +02:00
Carlos Martín Nieto
763b571c84 checkout: add support for overriding the target directory 2014-07-11 14:49:56 +02:00
Carlos Martín Nieto
af38211d0c checkout: move the code to cffi
As part of this, make the strategy part of **kwargs, in preparation for
supporting more options.
2014-07-11 14:42:29 +02:00
Carlos Martín Nieto
ae32ad12ee Support del in ConflictCollection 2014-07-10 11:27:10 +02:00
Carlos Martín Nieto
15576fcbdc Add tests for Index conflict access 2014-07-10 09:08:16 +02:00
Carlos Martín Nieto
78d80147ab Move merge tests to their own file
The method is in Repository, but the merge functionality is separate. We
will introduce more tests in this area later.
2014-07-10 09:08:16 +02:00
Jack O'Connor
b190169f5e support setting a detatched HEAD 2014-06-22 19:11:04 -07:00
Jack O'Connor
a063867fe0 Index: add a setter for workdir 2014-06-22 18:57:09 -07:00
Carlos Martín Nieto
bde58d9727 Remote: make renaming take a method call
Renaming a remote in pygit2 has been done via Remote.name= up to now,
but this is inherently unsafe, as it provides no way to pass up the
refspecs that libgit2 was unable to remap.

In fact, if there ever was such problem, we would have segfaulted.

libgit2 now provides a much more direct way of getting back the results,
so expose it as the return value of Remote.rename(). This also removes
the hint that a rename might be something that happens only to the
in-memory structure.
2014-06-08 20:35:21 +02:00
Carlos Martín Nieto
1d4031bacd Merge remote-tracking branch 'upstream/master' into development
Conflicts:
	pygit2/decl.h
	test/test_repository.py
2014-06-07 21:38:07 +02:00
Carlos Martín Nieto
491e352e41 Update to latest libgit2 2014-06-07 21:31:47 +02:00
Carlos Martín Nieto
97c0e476a3 Index: add failing tests for a standalone Index
The index can exist purely as a data structure. Let's test that so we
make sure we support that.
2014-05-27 18:51:58 +02:00
Carlos Martín Nieto
19be4b6aa4 clone: wrap clone_into()
This allows the user to prepare the repository and remote with whichever
custom settings they want before performing the "clone" proper.
2014-05-20 03:23:25 +02:00
Carlos Martín Nieto
2b5e408029 Merge remote-tracking branch 'upstream/master' into development
Reconcile the changes between the ffi changes upstream with the changes
to libgit2 in the dev branch.

Conflicts:
	src/config.c
	src/options.c
	src/refspec.c
	src/remote.c
2014-05-16 04:41:26 +02:00
Carlos Martín Nieto
9309329b5a Merge pull request #361 from carlosmn/cffi-config
Config: move to cffi
2014-04-26 16:39:50 +02:00
Carlos Martín Nieto
1c76d5667a Blob: implement the memory buffer interface
This allows us to expose access to the blob's data without the need to
copy it into new buffer.
2014-04-23 12:35:17 +02:00
Carlos Martín Nieto
1e13a10949 Config: expose config rules parsing
Expose Config.parse_bool() and Config.parse_int() to parse text
according to git-config rules.
2014-04-21 14:11:41 +02:00
Carlos Martín Nieto
c41c1a1c97 Config: move to cffi
This halves the amount of code we have to take into account for dealing
with the config.

There is a slight change in the API. Config.get_multivar() returns an
iterator instead of a list, which lets us reuse code from the general
iterator and is closer to libgit2's API.
2014-04-21 14:11:41 +02:00
J. David Ibáñez
3cc129dd62 Merge remote-tracking branch 'origin/cffi-remote' 2014-04-18 21:56:00 +02:00
Carlos Martín Nieto
7ed89b0aab Remote: protect against invalid input on rename
The C API expects a non-NULL new name and raises an assertion if we
don't protect against such input, so let's guard against falsy values,
which also takes care of the empty string, which is also not valid
input.
2014-04-17 23:18:31 +02:00
J. David Ibáñez
397e8ad07c Merge remote-tracking branch 'carlos/config-parse' 2014-04-15 09:01:03 +02:00
Carlos Martín Nieto
73e9e58fa4 Config: make bool and int parsing explicit via functions
Passing a tuple to the mapping interface isn't the best of interfaces,
as the key is only the string.

Instead, expose `Config.get_bool()` and `Config.get_int()` methods to
parse the values as per the git-config rules before returning the
appropriate type to the user.

The mapping interface itself returns a string.
2014-04-14 19:37:44 +02:00
Carlos Martín Nieto
c76c3f0195 Start implementing remotes with CFFI
This moves enough code into python with CFFI to pass the test_remotes
unit tests. There is no credentials support yet.

There is a small change in the return value of Remote.fetch() in that we
now return a TransferProgress object instead of extracting a few values
into a dictionary.
2014-04-14 11:42:51 +02:00
Carlos Martín Nieto
55037c23a3 Adjust to the merge changes
There is no more MergeResult type. Instead, the user can use
Repository.merge_analysis() to get an overview of their options and call
git_merge() when they mean to merge.

The git_merge() function now also performs a checkout.
2014-04-01 19:48:20 +02:00
Carlos Martín Nieto
e5f6798f67 Adjust to oid -> id renaming 2014-04-01 19:47:48 +02:00
Carlos Martín Nieto
9cec62d2e1 Blame: orig_ is now filled 2014-04-01 19:47:48 +02:00
Carlos Martín Nieto
687dc5388e config: make type conversion explicit
The type of a config value depends on the tool that interprets
it. Parsing eagerly can lead to a situation where we return a bool
instead of a string or a number.

Let the user specify the type themselves by passing in a (str, type)
tuple into the mapping interface.
2014-03-27 18:04:38 +01:00