Rev 2888: (robertc) Add -Devil information on some Branch methods, plus comment and docstring corrections. (Robert Collins) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Oct 4 22:50:04 BST 2007


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 2888
revision-id: pqm at pqm.ubuntu.com-20071004215001-549ul8av89cwpnjp
parent: pqm at pqm.ubuntu.com-20071004174812-z1zg35r1vssltydl
parent: robertc at robertcollins.net-20071004025027-fcm3w3r4pu3mh0ry
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2007-10-04 22:50:01 +0100
message:
  (robertc) Add -Devil information on some Branch methods, plus comment and docstring corrections. (Robert Collins)
modified:
  bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
    ------------------------------------------------------------
    revno: 2881.3.1
    merged: 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 file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2007-09-18 20:04:21 +0000
+++ b/bzrlib/branch.py	2007-10-04 21:50:01 +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:
@@ -1364,6 +1367,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)
@@ -1397,6 +1402,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
@@ -1446,8 +1453,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