the number of deltas/patches in one diff
This commit is contained in:
parent
9c13be8dec
commit
9730564c73
@ -249,6 +249,12 @@ PyTypeObject DiffIterType = {
|
||||
(iternextfunc) DiffIter_iternext, /* tp_iternext */
|
||||
};
|
||||
|
||||
PyDoc_STRVAR(Diff_size__doc__, "Returns the number of deltas/patches in this diff.");
|
||||
PyObject *
|
||||
Diff_size__get__(Diff *self)
|
||||
{
|
||||
return PyLong_FromSize_t(git_diff_num_deltas(self->list));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(Diff_patch__doc__, "Patch diff string.");
|
||||
|
||||
@ -440,6 +446,7 @@ Diff_dealloc(Diff *self)
|
||||
|
||||
PyGetSetDef Diff_getseters[] = {
|
||||
GETTER(Diff, patch),
|
||||
GETTER(Diff, size),
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
@ -254,6 +254,7 @@ class DiffTest(utils.BareRepoTestCase):
|
||||
|
||||
diff = commit_a.tree.diff_to_tree(commit_b.tree)
|
||||
self.assertEqual(diff.patch, PATCH)
|
||||
self.assertEqual(diff.size, len([patch for patch in diff]))
|
||||
|
||||
def test_diff_oids(self):
|
||||
commit_a = self.repo[COMMIT_SHA1_1]
|
||||
|
Loading…
x
Reference in New Issue
Block a user