Rev 2882: (robertc) Add -Devil information on some Branch methods, plus comment and docstring corrections. (Robert Collins) in http://people.ubuntu.com/~robertc/baz2.0/branch

Robert Collins robertc at robertcollins.net
Thu Oct 4 03:50:36 BST 2007


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

------------------------------------------------------------
revno: 2882
revision-id: robertc at robertcollins.net-20071004025027-fcm3w3r4pu3mh0ry
parent: pqm at pqm.ubuntu.com-20071003232450-c831pepea3skddct
committer: Robert Collins <robertc at robertcollins.net>
branch nick: branch
timestamp: Thu 2007-10-04 12:50:27 +1000
message:
  (robertc) Add -Devil information on some Branch methods, plus comment and docstring corrections. (Robert Collins)
modified:
  bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2007-09-11 01:24:09 +0000
+++ b/bzrlib/branch.py	2007-10-04 02:50:27 +0000
@@ -26,6 +26,7 @@
         bzrdir,
         cache_utf8,
         config as _mod_config,
+        debug,
         errors,
         lockdir,
         lockable_files,
@@ -61,7 +62,7 @@
                                       zero_eight, zero_nine, zero_sixteen,
                                       zero_ninetyone,
                                       )
-from bzrlib.trace import mutter, note
+from bzrlib.trace import mutter, mutter_callsite, note
 
 
 BZR_BRANCH_FORMAT_4 = "Bazaar-NG branch, format 0.0.4\n"
@@ -404,11 +405,13 @@
 
     @needs_read_lock
     def revision_history(self):
-        """Return sequence of revision hashes on to this branch.
+        """Return sequence of revision ids on this branch.
         
         This method will cache the revision history for as long as it is safe to
         do so.
         """
+        if 'evil' in debug.debug_flags:
+            mutter_callsite(3, "revision_history scales with history.")
         if self._revision_history_cache is not None:
             history = self._revision_history_cache
         else:
@@ -1363,6 +1366,8 @@
     @needs_write_lock
     def set_revision_history(self, rev_history):
         """See Branch.set_revision_history."""
+        if 'evil' in debug.debug_flags:
+            mutter_callsite(3, "set_revision_history scales with history.")
         rev_history = [osutils.safe_revision_id(r) for r in rev_history]
         self._clear_cached_state()
         self._write_revision_history(rev_history)
@@ -1396,6 +1401,8 @@
 
     def _lefthand_history(self, revision_id, last_rev=None,
                           other_branch=None):
+        if 'evil' in debug.debug_flags:
+            mutter_callsite(4, "_lefthand_history scales with history.")
         # stop_revision must be a descendant of last_revision
         stop_graph = self.repository.get_revision_graph(revision_id)
         if (last_rev is not None and last_rev != _mod_revision.NULL_REVISION
@@ -1445,8 +1452,10 @@
             # whats the current last revision, before we fetch [and change it
             # possibly]
             last_rev = _mod_revision.ensure_null(self.last_revision())
-            # we fetch here regardless of whether we need to so that we pickup
-            # filled in ghosts.
+            # we fetch here so that we don't process data twice in the common
+            # case of having something to pull, and so that the check for 
+            # already merged can operate on the just fetched graph, which will
+            # be cached in memory.
             self.fetch(other, stop_revision)
             if self.repository.get_graph().is_ancestor(stop_revision,
                                                        last_rev):



More information about the bazaar-commits mailing list