241 Commits

Author SHA1 Message Date
Carlos Martín Nieto
5ed9eb4228 Add documentation for conflicts and fixup Index
Add documentation for the conflicts, and add some for IndexEntry and
Index which went missing during the conversion to cffi.
2014-07-10 09:08:16 +02:00
Carlos Martín Nieto
1985a95b6b Add looking up conflicts in an Index 2014-07-10 09:08:16 +02:00
Carlos Martín Nieto
97ee7ab179 Move Index to cffi
This commit gives us feature-parity with the version in C.
2014-07-10 09:08:16 +02:00
vtemian
d8864bdf02 Added docs 2014-07-09 16:50:17 +03:00
vtemian
19dd7629d3 Proper naming 2014-07-09 16:46:52 +03:00
vtemian
02fd05baae Added clean_state_files 2014-07-09 16:39:34 +03:00
Jasper Lievisse Adriaanse
b0bf223276 Tweak include/lib dir detection in ffi.py
Joint work with @carlosmn
2014-07-03 10:51:32 +02:00
J. David Ibáñez
7b3201d868 Get ready to release 0.21.0 2014-06-27 17:28:01 +02: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
d3af09e86d Adjust to clone_into signature change 2014-06-07 21:45:10 +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
J. David Ibáñez
95e6593625 init_repository now wraps git_repository_init_ext
Fixes #347
2014-06-03 12:52:46 +02:00
J. David Ibáñez
6cf06ba9fe Rewrite init_repository using cffi 2014-06-02 18:50:55 +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
b1bacdd8d5 Wrap config snapshot functions
These allow complex reads to come from the same version of the config.
2014-05-18 11:03:30 +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
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
d8bd6f73ab Merge remote-tracking branch 'kluyver/docstrings-update' 2014-04-19 11:38:21 +02:00
Thomas Kluyver
569d396f0d Use repo.head.target instead of repo.head.get_object().hex 2014-04-18 13:44:25 -07: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
Thomas Kluyver
37c01d79c5 Update some docstrings which had got out of date. 2014-04-17 10:13:26 -07:00
Carlos Martín Nieto
d7d0eb37c3 ffi: style changes
Make to_str() accept None as well as ffi.NULL to return as a negative
value, and grab the version in a more compatible way.
2014-04-16 22:17:20 +02:00
Carlos Martín Nieto
5a20510f8a Safer repository pointer extraction
Casting a pointer to a non-pointer type is something which you should
never do. Instead, do something a bit more convoluted, but which is
guaranteed to give us the right pointer, as well as making sure that the
memory we exchange between python/cffi and the C extension is of the
right pointer size.

While we're touching this code, fix which object we pass to the Remote
constructor to keep alive. We need to pass the Repository object to
stop it from becoming unreferenced (and thus freeing memory the remote
needs) instead of the git_repository pointer.
2014-04-16 22:12:54 +02:00
Carlos Martín Nieto
f3bb8a4556 Fix installation-time cffi compilation
The documentation recommends adding the ffi code as an extension so it
gets built at the right time.

Make use of the LIBGIT2 environment variable to build and link the ffi
module the same way the C extension does so the user doesn't have to
export CFLAGS.
2014-04-16 22:12:52 +02:00
Carlos Martín Nieto
e56ab370a7 Remote: make sure to take the contents of the id
Pass the contents of the buffer containing the git_oid to bytes() so
build a raw representation of its contents. Using bytes(ffi.buffer(...))
returns the representation of the buffer.
2014-04-16 22:12:24 +02:00
Carlos Martín Nieto
674546bbb5 Some python3 fixes 2014-04-16 22:12:09 +02:00
Carlos Martín Nieto
072b038210 Implement clone via CFFI as well
This lets us get rid of the last piece of C for anything related to
remotes and credentials.
2014-04-14 11:42:51 +02:00
Carlos Martín Nieto
db218fae3f Remote: get rid of the C code
This code has been obsoleted by the CFFI-using code. Some credentials
code remains in C due to the clone functionality making use of it.
2014-04-14 11:42:51 +02:00
Carlos Martín Nieto
cf2703998e Remote: add documentation strings
Now that it has the features of the old implementation, let's add
documentation on how to use it.
2014-04-14 11:42:51 +02:00
Carlos Martín Nieto
2d1615dd29 Remote: add support for transfer and update_tips though CFFI 2014-04-14 11:42:51 +02:00
Carlos Martín Nieto
4ef3be18cc Remote: support credentials via CFFI 2014-04-14 11:42:51 +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
d882af8f52 Get ready to release 0.20.3 2014-04-02 22:28:18 +02:00
J. David Ibáñez
f0874cc1ea Always use new-style classes in Python 2 2014-03-27 21:00:09 +01:00
J. David Ibáñez
69a96975a9 Merge remote-tracking branch 'carlos/credentials' 2014-03-27 20:54:02 +01:00
Carlos Martín Nieto
82d88191bb credentials: use more ducks
Instead of making everyone inherit from our credential types, use an
interface with two attributes, which makes the C code much shorter and
simpler.
2014-03-26 20:23:04 +01:00
Carlos Martín Nieto
b3ce1b5da6 Add credentials support to clone_repository() 2014-03-26 14:50:25 +01:00
Carlos Martín Nieto
75f9f88335 Update clone_repository's docs
It claims you need to checkout a branch after clone, which is not the
case currently (the clone function will do it for you).

While here, format the docstring for sphinx to make it pretty.
2014-03-26 14:48:34 +01:00
Carlos Martín Nieto
fc0cdaebd6 Remote: add documentation for credentials 2014-03-26 14:03:29 +01:00
Carlos Martín Nieto
b49da53962 Introduce credentials 2014-03-26 12:10:24 +01:00
Thomas Kluyver
af2528418a More informative repr for Repository objects 2014-03-25 15:13:10 -07:00
Carlos Martín Nieto
87c8aef7d9 Settings: add documentation
The search_path attribute is now inside __init__() so it shows properly
in the generated documentation.
2014-03-24 01:44:36 +01:00
Carlos Martín Nieto
6bdb013592 settings: python 3.3 compat
Python 3.3 doesn't like us overriding properties in __slots__, so set it
to an empty list.
2014-03-24 01:43:40 +01:00
Carlos Martín Nieto
48ff3a8983 Create proxy object for libgit2 options
pygit2.settings proxies though the lower-level varargs option() via
getters and setters which provide a more natural abstraction.
2014-03-23 15:53:32 +01:00
J. David Ibáñez
140305e410 Get ready to release 0.20.2 2014-02-04 22:26:46 +01:00
J. David Ibáñez
d7071b88cd Update copyright year 2014-02-04 08:02:12 +01:00
J. David Ibáñez
d04823c3c8 Get ready to release 0.20.1 2013-12-24 10:48:39 +01:00