- add option flags for tree.diff
- add a testcase test_diff_tree_opts - update testrepo.git - update existing testcases
This commit is contained in:
parent
ee2813251b
commit
0b537bf780
@ -274,7 +274,7 @@ Tree_diff_tree(Tree *self, PyObject *args)
|
||||
Diff *py_diff;
|
||||
PyObject *py_obj = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "|O", &py_obj))
|
||||
if (!PyArg_ParseTuple(args, "|Oi", &py_obj, &opts.flags))
|
||||
return NULL;
|
||||
|
||||
if (py_obj == NULL) {
|
||||
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,2 @@
|
||||
x<01>Ž[jÃ0DûUÜÿBÐ#’%(%[¹Ò×[
|
||||
®š¤»<EFBFBD>Iwп™9˜Ò·²>½<> aÅ"IÖ“ŸòÙå’0Ï6†Ilbã¡®¼£b†<>.¦¢}ŠIÞˆÎ9¼ss0|YñÏXúN‚•[}<øV±Ÿþzÿ½|m\×SéÛ'çMˆ:M‘ÞµÑZëqràŸºbbº/u€¾¯\@<h, 4¡>¿âZÔòmSù
|
@ -1 +1 @@
|
||||
2cdae28389c059815e951d0bb9eed6533f61a46b
|
||||
ccca47fbb26183e71a7a46d165299b84e2e6c0b3
|
||||
|
@ -30,13 +30,14 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import unicode_literals
|
||||
import unittest
|
||||
|
||||
import pygit2
|
||||
from . import utils
|
||||
|
||||
|
||||
COMMIT_SHA1_1 = '5fe808e8953c12735680c257f56600cb0de44b10'
|
||||
COMMIT_SHA1_2 = 'c2792cfa289ae6321ecf2cd5806c2194b0fd070c'
|
||||
COMMIT_SHA1_3 = '2cdae28389c059815e951d0bb9eed6533f61a46b'
|
||||
COMMIT_SHA1_4 = 'ccca47fbb26183e71a7a46d165299b84e2e6c0b3'
|
||||
|
||||
PATCH = b"""diff --git a/a b/a
|
||||
index 7f129fd..af431f2 100644
|
||||
@ -133,6 +134,20 @@ class DiffTest(utils.BareRepoTestCase):
|
||||
#self.assertEqual(hunk.data[0][0], b'a contents 2\n')
|
||||
#self.assertEqual(hunk.data[1][0], b'a contents\n')
|
||||
|
||||
def test_diff_tree_opts(self):
|
||||
commit_c = self.repo[COMMIT_SHA1_3]
|
||||
commit_d = self.repo[COMMIT_SHA1_4]
|
||||
|
||||
for opt in [pygit2.GIT_DIFF_IGNORE_WHITESPACE,
|
||||
pygit2.GIT_DIFF_IGNORE_WHITESPACE_EOL]:
|
||||
diff = commit_c.tree.diff(commit_d.tree, pygit2.GIT_DIFF_IGNORE_WHITESPACE)
|
||||
self.assertTrue(diff is not None)
|
||||
self.assertEqual(0, len(diff.changes.get('hunks', list())))
|
||||
|
||||
diff = commit_c.tree.diff(commit_d.tree)
|
||||
self.assertTrue(diff is not None)
|
||||
self.assertEqual(1, len(diff.changes.get('hunks', list())))
|
||||
|
||||
def test_diff_merge(self):
|
||||
commit_a = self.repo[COMMIT_SHA1_1]
|
||||
commit_b = self.repo[COMMIT_SHA1_2]
|
||||
|
@ -39,8 +39,8 @@ from pygit2 import GIT_OBJ_ANY, GIT_OBJ_BLOB, GIT_OBJ_COMMIT, init_repository, \
|
||||
from . import utils
|
||||
|
||||
|
||||
HEAD_SHA = '2cdae28389c059815e951d0bb9eed6533f61a46b'
|
||||
PARENT_SHA = '5fe808e8953c12735680c257f56600cb0de44b10' # HEAD^
|
||||
HEAD_SHA = 'ccca47fbb26183e71a7a46d165299b84e2e6c0b3'
|
||||
PARENT_SHA = '2cdae28389c059815e951d0bb9eed6533f61a46b' # HEAD^
|
||||
A_HEX_SHA = 'af431f20fc541ed6d5afede3e2dc7160f6f01f16'
|
||||
A_BIN_SHA = binascii.unhexlify(A_HEX_SHA.encode('ascii'))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user