Rev 4640: With the new api, we don't return 'sequence_number' anymore. in http://bazaar.launchpad.net/~jameinel/bzr/1.19-known-graph-sorted

John Arbash Meinel john at arbash-meinel.com
Mon Aug 17 19:56:52 BST 2009


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

------------------------------------------------------------
revno: 4640
revision-id: john at arbash-meinel.com-20090817185638-88dp2b45wsy2uxjb
parent: john at arbash-meinel.com-20090817185201-5xmgwhtn9nv2p4h8
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 1.19-known-graph-sorted
timestamp: Mon 2009-08-17 13:56:38 -0500
message:
  With the new api, we don't return 'sequence_number' anymore.
  
  Nothing ever used it anyway, and branch.iter_merge_sorted... was stripping it
  out. No need to do the extra busy work.
-------------- next part --------------
=== modified file 'bzrlib/_known_graph_py.py'
--- a/bzrlib/_known_graph_py.py	2009-08-17 18:36:14 +0000
+++ b/bzrlib/_known_graph_py.py	2009-08-17 18:56:38 +0000
@@ -214,6 +214,7 @@
                               if node.parent_keys is not None)
         # We intentionally always generate revnos and never force the
         # mainline_revisions
-        return tsort.merge_sort(as_parent_map, tip_key,
+        # Strip the sequence_number that merge_sort generates
+        return [info[1:] for info in tsort.merge_sort(as_parent_map, tip_key,
                                 mainline_revisions=None,
-                                generate_revno=True)
+                                generate_revno=True)]

=== modified file 'bzrlib/_known_graph_pyx.pyx'
--- a/bzrlib/_known_graph_pyx.pyx	2009-08-17 18:17:06 +0000
+++ b/bzrlib/_known_graph_pyx.pyx	2009-08-17 18:56:38 +0000
@@ -664,7 +664,6 @@
         #       2ms is walking the data and computing revno tuples
         #       7ms is computing the return tuple
         #       4ms is PyList_Append()
-        sequence_number = 0
         ordered = []
         # output the result in reverse order, and convert from objects into
         # tuples...
@@ -678,12 +677,11 @@
             else:
                 revno = (ms_node.revno_first, ms_node.revno_second,
                          ms_node.revno_last)
-            PyList_Append(ordered, (sequence_number, node.key,
+            PyList_Append(ordered, (node.key,
                                     ms_node.merge_depth, revno,
                                     ms_node.end_of_merge))
             # Get rid of the extra stored info
             node.extra = None
-            sequence_number = sequence_number + 1
         # Clear out the scheduled nodes
         self._scheduled_nodes = []
         return ordered

=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2009-08-16 17:22:08 +0000
+++ b/bzrlib/branch.py	2009-08-17 18:56:38 +0000
@@ -451,7 +451,7 @@
                 [last_key])
             revs = known_graph.merge_sort(last_key)
             self._merge_sorted_revisions_cache = [(key[-1], d, rn, eom)
-                for sn, key, d, rn, eom in revs]
+                for key, d, rn, eom in revs]
 
         filtered = self._filter_merge_sorted_revisions(
             self._merge_sorted_revisions_cache, start_revision_id,

=== modified file 'bzrlib/tests/test__known_graph.py'
--- a/bzrlib/tests/test__known_graph.py	2009-08-17 16:35:07 +0000
+++ b/bzrlib/tests/test__known_graph.py	2009-08-17 18:56:38 +0000
@@ -356,7 +356,7 @@
         # sequence - 0, revision id, merge depth - 0, end_of_merge
         self.assertSortAndIterate({'id': []},
                                   'id',
-                                  [(0, 'id', 0, (1,), True)])
+                                  [('id', 0, (1,), True)])
 
     def test_sequence_numbers_increase_no_merges(self):
         # emit a few revisions with no merges to check the sequence
@@ -366,9 +366,9 @@
              'B': ['A'],
              'C': ['B']},
             'C',
-            [(0, 'C', 0, (3,), False),
-             (1, 'B', 0, (2,), False),
-             (2, 'A', 0, (1,), True),
+            [('C', 0, (3,), False),
+             ('B', 0, (2,), False),
+             ('A', 0, (1,), True),
              ],
             )
 
@@ -379,9 +379,9 @@
              'B': ['A'],
              'C': ['A', 'B']},
             'C',
-            [(0, 'C', 0, (2,), False),
-             (1, 'B', 1, (1,1,1), True),
-             (2, 'A', 0, (1,), True),
+            [('C', 0, (2,), False),
+             ('B', 1, (1,1,1), True),
+             ('A', 0, (1,), True),
              ],
             )
 
