227 Commits

Author SHA1 Message Date
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
J. David Ibáñez
e6c270fe35 Get ready to release v0.20.0 2013-11-24 15:22:10 +01:00
Carlos Martín Nieto
b7e906eee9 Adjust to libgit2 development branch
This wraps the previous functionality, though there are some iterator
changes we might still want to bring over.
2013-11-20 12:20:26 +01:00
J. David Ibáñez
9c13be8dec Release 0.19.1
API changes:

- Rename Commit._message to Commit.raw_message
- Rename Signature._name to Signature.raw_name
- Rename Signature._email to Signature.raw_email

New features:

- Remote.push(refspec)
- Tag.get_object()

And some bugs fixed.

Thanks to Brodie Rao, Fraser Tweedale, Andrew Chin and Carlos Martín
Nieto.
2013-10-03 20:35:58 +02:00
J. David Ibáñez
5a007802d0 Release 0.19.0
API changes:

- New Oid type
- Changed signature of Repository.create_reference
- Reference.oid and Reference.hex removed, use Reference.target instead
- Drop "del Index[path]" from the API, use Index.remove(path) instead
- Drop TreeEntry.to_object
- Changed signature of Repository.checkout
- Repository.create_blob_from_file removed, use instead new methods
  Repository.create_blob_fromworkdir and
  Repository.create_blob_from_disk

New features:

- Add len(TreeBuilder) and TreeBuilder.get
- Add Repository.merge_base
- Support changing the head with "Repository.head = refname"
- Improved support for diff
- Add support for clone
- Python 2: Support hex oids as byte strings
- Add Reference.get_object()
- Add Remote.save
- Add support for branches, new type Branch

Other:

- Upgraded to libgit2 0.19
- Partial documentation review

Thanks to Nico von Geyso, Daniel Rodríguez Troitiño, Bernardo Heynemann,
Rémi Duraffort, Andrey Devyatkin, Hervé Cauwelier, Jiunn Haur Lim, Richo
Healey, Carlos Martín Nieto, David Fischer, Fraser Tweedale, Jun Omae
and Xu Tao.
2013-07-13 12:04:14 +02:00
Daniel Rodríguez Troitiño
1062ab638b Implement Repository.lookup_branch. Constants for local and remote branches. 2013-05-26 17:43:28 +02:00
J. David Ibáñez
0c86307eb5 Coding style: Silent pep8 2013-05-26 14:39:12 +02:00
J. David Ibáñez
5904a8752c docs: fix warning 2013-05-24 23:10:55 +02:00
J. David Ibáñez
f075aa3665 Fix some "errors" found by pyflakes 2013-05-24 21:34:10 +02:00
Nico von Geyso
6dd14d799e Fixed: Use GIT_DIFF_NORMAL as default flag for Diff 2013-05-20 15:38:49 +02:00
Nico von Geyso
86aafebb6d Fixed: remove OrderedDict for compability reasons (python2.6) 2013-05-20 15:13:04 +02:00
Nico von Geyso
77b5cdce5b Refactored: get rid of type check for treeish_to_tree in Diff 2013-05-20 14:58:54 +02:00
Nico von Geyso
6ce71a2799 Added: support for context_lines and interhunk_lines for diffs 2013-05-20 14:49:48 +02:00
Nico von Geyso
b4656cc99c Merge remote-tracking branch 'upstream/master' into features/diff_refactoring
Conflicts:
	src/tree.c
2013-05-18 15:48:27 +02:00
Nico von Geyso
0fc7a4fbad Refactored Index.diff() into Index.diff_to_tree()/diff_to_workdir() 2013-05-18 15:29:28 +02:00