393 Commits

Author SHA1 Message Date
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
77acb11cd0 credentials: memory safety
The docs say to use tp_free() to free the memory, and even though we use
PyObject_Del() everywhere else, using this in the credentials does cause
issues.
2014-03-26 19:14:57 +01:00
Carlos Martín Nieto
b49da53962 Introduce credentials 2014-03-26 12:10:24 +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
Carlos Martín Nieto
ab44196730 Introduce libgit2 options
Allow setting and getting the mwindow size and search paths.
2014-03-23 15:23:42 +01:00
Leonardo Rhodes
1a17256ee3 added unit test 2014-02-13 23:09:40 +01:00
J. David Ibáñez
56a2f0f9a8 Merge remote-tracking branch 'carlos/object-peel' 2014-02-11 19:07:40 +01:00
Carlos Martín Nieto
b2cd25cf00 object: allow passing a type object to peel()
Allow usage of a python type instead of having to use the libgit2
constants.
2014-02-11 18:30:47 +01:00
Carlos Martín Nieto
de3dba668a object: implement peel()
This simplifies getting one type of object from a higher-level one as
well as accepting a commit-ish or tree-ish.
2014-02-11 18:30:47 +01:00
Carlos Martín Nieto
1f3c0170aa test: clean up
Remove the temporary files and directories we create as part of running
the test suite.
2014-02-11 17:53:31 +01:00
Carlos Martín Nieto
73170cc104 walk: make the sorting mode optional
Since the libgit2 has a default sorting method, which we also mention as
default in the documentation, there is no particular need to make the
user choose a sorting method when the order does not matter. We use
sorting NONE in that case.
2014-02-06 10:46:30 +01: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
J. David Ibáñez
6a8e7a97cb Merge remote-tracking branch 'carlos/index-add-entry' 2014-01-29 11:57:44 +01:00
Carlos Martín Nieto
f3f3d28637 Index: allow writing the tree to a particular repository
Take an optional repository in Index.write_tree() to serialize to a tree
into a particular repository's odb.
2014-01-29 11:46:53 +01:00
Carlos Martín Nieto
c43c320c3e Index: accept adding either a path or an IndexEntry
A path is only useful if we have the file on the worktree. Passing an
IndexEntry allows us to add an entry with arbitrary attributes.
2014-01-29 11:46:53 +01:00
Carlos Martín Nieto
f6389ee2c3 IndexEntry: make the attributes writable
When updating entries in an index, it is necessary to modify the
attributes of tree entries. make it possible to do so.
2014-01-29 11:46:53 +01:00
J. David Ibáñez
3026798add Merge remote-tracking branch 'carlos/pypy' 2014-01-27 22:58:47 +01:00
Carlos Martín Nieto
30084e00c4 Add support for pypy
Fortunately pypy provides support for a lot of the CPython API, so the
changes are minimal.

The most important changes are:

- constructors always get a keyword argument dictionary, even if no
  keyword arguments are passed

- trying to assign to a read-only attribute raises TypeError instead of
  AttributeError

Apart from that, pypy does not provide MAXPATHLEN. There is a hack in
place currently, but there is only place that's using that macro, and
there shouldn't be a need for it much longer.

This fixes #209.
2014-01-26 09:52:35 +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
5410128187 TreeEntry: move to use 'id' attribute for the object's id
Similar to the Object change, we should be using 'id' when referring to
the target's id.x
2014-01-24 11:25:39 +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
3a83cb44b6 Oid: Deprecate 'hex' in favour of str() or unicode()
Python has built-in functions to get a string representation of an
object id, so let's use that instead of using a custom attribute.
2014-01-24 10:28:53 +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
b27b10eb56 Merge remote-tracking branch 'carlos/tree-deep-search' 2014-01-20 10:48:23 +01: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
5baaf287d2 Tree: let contains look in subtrees
Allow looking in subtrees as a convenience in the 'contains'
function. As slashes are not allowed to be part of the name of an entry,
there is no ambiguity in what they mean.
2014-01-20 03:37:59 +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
J. David Ibáñez
73518fd804 Merge remote-tracking branch 'carlos/treeentry-cmp' 2014-01-19 20:09:22 +01:00
J. David Ibáñez
5bca48ee57 Merge remote-tracking branch 'carlos/config-iterator' 2014-01-19 20:00:46 +01:00
J. David Ibáñez
8090a11530 Merge remote-tracking branch 'carlos/commit-attr-id' 2014-01-19 19:51:33 +01:00
Carlos Martín Nieto
35386cbec2 Config: switch from foreach iterator
An iterator is much more natural in python, so let's use that.
2014-01-19 17:57:26 +01:00
Carlos Martín Nieto
4dc90f78a9 TreeEntry: add rich comparison function
Allow direct comparisons between TreeEntry objects, which also allows us
to use assertEqual in the sanity check test.

This fixes #305.
2014-01-19 17:10:40 +01:00
Carlos Martín Nieto
1b473b7183 Commit: allow retrieval of the parents' ids
Don't force the user to load the parents in order to get their ids, but
expose a list of the ids directly.
2014-01-19 15:53:20 +01:00
Carlos Martín Nieto
5a80091c2d Commit: allow retrieval of the tree's ID
Let the user retrieve the ID of the commit's tree instead of having to
load the tree just to retrieve this information.
2014-01-19 15:49:43 +01:00
Carlos Martín Nieto
bf26aaf180 Repository: allow retrieving the default signature
Make it easier to grab the default signature for a repository by adding
a getter at the Repository level.
2014-01-19 15:26:29 +01:00
Petr Hosek
dcc9051a8c Support diff for blobs 2014-01-15 15:40:04 +00:00
J. David Ibáñez
cde2456327 tests: fix deprecation warning 2013-12-24 10:51:02 +01:00
Petr Hosek
3cc0662def Test case for Walker simplify_first_parent 2013-12-20 13:28:20 +00:00
J. David Ibáñez
7e2cfd7a70 Remove trailing whitespace 2013-12-10 21:00:44 +01:00
J. David Ibáñez
5d9a19ea8d Merge remote-tracking branch 'victor/master' 2013-12-10 21:00:02 +01:00
Victor Garcia
0556ab0cd8 implementing merge: removing index field from MergeResult 2013-12-10 16:01:48 +01:00
Victor Garcia
7d9d2667e5 implementing merge: merge.rst doc and implementing MergeResult as a simple type that maps git_merge_result to it 2013-12-09 15:40:39 +01:00
Adam Spiers
749810ac77 fix blame argument handling
The argument handling for the new Repository_blame had several problems:

- The call to PyArg_ParseTupleAndKeywords was missing &path, so none
  of the optional arguments got parsed correctly.
- newest_commit and oldest_commit were missing type validation
  against OidType.
- The opts structure was discarded rather than passed to git_blame_file.

This commit fixes these issues and adds a test case.
2013-12-09 12:03:32 +00:00
Victor Garcia
1f2fdca2c1 implementing merge with default options - new test 2013-12-04 20:04:02 +01:00
Victor Garcia
9955b3e67a implementing merge with default options 2013-12-04 18:23:13 +01:00