@@ -402,11 +402,11 @@
                  'F': ['B', 'D'],
                  }
         self.assertSortAndIterate(graph, 'F',
-            [(0, 'F', 0, (3,), False),
-             (1, 'D', 1, (2,2,1), False),
-             (2, 'C', 2, (2,1,1), True),
-             (3, 'B', 0, (2,), False),
-             (4, 'A', 0, (1,), True),
+            [('F', 0, (3,), False),
+             ('D', 1, (2,2,1), False),
+             ('C', 2, (2,1,1), True),
+             ('B', 0, (2,), False),
+             ('A', 0, (1,), True),
              ])
         # A
         # |
@@ -425,12 +425,12 @@
                  'F': ['B', 'D'],
                  }
         self.assertSortAndIterate(graph, 'F',
-            [(0, 'F', 0, (3,), False),
-             (1, 'D', 1, (2,1,2), False),
-             (2, 'C', 2, (2,2,1), True),
-             (3, 'X', 1, (2,1,1), True),
-             (4, 'B', 0, (2,), False),
-             (5, 'A', 0, (1,), True),
+            [('F', 0, (3,), False),
+             ('D', 1, (2,1,2), False),
+             ('C', 2, (2,2,1), True),
+             ('X', 1, (2,1,1), True),
+             ('B', 0, (2,), False),
+             ('A', 0, (1,), True),
              ])
 
     def test_merge_depth_with_nested_merges(self):
@@ -456,14 +456,14 @@
              'H': []
              },
             'A',
-            [(0, 'A', 0, (3,),  False),
-             (1, 'B', 1, (1,3,2), False),
-             (2, 'C', 1, (1,3,1), True),
-             (3, 'D', 0, (2,), False),
-             (4, 'E', 1, (1,1,2), False),
-             (5, 'F', 2, (1,2,1), True),
-             (6, 'G', 1, (1,1,1), True),
-             (7, 'H', 0, (1,), True),
+            [('A', 0, (3,),  False),
+             ('B', 1, (1,3,2), False),
+             ('C', 1, (1,3,1), True),
+             ('D', 0, (2,), False),
+             ('E', 1, (1,1,2), False),
+             ('F', 2, (1,2,1), True),
+             ('G', 1, (1,1,1), True),
+             ('H', 0, (1,), True),
              ],
             )
 
@@ -494,18 +494,18 @@
              'L': ['J', 'K'],
             },
             'L',
-            [(0, 'L', 0, (6,), False),
-             (1, 'K', 1, (1,3,2), False),
-             (2, 'I', 1, (1,3,1), True),
-             (3, 'J', 0, (5,), False),
-             (4, 'H', 1, (1,2,2), False),
-             (5, 'F', 1, (1,2,1), True),
-             (6, 'G', 0, (4,), False),
-             (7, 'E', 1, (1,1,2), False),
-             (8, 'C', 1, (1,1,1), True),
-             (9, 'D', 0, (3,), False),
-             (10, 'B', 0, (2,), False),
-             (11, 'A', 0, (1,),  True),
+            [('L', 0, (6,), False),
+             ('K', 1, (1,3,2), False),
+             ('I', 1, (1,3,1), True),
+             ('J', 0, (5,), False),
+             ('H', 1, (1,2,2), False),
+             ('F', 1, (1,2,1), True),
+             ('G', 0, (4,), False),
+             ('E', 1, (1,1,2), False),
+             ('C', 1, (1,1,1), True),
+             ('D', 0, (3,), False),
+             ('B', 0, (2,), False),
+             ('A', 0, (1,),  True),
              ],
             )
         # Adding a shortcut from the first revision should not change any of
@@ -527,20 +527,20 @@
              'N': ['L', 'M'],
             },
             'N',
-            [(0, 'N', 0, (7,), False),
-             (1, 'M', 1, (1,4,1), True),
-             (2, 'L', 0, (6,), False),
-             (3, 'K', 1, (1,3,2), False),
-             (4, 'I', 1, (1,3,1), True),
-             (5, 'J', 0, (5,), False),
-             (6, 'H', 1, (1,2,2), False),
-             (7, 'F', 1, (1,2,1), True),
-             (8, 'G', 0, (4,), False),
-             (9, 'E', 1, (1,1,2), False),
-             (10, 'C', 1, (1,1,1), True),
-             (11, 'D', 0, (3,), False),
-             (12, 'B', 0, (2,), False),
-             (13, 'A', 0, (1,),  True),
+            [('N', 0, (7,), False),
+             ('M', 1, (1,4,1), True),
+             ('L', 0, (6,), False),
+             ('K', 1, (1,3,2), False),
+             ('I', 1, (1,3,1), True),
+             ('J', 0, (5,), False),
+             ('H', 1, (1,2,2), False),
+             ('F', 1, (1,2,1), True),
+             ('G', 0, (4,), False),
+             ('E', 1, (1,1,2), False),
+             ('C', 1, (1,1,1), True),
+             ('D', 0, (3,), False),
+             ('B', 0, (2,), False),
+             ('A', 0, (1,),  True),
              ],
             )
 
@@ -552,8 +552,8 @@
              'B': [],
              },
             'A',
