Rev 412: Shortcut get_revids_from when we aren't actually checking merges. in http://bazaar.launchpad.net/~jameinel/loggerhead/simple_mainline

John Arbash Meinel john at arbash-meinel.com
Mon Apr 26 22:23:42 BST 2010


At http://bazaar.launchpad.net/~jameinel/loggerhead/simple_mainline

------------------------------------------------------------
revno: 412
revision-id: john at arbash-meinel.com-20100426212304-dnf9er2s4njhir6g
parent: mnordhoff at mattnordhoff.com-20100424124017-do5wupmzlkmejtvk
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: simple_mainline
timestamp: Mon 2010-04-26 16:23:04 -0500
message:
  Shortcut get_revids_from when we aren't actually checking merges.
  
  The code is there to handle stuff like 'show mainline revs that merged these file
  changes'. However, it is way overkill when all you need is the simple mainline.
  
  This avoids scaling something that is a simple linear load into a O(history) operation.
  
  Saves ~30ms on emacs. (Down to 215ms for emacs/trunk/changes).
-------------- next part --------------
=== modified file 'loggerhead/history.py'
--- a/loggerhead/history.py	2010-04-14 17:54:32 +0000
+++ b/loggerhead/history.py	2010-04-26 21:23:04 +0000
@@ -315,7 +315,16 @@
         revid in revid_list.
         """
         if revid_list is None:
-            revid_list = [r[0][1] for r in self._rev_info]
+            # Just yield the mainline, starting at start_revid
+            revid = start_revid
+            is_null = bzrlib.revision.is_null
+            while not is_null(revid):
+                yield revid
+                parents = self._rev_info[self._rev_indices[revid]][2]
+                if not parents:
+                    return
+                revid = parents[0]
+            return
         revid_set = set(revid_list)
         revid = start_revid
 



More information about the bazaar-commits mailing list