Rev 2922: During commit check for the first commit by NULL_REVISION rather than a completely empty basis tree, removing one use of the basis inventory. in http://people.ubuntu.com/~robertc/baz2.0/commit

Robert Collins robertc at robertcollins.net
Mon Oct 22 22:25:27 BST 2007


At http://people.ubuntu.com/~robertc/baz2.0/commit

------------------------------------------------------------
revno: 2922
revision-id:robertc at robertcollins.net-20071022212521-wac62k68k3quy6om
parent: pqm at pqm.ubuntu.com-20071019201226-6z006xotgfe7zmu8
committer: Robert Collins <robertc at robertcollins.net>
branch nick: commit
timestamp: Tue 2007-10-23 07:25:21 +1000
message:
  During commit check for the first commit by NULL_REVISION rather than a completely empty basis tree, removing one use of the basis inventory.
modified:
  bzrlib/commit.py               commit.py-20050511101309-79ec1a0168e0e825
=== modified file 'bzrlib/commit.py'
--- a/bzrlib/commit.py	2007-10-15 05:02:05 +0000
+++ b/bzrlib/commit.py	2007-10-22 21:25:21 +0000
@@ -60,6 +60,7 @@
     debug,
     errors,
     inventory,
+    revision,
     tree,
     )
 from bzrlib.branch import Branch
@@ -269,6 +270,7 @@
 
         self.work_tree.lock_write()
         self.pb = bzrlib.ui.ui_factory.nested_progress_bar()
+        self.basis_revid = self.work_tree.last_revision()
         self.basis_tree = self.work_tree.basis_tree()
         self.basis_tree.lock_read()
         try:
@@ -415,8 +417,9 @@
         # TODO: we could simplify this by using self._basis_delta.
 
         # The inital commit adds a root directory, but this in itself is not
-        # a worthwhile commit.  
-        if len(self.basis_inv) == 0 and len(self.builder.new_inventory) == 1:
+        # a worthwhile commit.
+        if (self.basis_revid == revision.NULL_REVISION and
+            len(self.builder.new_inventory) == 1):
             raise PointlessCommit()
         # Shortcut, if the number of entries changes, then we obviously have
         # a change



More information about the bazaar-commits mailing list