Rev 2403: Ancestry checks can be done using the dictionaries in http://bzr.arbash-meinel.com/branches/bzr/0.16-dev/shortcut-common-ancestor

John Arbash Meinel john at arbash-meinel.com
Tue Apr 10 19:13:22 BST 2007


At http://bzr.arbash-meinel.com/branches/bzr/0.16-dev/shortcut-common-ancestor

------------------------------------------------------------
revno: 2403
revision-id: john at arbash-meinel.com-20070410181305-9y6qbm51we9k37kz
parent: john at arbash-meinel.com-20070410175723-9a3rljph39ot4e35
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: shortcut-common-ancestor
timestamp: Tue 2007-04-10 13:13:05 -0500
message:
  Ancestry checks can be done using the dictionaries
  And we don't need to create 2 sets, one will do just fine.
modified:
  bzrlib/revision.py             revision.py-20050309040759-e77802c08f3999d5
-------------- next part --------------
=== modified file 'bzrlib/revision.py'
--- a/bzrlib/revision.py	2007-04-10 17:57:23 +0000
+++ b/bzrlib/revision.py	2007-04-10 18:13:05 +0000
@@ -253,8 +253,8 @@
                 [revision_a, revision_b])
             # Shortcut the case where one of the tips is already included in
             # the other graphs ancestry.
-            ancestry_a = set(graph.get_ancestry(revision_a))
-            ancestry_b = set(graph.get_ancestry(revision_b))
+            ancestry_a = graph.get_ancestry(revision_a)
+            ancestry_b = graph.get_ancestry(revision_b)
             if revision_b in ancestry_a:
                 return revision_b
             if revision_a in ancestry_b:
@@ -262,7 +262,8 @@
             # convert to a NULL_REVISION based graph.
             ancestors = graph.get_ancestors()
             descendants = graph.get_descendants()
-            common = ancestry_a.intersection(ancestry_b)
+            common = set(ancestry_a)
+            common.intersection_update(ancestry_b)
             descendants[NULL_REVISION] = {}
             ancestors[NULL_REVISION] = []
             for root in graph.roots:



More information about the bazaar-commits mailing list