1000 Commits

Author SHA1 Message Date
J. David Ibáñez
a9fcbb33d1 Check errors returned by git_signature_dup 2014-06-21 21:14:33 +02:00
J. David Ibáñez
791b39433c C coding style: remove tabs 2014-06-21 10:23:52 +02:00
J. David Ibáñez
88a28f7ed8 Merge remote-tracking branch 'carlos/development' 2014-06-21 10:14:00 +02:00
J. David Ibáñez
e3d36ad400 Merge remote-tracking branch 'michaeljones/documentation' 2014-06-20 09:54:45 +02:00
Michael Jones
1f111c08b6 Provide example for Reference.log_append
I would have found this useful when trying to do reflog additions. It
might not be massively complex but examples always help.
2014-06-15 11:39:24 +01:00
Michael Jones
7296b921cc Fix spelling typo 2014-06-15 11:30:33 +01:00
Michael Jones
83ccdd9c1f Explain that reference targets are writable
It might seem like a really obvious point to make but without
emphasizing it, it isn't completely clear. I would like to mention this
in the Branch section as well for how to point a branch at another
commit but I can't see how to smoothly slide it in.
2014-06-15 11:28:26 +01:00
Michael Jones
28ae47f42b Provide a doc example for discover_repository
To clarify the behaviour and usage.
2014-06-15 11:11:16 +01:00
Michael Jones
bd322fa132 Correct LIBGIT2_VERSION name and add documentation
LIBGIT2_VERSION was previously recorded as LIBGIT2_VER_VERSION which is
incorrect.

We also add basic explanations to all the constants so that the page is
a little less bare. Perhaps this should be done as autodoc style
comments in the code but I guess not.
2014-06-15 11:11:16 +01:00
J. David Ibáñez
981fc32af6 travis: test 3.4 too 2014-06-09 09:19:09 +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
130fff6f2c Bump required libgit2 version to 0.21 2014-06-08 20:35:15 +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
9e91a390cc Index: accept a tree for read_tree()
An index may not have an associated repository, so giving it an id in
that case is useless. Raise an error in that case and accept a Tree
object to make the function useful then.
2014-05-27 18:52:05 +02:00
Carlos Martín Nieto
f69a57a82a Index: make the file optional
There is no obligation for an index to exist as a file at all.
2014-05-27 18:52:05 +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
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
J. David Ibáñez
06b7438456 Merge remote-tracking branch 'ipmcc/fixblobdiff' 2014-05-08 15:54:34 +02:00
Ian P. McCullough
6b3f9e92f7 And on diff_to_buffer too. 2014-05-08 09:01:06 -04:00
Ian P. McCullough
0c62c83135 Fix format string for Blob.diff(); Format string items out of order relative to docstring and outargs. 2014-05-08 08:50:21 -04:00
Daniel Bruce
1fbe52c0f7 Add version check to C code 2014-04-29 12:38:30 +02:00
J. David Ibáñez
9d6b15786f Merge remote-tracking branch 'jun/v0.20.3-vs2008' 2014-04-28 17:03:58 +02:00
Jun Omae
c68de8e2b8 make build options.c with VS2008 compiler 2014-04-28 16:24:49 +09: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
J. David Ibáñez
17ba85831b Drop official support for Python 2.6 2014-04-23 14:01:09 +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
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
J. David Ibáñez
3cc129dd62 Merge remote-tracking branch 'origin/cffi-remote' 2014-04-18 21:56:00 +02:00
Carlos Martín Nieto
4c4968a2fb Fix config documentation keyword
The keyword for linking to a mehtod is 'meth', not 'method'. Setting the
'currentmodule' allows us to link without the 'pygit2' prefix in the
link text.
2014-04-18 12:17:54 +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
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
b4bc2b6295 Depend on the cffi package
Let both pip and Travis know what we need.
2014-04-16 22:12:24 +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
J. David Ibáñez
d51174d34f Install the "decl.h" file 2014-04-16 22:12:24 +02:00
Carlos Martín Nieto
674546bbb5 Some python3 fixes 2014-04-16 22:12:09 +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
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