Rev 3535: (jam) (bug #243536) tsort.merge_sorted() can ignore ghosts in the in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Jul 9 14:59:11 BST 2008


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3535
revision-id:pqm at pqm.ubuntu.com-20080709135859-wq3r1d1fjcafelgw
parent: pqm at pqm.ubuntu.com-20080709054822-jrzq8pdw4w7ob493
parent: john at arbash-meinel.com-20080709133648-3b03z59rcalc4rjx
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2008-07-09 14:58:59 +0100
message:
  (jam) (bug #243536) tsort.merge_sorted() can ignore ghosts in the
  	mainline history passed in.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/tests/test_tsort.py     testtsort.py-20051025073946-27da871c394d5be4
  bzrlib/tsort.py                tsort.py-20051025073946-7808f6aaf7d07208
    ------------------------------------------------------------
    revno: 3533.2.1
    revision-id:john at arbash-meinel.com-20080709133648-3b03z59rcalc4rjx
    parent: pqm at pqm.ubuntu.com-20080708172503-gl2dtaz3v7fyc2sl
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: jam-integration
    timestamp: Wed 2008-07-09 08:36:48 -0500
    message:
      (bug #243536) tsort.merge_sorted() should work even with a ghost in mainline.
      
      There is a bit of a discrepency when it comes to ghosts.
      The revision_graph passed to merge_sorted has had ghosts stripped,
      because it cannot handle pointing to nodes that aren't present.
      (Thinks there is a graph cycle.)
      However, the mainline_history includes the ghost.
      For now, work around this by ignoring the ghost in the mainline
      history.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/tests/test_tsort.py     testtsort.py-20051025073946-27da871c394d5be4
      bzrlib/tsort.py                tsort.py-20051025073946-7808f6aaf7d07208
=== modified file 'NEWS'
--- a/NEWS	2008-07-09 05:31:15 +0000
+++ b/NEWS	2008-07-09 13:58:59 +0000
@@ -41,6 +41,9 @@
 
   BUGFIXES:
 
+    * ``bzr log --long`` with a ghost in your mainline now handles that
+      ghost properly. (John Arbash Meinel, #243536)
+
     * ``check`` handles the split-up .bzr layout correctly, so no longer
       requires a branch to be present.
       (Daniel Watkins, #64783)

=== modified file 'bzrlib/tests/test_tsort.py'
--- a/bzrlib/tests/test_tsort.py	2008-02-26 23:04:15 +0000
+++ b/bzrlib/tests/test_tsort.py	2008-07-09 13:36:48 +0000
@@ -533,6 +533,19 @@
             mainline_revisions=[None, 'A']
             )
 
+    def test_mainline_revs_with_ghost(self):
+        # We have a mainline, but the end of it is actually a ghost
+        # The graph that is passed to tsort has had ghosts filtered out, but
+        # the mainline history has not.
+        self.assertSortAndIterate(
+            {'B':[],
+             'C':['B']}.items(),
+            'C',
+            [(0, 'C', 0, (2,), False),
+             (1, 'B', 0, (1,), True),
+             ],
+             True, mainline_revisions=['A', 'B', 'C'])
+
     def test_parallel_root_sequence_numbers_increase_with_merges(self):
         """When there are parallel roots, check their revnos."""
         self.assertSortAndIterate(

=== modified file 'bzrlib/tsort.py'
--- a/bzrlib/tsort.py	2008-03-01 09:11:39 +0000
+++ b/bzrlib/tsort.py	2008-07-09 13:36:48 +0000
@@ -351,7 +351,13 @@
             if parent is None:
                 # end of mainline_revisions history
                 continue
-            if self._graph[revision][0] == parent:
+            graph_parent_ids = self._graph[revision]
+            if not graph_parent_ids:
+                # We ran into a ghost, skip over it, this is a workaround for
+                # bug #243536, the _graph has had ghosts stripped, but the
+                # mainline_revisions have not
+                continue
+            if graph_parent_ids[0] == parent:
                 continue
             # remove it from its prior spot
             self._graph[revision].remove(parent)




More information about the bazaar-commits mailing list