Upgrading to libgit2 0.19 (wip)
This commit is contained in:
@@ -877,34 +877,29 @@ PyObject* Repository_create_branch(Repository *self, PyObject *args)
|
|||||||
|
|
||||||
|
|
||||||
PyDoc_STRVAR(Repository_listall_references__doc__,
|
PyDoc_STRVAR(Repository_listall_references__doc__,
|
||||||
"listall_references([flags]) -> (str, ...)\n"
|
"listall_references() -> (str, ...)\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Return a tuple with all the references in the repository.");
|
"Return a tuple with all the references in the repository.");
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
Repository_listall_references(Repository *self, PyObject *args)
|
Repository_listall_references(Repository *self, PyObject *args)
|
||||||
{
|
{
|
||||||
unsigned list_flags=GIT_REF_LISTALL;
|
|
||||||
git_strarray c_result;
|
git_strarray c_result;
|
||||||
PyObject *py_result, *py_string;
|
PyObject *py_result, *py_string;
|
||||||
unsigned index;
|
unsigned index;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
/* 1- Get list_flags */
|
/* Get the C result */
|
||||||
if (!PyArg_ParseTuple(args, "|I", &list_flags))
|
err = git_reference_list(&c_result, self->repo);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
/* 2- Get the C result */
|
|
||||||
err = git_reference_list(&c_result, self->repo, list_flags);
|
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return Error_set(err);
|
return Error_set(err);
|
||||||
|
|
||||||
/* 3- Create a new PyTuple */
|
/* Create a new PyTuple */
|
||||||
py_result = PyTuple_New(c_result.count);
|
py_result = PyTuple_New(c_result.count);
|
||||||
if (py_result == NULL)
|
if (py_result == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
/* 4- Fill it */
|
/* Fill it */
|
||||||
for (index=0; index < c_result.count; index++) {
|
for (index=0; index < c_result.count; index++) {
|
||||||
py_string = to_path((c_result.strings)[index]);
|
py_string = to_path((c_result.strings)[index]);
|
||||||
if (py_string == NULL) {
|
if (py_string == NULL) {
|
||||||
@@ -1441,7 +1436,7 @@ PyMethodDef Repository_methods[] = {
|
|||||||
METHOD(Repository, write, METH_VARARGS),
|
METHOD(Repository, write, METH_VARARGS),
|
||||||
METHOD(Repository, create_reference_direct, METH_VARARGS),
|
METHOD(Repository, create_reference_direct, METH_VARARGS),
|
||||||
METHOD(Repository, create_reference_symbolic, METH_VARARGS),
|
METHOD(Repository, create_reference_symbolic, METH_VARARGS),
|
||||||
METHOD(Repository, listall_references, METH_VARARGS),
|
METHOD(Repository, listall_references, METH_NOARGS),
|
||||||
METHOD(Repository, lookup_reference, METH_O),
|
METHOD(Repository, lookup_reference, METH_O),
|
||||||
METHOD(Repository, revparse_single, METH_O),
|
METHOD(Repository, revparse_single, METH_O),
|
||||||
METHOD(Repository, status, METH_NOARGS),
|
METHOD(Repository, status, METH_NOARGS),
|
||||||
|
@@ -54,10 +54,6 @@ class ReferencesTest(utils.RepoTestCase):
|
|||||||
['refs/heads/i18n', 'refs/heads/master',
|
['refs/heads/i18n', 'refs/heads/master',
|
||||||
'refs/tags/version1'])
|
'refs/tags/version1'])
|
||||||
|
|
||||||
# Now we list only the symbolic references
|
|
||||||
self.assertEqual(repo.listall_references(GIT_REF_SYMBOLIC),
|
|
||||||
('refs/tags/version1', ))
|
|
||||||
|
|
||||||
def test_head(self):
|
def test_head(self):
|
||||||
head = self.repo.head
|
head = self.repo.head
|
||||||
self.assertEqual(LAST_COMMIT, self.repo[head.target].hex)
|
self.assertEqual(LAST_COMMIT, self.repo[head.target].hex)
|
||||||
|
Reference in New Issue
Block a user