Rev 3463: Fix bug #235407, when the same revision is merged twice in http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/status_double_pending_235407

John Arbash Meinel john at arbash-meinel.com
Fri May 30 23:29:24 BST 2008


At http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/status_double_pending_235407

------------------------------------------------------------
revno: 3463
revision-id: john at arbash-meinel.com-20080530222904-sn1c8r4ge8olh4r5
parent: pqm at pqm.ubuntu.com-20080530080302-j1jh2bwxmpd0jn2q
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: status_double_pending_235407
timestamp: Fri 2008-05-30 17:29:04 -0500
message:
  Fix bug #235407, when the same revision is merged twice
  bzr status should at least show the top-level revision again,
  even though that merge introduced no new revisions.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/status.py               status.py-20050505062338-431bfa63ec9b19e6
  bzrlib/tests/test_status.py    test_status.py-20060516190614-fbf6432e4a6e8aa5
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2008-05-30 00:35:19 +0000
+++ b/NEWS	2008-05-30 22:29:04 +0000
@@ -58,6 +58,9 @@
     * ``bzr merge --lca`` should handle when two revisions have no common
       ancestor other than NULL_REVISION. (John Arbash Meinel, #235715)
 
+    * ``bzr status`` was breaking if you merged the same revision 2x.
+      (John Arbash Meinel, #235407)
+
     * ``bzr push`` with both ``--overwrite`` and ``-r NNN`` options no longer
       fails.  (Andrew Bennetts, #234229)
       

=== modified file 'bzrlib/status.py'
--- a/bzrlib/status.py	2008-05-08 04:33:38 +0000
+++ b/bzrlib/status.py	2008-05-30 22:29:04 +0000
@@ -159,6 +159,11 @@
         are considered ghosts should not be present in the map.
     :return: iterator from MergeSorter.iter_topo_order()
     """
+    if not revision_ids:
+        # For whatever reason, there are no unique revisions for this node.
+        # This could happen if you merge an ancestor of an already merged
+        # revision (or merge the revision itself 2x).
+        return iter([(1, tip_revision, 0, 0)])
     # MergeSorter requires that all nodes be present in the graph, so get rid
     # of any references pointing outside of this graph.
     parent_graph = {}

=== modified file 'bzrlib/tests/test_status.py'
--- a/bzrlib/tests/test_status.py	2008-05-01 20:41:00 +0000
+++ b/bzrlib/tests/test_status.py	2008-05-30 22:29:04 +0000
@@ -66,6 +66,31 @@
                              '  Joe Foo 2007-12-04 commit 3c\n',
                              output.getvalue())
 
+    def test_repeated_pending_merge(self):
+        # It is currently possible to merge the same thing 2x with 'merge
+        # --force', so test that status still works in that case.
+        config.GlobalConfig().set_user_option('email', 'Joe Foo <joe at foo.com>')
+        tree = self.make_branch_and_tree('a')
+        tree.commit('commit 1', timestamp=1196796819, timezone=0)
+        tree2 = tree.bzrdir.sprout('b').open_workingtree()
+        tree2.commit('commit 2b', timestamp=1196796819, timezone=0)
+        rev3 = tree2.commit('commit 3b', timestamp=1196796819, timezone=0)
+        tree2.commit('commit 4b', timestamp=1196796819, timezone=0)
+        tree.merge_from_branch(tree2.branch)
+        tree.merge_from_branch(tree2.branch)
+        tree.merge_from_branch(tree2.branch, to_revision=rev3)
+        tree.lock_read()
+        self.addCleanup(tree.unlock)
+        output = StringIO()
+        show_pending_merges(tree, output)
+        self.assertEqualDiff('pending merges:\n'
+                             '  Joe Foo 2007-12-04 commit 4b\n'
+                             '    Joe Foo 2007-12-04 commit 3b\n'
+                             '    Joe Foo 2007-12-04 commit 2b\n'
+                             '  Joe Foo 2007-12-04 commit 4b\n'
+                             '  Joe Foo 2007-12-04 commit 3b\n',
+                             output.getvalue())
+
     def test_with_pending_ghost(self):
         """Test when a pending merge is itself a ghost"""
         tree = self.make_branch_and_tree('a')



More information about the bazaar-commits mailing list