Bläddra i källkod

test_diff_tree: Allow passing SHAs to commit_tree.

Change-Id: Ifff218a5f00265ff16e41822f6de639e3d26601a
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
Dave Borowitz 14 år sedan
förälder
incheckning
5be2480e0d
1 ändrade filer med 10 tillägg och 6 borttagningar
  1. 10 6
      dulwich/tests/test_diff_tree.py

+ 10 - 6
dulwich/tests/test_diff_tree.py

@@ -63,16 +63,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)]