Rev 2947: Only set Commit.basis_inv when it is needed for reporting changes. in http://people.ubuntu.com/~robertc/baz2.0/commit-builder

Robert Collins robertc at robertcollins.net
Sat Oct 27 01:01:53 BST 2007


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

------------------------------------------------------------
revno: 2947
revision-id:robertc at robertcollins.net-20071027000147-b04ojn0wek4mzp9u
parent: robertc at robertcollins.net-20071026234414-dbojmo930u99s4wn
committer: Robert Collins <robertc at robertcollins.net>
branch nick: commit-builder
timestamp: Sat 2007-10-27 10:01:47 +1000
message:
  Only set Commit.basis_inv when it is needed for reporting changes.
modified:
  bzrlib/commit.py               commit.py-20050511101309-79ec1a0168e0e825
=== modified file 'bzrlib/commit.py'
--- a/bzrlib/commit.py	2007-10-26 23:44:14 +0000
+++ b/bzrlib/commit.py	2007-10-27 00:01:47 +0000
@@ -318,10 +318,13 @@
             self.pb.show_count = True
             self.pb.show_bar = True
 
+            if self.reporter.is_verbose():
+                # Setup the basis inventory for use during _report_changes if
+                # it will be used.
+                self.basis_inv = self.basis_tree.inventory
+            self._gather_parents()
             # After a merge, a selected file commit is not supported.
             # See 'bzr help merge' for an explanation as to why.
-            self.basis_inv = self.basis_tree.inventory
-            self._gather_parents()
             if len(self.parents) > 1 and self.specific_files:
                 raise errors.CannotCommitSelectedFileMerge(self.specific_files)
 
@@ -814,6 +817,9 @@
         The change that has occurred is described relative to the basis
         inventory.
         """
+        # XXX: Should report off the inventory delta object not by rediffing
+        # against the basis.
+        # NB: basis_inv is set only when the reporter object is verbose.
         if (self.basis_inv.has_id(ie.file_id)):
             basis_ie = self.basis_inv[ie.file_id]
         else:



More information about the bazaar-commits mailing list