Merge branch 'libgit2-dev' into revparse

`git_revparse_single` only dates back to

  commit ac250c56c7d7bb11691c9dfbcd0dbf580d85e177
  Author: Ben Straub <bstraub@github.com>
  Date:   Wed Apr 25 16:24:22 2012 -0700

    First stab at implementation of rev-parse.

which is not included in libgit2 0.17.0.  We need to pull in these
patches to work with the current `development` branch of libgit2,
which does include the revparse code.
This commit is contained in:
W. Trevor King
2012-09-13 16:37:30 -04:00
8 changed files with 15 additions and 15 deletions

View File

@@ -200,7 +200,7 @@ This is the interface of a tree entry::
TreeEntry.name -- name of the tree entry
TreeEntry.oid -- the id of the git object
TreeEntry.hex -- hexadecimal representation of the oid
TreeEntry.attributes -- the Unix file attributes
TreeEntry.filemode -- the Unix file attributes
TreeEntry.to_object() -- returns the git object (equivalent to repo[entry.oid])

View File

@@ -33,7 +33,7 @@
#include <git2.h>
#include <pygit2/types.h>
PyObject* TreeEntry_get_attributes(TreeEntry *self);
PyObject* TreeEntry_get_filemode(TreeEntry *self);
PyObject* TreeEntry_get_name(TreeEntry *self);
PyObject* TreeEntry_get_oid(TreeEntry *self);
PyObject* TreeEntry_get_hex(TreeEntry *self);

View File

@@ -55,7 +55,7 @@ PyObject * Error_type(int type)
return GitError;
/** No entries left in ref walker */
case GIT_REVWALKOVER:
case GIT_ITEROVER:
return PyExc_StopIteration;
}

View File

@@ -331,7 +331,7 @@ Index_read_tree(Index *self, PyObject *value)
if (err < 0)
return Error_set(err);
err = git_index_read_tree(self->index, tree);
err = git_index_read_tree(self->index, tree, NULL);
if (err < 0)
return Error_set(err);

View File

@@ -46,9 +46,9 @@ TreeEntry_dealloc(TreeEntry *self)
}
PyObject *
TreeEntry_get_attributes(TreeEntry *self)
TreeEntry_get_filemode(TreeEntry *self)
{
return PyInt_FromLong(git_tree_entry_attributes(self->entry));
return PyInt_FromLong(git_tree_entry_filemode(self->entry));
}
PyObject *
@@ -84,7 +84,7 @@ TreeEntry_to_object(TreeEntry *self)
}
PyGetSetDef TreeEntry_getseters[] = {
{"attributes", (getter)TreeEntry_get_attributes, NULL, "attributes", NULL},
{"filemode", (getter)TreeEntry_get_filemode, NULL, "filemode", NULL},
{"name", (getter)TreeEntry_get_name, NULL, "name", NULL},
{"oid", (getter)TreeEntry_get_oid, NULL, "object id", NULL},
{"hex", (getter)TreeEntry_get_hex, NULL, "hex oid", NULL},

View File

@@ -123,9 +123,9 @@ class DiffTest(utils.BareRepoTestCase):
hunk = diff.changes['hunks'][0]
self.assertEqual(hunk.old_start, 1)
self.assertEqual(hunk.old_lines, 0)
self.assertEqual(hunk.old_lines, 1)
self.assertEqual(hunk.new_start, 1)
self.assertEqual(hunk.new_lines, 0)
self.assertEqual(hunk.new_lines, 1)
self.assertEqual(hunk.old_file, 'a')
self.assertEqual(hunk.new_file, 'a')
@@ -157,9 +157,9 @@ class DiffTest(utils.BareRepoTestCase):
hunk = diff_b.changes['hunks'][1]
self.assertEqual(hunk.old_start, 1)
self.assertEqual(hunk.old_lines, 0)
self.assertEqual(hunk.old_lines, 1)
self.assertEqual(hunk.new_start, 1)
self.assertEqual(hunk.new_lines, 0)
self.assertEqual(hunk.new_lines, 1)
self.assertEqual(hunk.old_file, 'b')
self.assertEqual(hunk.new_file, 'b')

View File

@@ -42,11 +42,11 @@ SUBTREE_SHA = '614fd9a3094bf618ea938fffc00e7d1a54f89ad0'
class TreeTest(utils.BareRepoTestCase):
def assertTreeEntryEqual(self, entry, sha, name, attributes):
def assertTreeEntryEqual(self, entry, sha, name, filemode):
self.assertEqual(entry.hex, sha)
self.assertEqual(entry.name, name)
self.assertEqual(entry.attributes, attributes,
'0%o != 0%o' % (entry.attributes, attributes))
self.assertEqual(entry.filemode, filemode,
'0%o != 0%o' % (entry.filemode, filemode))
def test_read_tree(self):
tree = self.repo[TREE_SHA]

View File

@@ -57,7 +57,7 @@ class TreeBuilderTest(utils.BareRepoTestCase):
tree = self.repo[TREE_SHA]
bld = self.repo.TreeBuilder()
for e in tree:
bld.insert(e.name, e.hex, e.attributes)
bld.insert(e.name, e.hex, e.filemode)
result = bld.write()
self.assertEqual(tree.oid, result)