Merge remote-tracking branch 'alexband/size'
This commit is contained in:
commit
145646a73b
@ -271,6 +271,12 @@ PyTypeObject DiffIterType = {
|
||||
(iternextfunc) DiffIter_iternext, /* tp_iternext */
|
||||
};
|
||||
|
||||
Py_ssize_t
|
||||
Diff_len(Diff *self)
|
||||
{
|
||||
assert(self->list);
|
||||
return (Py_ssize_t)git_diff_num_deltas(self->list);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(Diff_patch__doc__, "Patch diff string.");
|
||||
|
||||
@ -466,7 +472,7 @@ PyGetSetDef Diff_getseters[] = {
|
||||
};
|
||||
|
||||
PyMappingMethods Diff_as_mapping = {
|
||||
0, /* mp_length */
|
||||
(lenfunc)Diff_len, /* mp_length */
|
||||
(binaryfunc)Diff_getitem, /* mp_subscript */
|
||||
0, /* mp_ass_subscript */
|
||||
};
|
||||
|
@ -255,6 +255,7 @@ class DiffTest(utils.BareRepoTestCase):
|
||||
|
||||
diff = commit_a.tree.diff_to_tree(commit_b.tree)
|
||||
self.assertEqual(diff.patch, PATCH)
|
||||
self.assertEqual(len(diff), len([patch for patch in diff]))
|
||||
|
||||
def test_diff_oids(self):
|
||||
commit_a = self.repo[COMMIT_SHA1_1]
|
||||
|
Loading…
Reference in New Issue
Block a user