The 'committer' and 'message' arguments to Repo.do_commit() have
authorJelmer Vernooij <jelmer@samba.org>
Thu, 11 Mar 2010 14:00:12 +0000 (15:00 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Thu, 11 Mar 2010 14:00:12 +0000 (15:00 +0100)
been swapped. 'committer' is now optional. (Jelmer Vernooij)

Add some TODO items.

NEWS
dulwich/repo.py

diff --git a/NEWS b/NEWS
index 6c2d153ffad13bb3a746f37da5c70ae7e87cbf35..094c4baf10c019e16dac5babeb3de4c7ae25e806 100644 (file)
--- a/NEWS
+++ b/NEWS
 
   * Add framework for testing compatibility with C Git. (Dave Borowitz)
 
+ API BREAKAGES
+
+  * The 'committer' and 'message' arguments to Repo.do_commit() have 
+    been swapped. 'committer' is now optional. (Jelmer Vernooij)
+
 0.5.0  2010-03-03
 
  BUG FIXES
index 4856e80072157159444e862bc1676ecd8c159b05..deab29b7f7198e3aa00fee91d2fcc5545bfc6498 100644 (file)
@@ -799,14 +799,14 @@ class BaseRepo(object):
             del self.refs[name]
         raise ValueError(name)
 
-    def do_commit(self, committer, message,
+    def do_commit(self, message, committer=None, 
                   author=None, commit_timestamp=None,
                   commit_timezone=None, author_timestamp=None, 
                   author_timezone=None, tree=None):
         """Create a new commit.
 
-        :param committer: Committer fullname
         :param message: Commit message
+        :param committer: Committer fullname
         :param author: Author fullname (defaults to committer)
         :param commit_timestamp: Commit timestamp (defaults to now)
         :param commit_timezone: Commit timestamp timezone (defaults to GMT)
@@ -816,19 +816,22 @@ class BaseRepo(object):
         :param tree: SHA1 of the tree root to use (if not specified the current index will be committed).
         :return: New commit SHA1
         """
-        from dulwich.index import commit_index
         import time
         index = self.open_index()
         c = Commit()
         if tree is None:
-            c.tree = commit_index(self.object_store, index)
+            c.tree = index.commit(self.object_store)
         else:
             c.tree = tree
+        # TODO: Allow username to be missing, and get it from .git/config
+        if committer is None:
+            raise ValueError("committer not set")
         c.committer = committer
         if commit_timestamp is None:
             commit_timestamp = time.time()
         c.commit_time = int(commit_timestamp)
         if commit_timezone is None:
+            # FIXME: Use current user timezone rather than UTC
             commit_timezone = 0
         c.commit_timezone = commit_timezone
         if author is None: