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.
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.
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.
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.
There is no more MergeResult type. Instead, the user can use
Repository.merge_analysis() to get an overview of their options and call
git_merge() when they mean to merge.
The git_merge() function now also performs a checkout.
The type of a config value depends on the tool that interprets
it. Parsing eagerly can lead to a situation where we return a bool
instead of a string or a number.
Let the user specify the type themselves by passing in a (str, type)
tuple into the mapping interface.
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.
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.
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.
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.
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.