dulwich-users team mailing list archive
-
dulwich-users team
-
Mailing list archive
-
Message #00337
[PATCH 12/24] test_diff_tree: Allow passing SHAs to commit_tree.
From: Dave Borowitz <dborowitz@xxxxxxxxxx>
Change-Id: Ifff218a5f00265ff16e41822f6de639e3d26601a
---
dulwich/tests/test_diff_tree.py | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/dulwich/tests/test_diff_tree.py b/dulwich/tests/test_diff_tree.py
index 59954ac..950dcaa 100644
--- a/dulwich/tests/test_diff_tree.py
+++ b/dulwich/tests/test_diff_tree.py
@@ -62,16 +62,20 @@ class DiffTestCase(TestCase):
self.store = MemoryObjectStore()
self.empty_tree = self.commit_tree([])
- def commit_tree(self, blobs):
+ def commit_tree(self, entries):
commit_blobs = []
- for entry in blobs:
+ for entry in entries:
if len(entry) == 2:
- path, blob = entry
+ path, obj = entry
mode = F
else:
- path, blob, mode = entry
- self.store.add_object(blob)
- commit_blobs.append((path, blob.id, mode))
+ path, obj, mode = entry
+ if isinstance(obj, Blob):
+ self.store.add_object(obj)
+ sha = obj.id
+ else:
+ sha = obj
+ commit_blobs.append((path, sha, mode))
return self.store[commit_tree(self.store, commit_blobs)]
--
1.7.3.2.168.gd6b63
References