457 Commits

Author SHA1 Message Date
Ross Nicoll
c91fdf1d21
Add support for cherrypick() 2015-02-13 12:52:03 +00:00
J. David Ibáñez
3d896769d0 New DiffLine
Comes from PR #346

One difference, DiffLine.origin is a T_CHAR instead of T_OBJECT
2015-02-12 16:56:34 +01:00
Masud Rahman
9cce003efe Implements 'Repository.create_blob_fromiobase'.
This commit allows blobs to be constructed from implementatons of the
'RawIOBase' ABC.  This allows any conformant stream implementation to be added
as a blob.

This is useful in the case where the contents of the blob would be too large to
create from memory (as 'create_blob_fromstring' allows) and avoids having to
write the data to disk (as 'create_blob_fromworkdir' allows).  The latter
operation is especially useful when reading data from a network socket, since
it avoids having to first commit all the data to disk.
2015-02-10 01:28:23 -05:00
Carlos Martín Nieto
fcd4b9446b Introduce Repository.merge_trees()
This is the function which does the work for Repository.merge_commits()
and allows us more direct control over which trees we want to merge,
including trees which do not belong to commits.
2015-02-09 21:21:28 +01:00
Carlos Martín Nieto
4709cae1a1 Add Repository.ahead_behind()
This lets us ask how many diverging commits each side of two histories
have.
2015-02-06 01:26:26 +01:00
Carlos Martín Nieto
1361b2cce9 Add Repository.expand_id()
As we allow users of the library to use short strings, we must expand
them. This is however only available through a function in C. Expose
that function from the repository to allow python code to get a full id
from a short hex string.
2015-02-06 01:17:19 +01:00
J. David Ibáñez
909e03d8fc New DiffDelta and DiffFile
Comes from PR #346
2015-01-29 18:34:47 +01:00
Carlos Martín Nieto
f68b266e60 Remote: generalize push()
Move to use git_remote_push() instead of doing the steps ourselves. We
also change to accept a list of refspecs instead of just the one refspec
for the push method.

As part of this, we no longer error out if the server rejected any
updates, as this is a different concern from whether the push itself
failed or not. We do still error out if we attempt to push non-ff
updates.
2015-01-12 18:39:21 +01:00
Carlos Martín Nieto
1dbf94011a Migrate to 0.22
Apart from the usual API changes, we now need to introduce the concept
of whether we still own the C object underneath our Repository and
Remote objects.

When using the custom callbacks for repository and remote creation
during clone, we pass the pointer and thus ownership of the object back
to the library. We will then get the repository back at the end.

We return the object which was handed to us rather than opening the
repository again with the local path as there is now a much higher
chance that the cloned repository does not use the standard backends.
2015-01-12 18:39:21 +01:00
J. David Ibáñez
93be1f1910 Merge remote-tracking branch 'carlos/remote-collection' 2014-11-11 20:08:56 +01:00
Carlos Martín Nieto
b80103b017 Introduce RemoteCollection
This lets us look up remotes by name, which is not possible by just
returning the list of remotes.

Move remote creation to Repostiory.remotes.create() and keep the old
Repository.create_remote() for compatibility, delegating to this new
way.

Existing code should keep working, but this moves us towards what we'd
need for a better interface in 0.22 which makes remote renaming and
deleting work with a name rather than an instance and would make sense
to exist as part of an Remote.remotes object.
2014-11-11 19:57:22 +01:00
Carlos Martín Nieto
11eea2d574 Get rid of allocfmt()
It is not possible to know how we can free the results of this
allocation, so we shouldn't be using this function.

We have a convention of returning Oid objects in pygit2, so let's keep
to that in these places.
2014-11-09 12:10:45 +01:00
Carlos Martín Nieto
bc8b29b4f3 Repository: allow passing a favor option to merge_commits
I've gone with taking a string and converting it because the depth of
the namespacing in the libgit2 name is rather large and we don't care
about the global namespace that C has; and this also lets us pass the
same as the '-X' option to git-merge.
2014-10-30 16:21:22 +01:00
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