Rev 3107: Shortcut when there is only 1 candidate left in http://bzr.arbash-meinel.com/branches/bzr/0.93-dev/graph_update

John Arbash Meinel john at arbash-meinel.com
Thu Dec 20 15:58:14 GMT 2007


At http://bzr.arbash-meinel.com/branches/bzr/0.93-dev/graph_update

------------------------------------------------------------
revno: 3107
revision-id:john at arbash-meinel.com-20071220155436-uyp6ffwyztyphzwv
parent: john at arbash-meinel.com-20071214214449-gv8fpndus076sbjy
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: graph_update
timestamp: Thu 2007-12-20 09:54:36 -0600
message:
  Shortcut when there is only 1 candidate left
modified:
  bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
-------------- next part --------------
=== modified file 'bzrlib/graph.py'
--- a/bzrlib/graph.py	2007-12-14 21:44:49 +0000
+++ b/bzrlib/graph.py	2007-12-20 15:54:36 +0000
@@ -394,6 +394,10 @@
             for ancestor in ancestors:
                 if ancestor in candidate_heads:
                     candidate_heads.remove(ancestor)
+                    if len(candidate_heads) <= 1:
+                        # Shortcut, there must be a head, if there is only one
+                        # left, then this must be it
+                        return candidate_heads
                     del searchers[ancestor]
                     if ancestor in active_searchers:
                         del active_searchers[ancestor]



More information about the bazaar-commits mailing list