Add Index.commit.
authorJelmer Vernooij <jelmer@samba.org>
Thu, 11 Mar 2010 13:55:12 +0000 (14:55 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Thu, 11 Mar 2010 13:55:12 +0000 (14:55 +0100)
dulwich/index.py
dulwich/repo.py

index 8e963a9c70c4d8b09c69ae05de54d3fbb5ec8374..b2c2619e86d41358f128568cdc982d01909a4fc4 100644 (file)
@@ -283,6 +283,14 @@ class Index(object):
         for name in mine:
             yield ((None, name), (None, self.get_mode(name)), (None, self.get_sha1(name)))
 
+    def commit(self, object_store):
+        """Create a new tree from an index.
+
+        :param object_store: Object store to save the tree in
+        :return: Root tree SHA
+        """
+        return commit_tree(object_store, self.iterblobs())
+
 
 def commit_tree(object_store, blobs):
     """Commit a new tree.
@@ -327,5 +335,7 @@ def commit_index(object_store, index):
 
     :param object_store: Object store to save the tree in
     :param index: Index file
+    :note: This function is deprecated, use index.commit() instead.
+    :return: Root tree sha.
     """
     return commit_tree(object_store, index.iterblobs())
index ef3e9ffe422d56e4afdfe000d9a0086ff4dd8541..4856e80072157159444e862bc1676ecd8c159b05 100644 (file)
@@ -774,8 +774,7 @@ class BaseRepo(object):
                     break
                 i += 1
             history.insert(i, commit)
-            parents = commit.parents
-            pending_commits += parents
+            pending_commits += commit.parents
         history.reverse()
         return history