Rev 4650: Turns out that some code assumed passing NULL_REVISION to merge_sort in http://bazaar.launchpad.net/~jameinel/bzr/1.19-known-graph-sorted

John Arbash Meinel john at arbash-meinel.com
Tue Aug 18 22:41:13 BST 2009


At http://bazaar.launchpad.net/~jameinel/bzr/1.19-known-graph-sorted

------------------------------------------------------------
revno: 4650
revision-id: john at arbash-meinel.com-20090818214108-03e6hkoj7v4va7x8
parent: john at arbash-meinel.com-20090818165350-2k81ogmwr01jsnfm
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 1.19-known-graph-sorted
timestamp: Tue 2009-08-18 16:41:08 -0500
message:
  Turns out that some code assumed passing NULL_REVISION to merge_sort
  always was fine, and now that we are using 'keys' it was passing (NULL_REVISION,)
  for now, that should be ok.
-------------- next part --------------
=== modified file 'bzrlib/_known_graph_pyx.pyx'
--- a/bzrlib/_known_graph_pyx.pyx	2009-08-17 20:41:26 +0000
+++ b/bzrlib/_known_graph_pyx.pyx	2009-08-18 21:41:08 +0000
@@ -494,7 +494,8 @@
         self._depth_first_stack = []
         self._last_stack_item = -1
         self._scheduled_nodes = []
-        if tip_key is not None and tip_key != NULL_REVISION:
+        if (tip_key is not None and tip_key != NULL_REVISION
+            and tip_key != (NULL_REVISION,)):
             node = self.graph._nodes[tip_key]
             self._get_ms_node(node)
             self._push_node(node, 0)

=== modified file 'bzrlib/tests/test__known_graph.py'
--- a/bzrlib/tests/test__known_graph.py	2009-08-17 20:41:26 +0000
+++ b/bzrlib/tests/test__known_graph.py	2009-08-18 21:41:08 +0000
@@ -346,12 +346,14 @@
         # sorting of an emptygraph does not error
         self.assertSortAndIterate({}, None, [])
         self.assertSortAndIterate({}, NULL_REVISION, [])
+        self.assertSortAndIterate({}, (NULL_REVISION,), [])
 
     def test_merge_sort_not_empty_no_tip(self):
         # merge sorting of a branch starting with None should result
         # in an empty list: no revisions are dragged in.
         self.assertSortAndIterate({0: []}, None, [])
-        self.assertSortAndIterate({0: []}, None, [])
+        self.assertSortAndIterate({0: []}, NULL_REVISION, [])
+        self.assertSortAndIterate({0: []}, (NULL_REVISION,), [])
 
     def test_merge_sort_one_revision(self):
         # sorting with one revision as the tip returns the correct fields:

=== modified file 'bzrlib/tsort.py'
--- a/bzrlib/tsort.py	2009-08-18 14:49:17 +0000
+++ b/bzrlib/tsort.py	2009-08-18 21:41:08 +0000
@@ -409,7 +409,8 @@
 
         # seed the search with the tip of the branch
         if (branch_tip is not None and
-            branch_tip != _mod_revision.NULL_REVISION):
+            branch_tip != _mod_revision.NULL_REVISION and
+            branch_tip != (_mod_revision.NULL_REVISION,)):
             parents = self._graph.pop(branch_tip)
             self._push_node(branch_tip, 0, parents)
 



More information about the bazaar-commits mailing list