-            [(0, 'A', 0, (2,), False),
-             (1, 'B', 0, (1,), True)
+            [('A', 0, (2,), False),
+             ('B', 0, (1,), True)
              ],
             )
 
@@ -582,14 +582,14 @@
              'H': [],
              },
             'A',
-            [(0, 'A', 0, (2,), False),
-             (1, 'B', 1, (1,3,2), False),
-             (2, 'C', 2, (1,4,1), True),
-             (3, 'D', 1, (1,3,1), True),
-             (4, 'E', 1, (1,1,2), False),
-             (5, 'F', 2, (1,2,1), True),
-             (6, 'G', 1, (1,1,1), True),
-             (7, 'H', 0, (1,), True),
+            [('A', 0, (2,), False),
+             ('B', 1, (1,3,2), False),
+             ('C', 2, (1,4,1), True),
+             ('D', 1, (1,3,1), True),
+             ('E', 1, (1,1,2), False),
+             ('F', 2, (1,2,1), True),
+             ('G', 1, (1,1,1), True),
+             ('H', 0, (1,), True),
              ],
             )
 
@@ -600,9 +600,9 @@
              'B': [],
              'C': ['A', 'B']},
             'C',
-            [(0, 'C', 0, (2,), False),
-             (1, 'B', 1, (0,1,1), True),
-             (2, 'A', 0, (1,), True),
+            [('C', 0, (2,), False),
+             ('B', 1, (0,1,1), True),
+             ('A', 0, (1,), True),
              ],
             )
 
@@ -638,16 +638,16 @@
              'A': [],
              },
             'J',
-            [(0, 'J', 0, (4,), False),
-             (1, 'I', 1, (1,3,2), False),
-             (2, 'H', 1, (1,3,1), True),
-             (3, 'G', 0, (3,), False),
-             (4, 'F', 1, (1,2,2), False),
-             (5, 'E', 1, (1,2,1), True),
-             (6, 'D', 0, (2,), False),
-             (7, 'C', 1, (1,1,2), False),
-             (8, 'B', 1, (1,1,1), True),
-             (9, 'A', 0, (1,), True),
+            [('J', 0, (4,), False),
+             ('I', 1, (1,3,2), False),
+             ('H', 1, (1,3,1), True),
+             ('G', 0, (3,), False),
+             ('F', 1, (1,2,2), False),
+             ('E', 1, (1,2,1), True),
+             ('D', 0, (2,), False),
+             ('C', 1, (1,1,2), False),
+             ('B', 1, (1,1,1), True),
+             ('A', 0, (1,), True),
              ],
             )
 
@@ -688,24 +688,24 @@
              'R': ['J', 'Q'],
             },
             'R',
-            [( 0, 'R', 0, (6,), False),
-             ( 1, 'Q', 1, (0,4,5), False),
-             ( 2, 'P', 2, (0,6,1), True),
-             ( 3, 'O', 1, (0,4,4), False),
-             ( 4, 'N', 1, (0,4,3), False),
-             ( 5, 'M', 2, (0,5,1), True),
-             ( 6, 'L', 1, (0,4,2), False),
-             ( 7, 'K', 1, (0,4,1), True),
-             ( 8, 'J', 0, (5,), False),
-             ( 9, 'I', 1, (0,3,1), True),
-             (10, 'H', 0, (4,), False),
-             (11, 'G', 1, (0,1,3), False),
-             (12, 'F', 2, (0,2,1), True),
-             (13, 'E', 1, (0,1,2), False),
-             (14, 'D', 1, (0,1,1), True),
-             (15, 'C', 0, (3,), False),
-             (16, 'B', 0, (2,), False),
-             (17, 'A', 0, (1,), True),
+            [('R', 0, (6,), False),
+             ('Q', 1, (0,4,5), False),
+             ('P', 2, (0,6,1), True),
+             ('O', 1, (0,4,4), False),
+             ('N', 1, (0,4,3), False),
+             ('M', 2, (0,5,1), True),
+             ('L', 1, (0,4,2), False),
+             ('K', 1, (0,4,1), True),
+             ('J', 0, (5,), False),
+             ('I', 1, (0,3,1), True),
+             ('H', 0, (4,), False),
+             ('G', 1, (0,1,3), False),
+             ('F', 2, (0,2,1), True),
+             ('E', 1, (0,1,2), False),
+             ('D', 1, (0,1,1), True),
+             ('C', 0, (3,), False),
+             ('B', 0, (2,), False),
+             ('A', 0, (1,), True),
              ],
             )
 
@@ -722,9 +722,9 @@
              'C': ['B', 'ghost'],
             },
             'C',
-            [(0, 'C', 0, (3,), False),
-             (1, 'B', 0, (2,), False),
-             (2, 'A', 0, (1,), True),
+            [('C', 0, (3,), False),
+             ('B', 0, (2,), False),
+             ('A', 0, (1,), True),
             ])
 
     def test_graph_cycle(self):



More information about the bazaar-commits mailing list