20 Commits

Author SHA1 Message Date
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
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
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
Thomas Kluyver
af2528418a More informative repr for Repository objects 2014-03-25 15:13:10 -07:00
J. David Ibáñez
d7071b88cd Update copyright year 2014-02-04 08:02:12 +01: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
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
0fc7a4fbad Refactored Index.diff() into Index.diff_to_tree()/diff_to_workdir() 2013-05-18 15:29:28 +02:00
Nico von Geyso
196d0595b0 Added: Repository.diff() - porcelain method similiar to 2013-05-18 14:48:05 +02:00
J. David Ibáñez
974f16ca69 Re-work the checkout API
New API:

  Repository.head = refname
  Repository.checkout_head(strategy)
  Repository.checkout_index(strategy)
  Repository.checkout_tree(treeish, strategy)

Changed API:

  # Before
  Repository.checkout(strategy=GIT_CHECKOUT_SAFE_CREATE, reference=None,
                      head=False)

  # Now
  Repository.checkout(refname=None, strategy=GIT_CHECKOUT_SAFE_CREATE)
2013-05-05 21:45:39 +02:00
J. David Ibáñez
3a0bafa12b Rename "low level" reference creation methods
Rename Repository methods:

- git_reference_create          => create_reference_direct
- git_reference_symbolic_create => create_reference_symbolic
2013-05-04 09:30:37 +02:00
J. David Ibáñez
67417c7f56 create_reference, drop the symbolic param (#213)
Now we figure out whether it is a direct or symbolic reference based on
the type and value of the target. This guessing will fail in very very
rare situations, for that we still have the explicit lower level API.
2013-04-27 11:39:37 +02:00
J. David Ibáñez
ad4b4cc4c5 Implement the Repository mapping interface in Python
Add 'Repository.get' and low level 'Repository.git_object_lookup_prefix'
2013-03-09 23:14:17 +01:00
J. David Ibáñez
d8b2514029 Rename low level reference creation methods
The idea is to keep exactly the same name as in libgit2
2013-03-03 23:01:42 +01:00
J. David Ibáñez
9ffc14148e Now we have a Repository class written in Python 2013-03-03 14:44:42 +01:00