← Back to team overview

dulwich-users team mailing list archive

[PATCH 16/28] test_diff: Allow passing SHAs to commit_tree.

 

From: Dave Borowitz <dborowitz@xxxxxxxxxx>

Change-Id: Ifff218a5f00265ff16e41822f6de639e3d26601a
---
 dulwich/tests/test_diff.py |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/dulwich/tests/test_diff.py b/dulwich/tests/test_diff.py
index 57492d4..33be3bb 100644
--- a/dulwich/tests/test_diff.py
+++ b/dulwich/tests/test_diff.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