49 Commits

Author SHA1 Message Date
J. David Ibáñez
354d56a95c Update copyright years 2017-03-22 21:15:34 +01:00
Matthias Bartelmess
00dd78bf1b Fix windows tests 2016-10-21 06:06:40 +03:00
Carlos Martín Nieto
df30f9213f Remove checks for obsolete methods
This is not how you define your callbacks, so this test isn't testing
for anything useful.
2016-04-29 13:19:32 +02:00
J. David Ibáñez
70edbf256a Update copyright years 2015-10-11 18:48:59 +02:00
J. David Ibáñez
9db8737364 Update changelog 2015-10-11 11:06:22 +02:00
Carlos Martín Nieto
7b97ade6ce Move remote callbacks to use a class for callbacks
This represents what's going on much better than the remnants from the
older methods. What we do is pass a list of callbacks to libgit2 for it
to call, and they are valid for a single operation, not for the remote
itself.

This should also make it easier to re-use callbacks which have already
been set up.
2015-09-27 02:43:50 +02:00
Carlos Martín Nieto
81520c9c62 Update to libgit2 v0.23 2015-07-06 18:49:20 +02:00
Carlos Martín Nieto
0ce4d3b9a8 Allow creating a remote with a particular fetch refspec
This makes it a lot more convenient to create a remote and override the
fetch refspec it gets created with.
2015-04-28 13:39:15 +02: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
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
a3e7a115f4 Provide method for deleting a remote
Fixes #418
2014-09-04 15:57:05 +02: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
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
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
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
J. David Ibáñez
d7071b88cd Update copyright year 2014-02-04 08:02:12 +01:00
J. David Ibáñez
977c315c21 Preparing for release 2014-02-02 15:07:47 +01:00
Carlos Martín Nieto
c2b2c5dd16 remote: call user-provided callbacks
The user can set 'progress', 'transfer_progress' and 'update_tips' to be
notified whenever one of those happen.
2014-01-25 10:48:49 +01:00
Carlos Martín Nieto
500a6793c4 Object: move to use an 'id' attribute instead of 'oid'
This looks like a left-over from the libgit2 misnaming. The current
consensus is that 'oid' is the data type and 'id' is the name of the
attribute.
2014-01-24 11:04:34 +01:00
Carlos Martín Nieto
0c3a700e30 Remote: harden the resfpec setters
The object passed must be a list of strings, so make sure we fail by
raising an error instead of segfaulting.
2014-01-22 23:30:02 +01:00
Carlos Martín Nieto
1040a6330a Remote: make fetch/push_refspecs attributes
This is a lot more pythonic than two sets of getter-setter
functions. The old ones are left for backwards compatibility but they
should be removed in the next release.
2014-01-22 23:06:52 +01:00
XTao
9ef75d846e Add fetch & push refspec. 2014-01-22 15:25:25 +08:00
J. David Ibáñez
4c28c487db Merge remote-tracking branch 'carlos/push-url' 2014-01-20 10:45:27 +01:00
Carlos Martín Nieto
e28c06fc1d Remote: allow access to the push url 2014-01-20 03:17:34 +01:00
Carlos Martín Nieto
17a49bb417 Refspec: implement transform functions 2014-01-19 23:59:47 +01:00
Carlos Martín Nieto
e681a47245 Refspec: create the type to wrap refspecs 2014-01-19 23:59:26 +01:00
Jose Plana
f69eeae108 Refactor getters to become methods 2013-11-27 19:26:24 +01:00
Jose Plana
336f042e22 Added methods to interact with the remote refspecs 2013-11-25 13:06:04 +01:00
Fraser Tweedale
134d87ab2a implement push support
Implement push support via Remote.push which is called with a single
refspec and raises GitError (with an appropriate message where
possible) if the push fails.

Note that local push to non-bare repository is currently not
supported by libgit2.
2013-08-30 17:42:24 +10:00
J. David Ibáñez
534d98b6b2 Comment the remote test that segfaults
See libgit2/libgit2#1692

To uncomment whenever libgit2 0.20 is released
2013-07-05 23:23:31 +02:00
J. David Ibáñez
e56e8600ac Upgrading to libgit2 0.19 (wip)
Removed:

- Remote.fetchspec

Added:

- Remote.refspec_count
- Remote.get_refspec(n)
2013-06-30 13:35:51 +02:00
Daniel Rodríguez Troitiño
a6567c4eb6 Add Remote.save method. 2013-05-29 00:24:40 +02:00
J. David Ibáñez
0c86307eb5 Coding style: Silent pep8 2013-05-26 14:39:12 +02:00
J. David Ibáñez
74a1fdab60 Fixing coding style with the help of pep8 (wip) 2013-05-26 10:32:05 +02:00
Nico von Geyso
119d0e0344 added missing unittest.main() for tests_remote.py 2013-03-13 12:48:58 +01:00
Nico von Geyso
511b760a56 added tests for notes 2013-03-11 20:48:58 +01:00
Nico von Geyso
da4abb78cb added test data for diff.find_similiar 2013-03-04 18:37:45 +01:00
J. David Ibáñez
29ce23c0d5 Update copyright 2013-03-02 12:16:16 +01:00
J. David Ibáñez
a96d494747 Coding style
Including:

- Lines longer than 79 chars
- Spaces at the end of line
- Wrong indentation
- Comma not followed by an space
- C++ style comments: //
2013-03-02 11:40:42 +01:00
Nico von Geyso
0823621bb4 renamed remote_create() to create_remote() 2013-02-16 21:58:42 +01:00
Nico von Geyso
9c9e0f9755 added tests for remote.fetch() 2013-02-16 21:56:34 +01:00
Nico von Geyso
4873529129 added setter for remote fetchspec 2013-02-16 20:47:45 +01:00
Nico von Geyso
ee32acdf39 added remote fetchspec getter 2013-02-16 19:51:18 +01:00
Nico von Geyso
d150937068 added functionality to set remote urls 2013-02-16 19:47:31 +01:00
Nico von Geyso
ffaf0d5ada added functionality to rename remotes 2013-02-16 19:47:31 +01:00
Nico von Geyso
c1e645ea1a moved remote tests to test_remote.py 2013-02-16 19:47:31 +01:00