Rev 3291: Fix bug #235715 by using the empty list as the text for a base of NULL_REVISION. in http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/lca_with_null_235715

John Arbash Meinel john at arbash-meinel.com
Thu May 29 19:57:46 BST 2008


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

------------------------------------------------------------
revno: 3291
revision-id: john at arbash-meinel.com-20080529185731-7ibxuku11bwkrb30
parent: pqm at pqm.ubuntu.com-20080320092314-y4i0bpy37v8i1mc5
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: lca_with_null_235715
timestamp: Thu 2008-05-29 13:57:31 -0500
message:
  Fix bug #235715 by using the empty list as the text for a base of NULL_REVISION.
  
  Add a test for this case as well.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/merge.py                merge.py-20050513021216-953b65a438527106
  bzrlib/tests/test_merge.py     testmerge.py-20050905070950-c1b5aa49ff911024
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2008-03-20 06:17:15 +0000
+++ b/NEWS	2008-05-29 18:57:31 +0000
@@ -5,6 +5,12 @@
 .. contents::
 
 
+  BUGFIXES
+
+    * ``bzr merge --lca`` should handle when two revisions have no common
+      ancestor other than NULL_REVISION. (John Arbash Meinel, #235715)
+
+
 bzr 1.3 2008-03-20
 ------------------
 

=== modified file 'bzrlib/merge.py'
--- a/bzrlib/merge.py	2008-03-14 16:23:28 +0000
+++ b/bzrlib/merge.py	2008-05-29 18:57:31 +0000
@@ -1437,7 +1437,10 @@
         _PlanMergeBase.__init__(self, a_rev, b_rev, vf)
         self.lcas = graph.find_lca(a_rev, b_rev)
         for lca in self.lcas:
-            lca_lines = self.vf.get_lines(lca)
+            if _mod_revision.is_null(lca):
+                lca_lines = []
+            else:
+                lca_lines = self.vf.get_lines(lca)
             matcher = patiencediff.PatienceSequenceMatcher(None, self.lines_a,
                                                            lca_lines)
             blocks = list(matcher.get_matching_blocks())

=== modified file 'bzrlib/tests/test_merge.py'
--- a/bzrlib/tests/test_merge.py	2008-03-15 14:22:50 +0000
+++ b/bzrlib/tests/test_merge.py	2008-05-29 18:57:31 +0000
@@ -630,6 +630,15 @@
                           ('conflicted-b', 'e\n'),
                          ], list(plan))
 
+    def test_plan_lca_merge_with_null(self):
+        self.add_version('A', [], 'ab')
+        self.add_version('B', [], 'bc')
+        plan = self.plan_merge_vf.plan_lca_merge('A', 'B')
+        self.assertEqual([('new-a', 'a\n'),
+                          ('unchanged', 'b\n'),
+                          ('new-b', 'c\n'),
+                         ], list(plan))
+
 
 class TestMergeImplementation(object):
 



More information about the bazaar-commits mailing list