|
@@ -30,6 +30,7 @@ from dulwich.diff_tree import (
|
|
|
_similarity_score,
|
|
|
_tree_change_key,
|
|
|
RenameDetector,
|
|
|
+ _is_tree,
|
|
|
)
|
|
|
from dulwich.index import (
|
|
|
commit_tree,
|
|
@@ -120,6 +121,15 @@ class TreeChangesTest(DiffTestCase):
|
|
|
(('c', 0100755, blob_c2.id), (None, None, None)),
|
|
|
], _merge_entries('', tree2, tree1))
|
|
|
|
|
|
+ def test_is_tree(self):
|
|
|
+ self.assertFalse(_is_tree(TreeEntry(None, None, None)))
|
|
|
+ self.assertFalse(_is_tree(TreeEntry('a', 0100644, 'a' * 40)))
|
|
|
+ self.assertFalse(_is_tree(TreeEntry('a', 0100755, 'a' * 40)))
|
|
|
+ self.assertFalse(_is_tree(TreeEntry('a', 0120000, 'a' * 40)))
|
|
|
+ self.assertTrue(_is_tree(TreeEntry('a', 0040000, 'a' * 40)))
|
|
|
+ self.assertRaises(TypeError, _is_tree, TreeEntry('a', 'x', 'a' * 40))
|
|
|
+ self.assertRaises(AttributeError, _is_tree, 1234)
|
|
|
+
|
|
|
def assertChangesEqual(self, expected, tree1, tree2, **kwargs):
|
|
|
actual = list(tree_changes(self.store, tree1.id, tree2.id, **kwargs))
|
|
|
self.assertEqual(expected, actual)
|