Rev 4549: (abentley) Merge handles revisions empty righthand revision specs in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon Jul 20 04:32:25 BST 2009


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

------------------------------------------------------------
revno: 4549 [merge]
revision-id: pqm at pqm.ubuntu.com-20090720033224-n4zz83x1s2fuyyb5
parent: pqm at pqm.ubuntu.com-20090720023425-zzh5luttxgy0c5dj
parent: aaron at aaronbentley.com-20090719064605-hm79uszln36shu3y
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2009-07-20 04:32:24 +0100
message:
  (abentley) Merge handles revisions empty righthand revision specs
  	correctly.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/tests/blackbox/test_merge.py test_merge.py-20060323225809-9bc0459c19917f41
=== modified file 'NEWS'
--- a/NEWS	2009-07-17 05:32:50 +0000
+++ b/NEWS	2009-07-19 06:46:05 +0000
@@ -35,7 +35,10 @@
 
 * Fixed spurious "Source branch does not support stacking" warning when
   pushing. (Andrew Bennetts, #388908)
-  
+
+* Merge now correctly handles empty right-hand revision specs.
+  (Aaron Bentley, #333961)
+
 * Renames to lexographically lower basenames in trees that have never been
   committed to will no longer corrupt the dirstate. This was caused by an
   bug in the dirstate update_minimal method. (Robert Collins, #395556)

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2009-07-16 01:36:57 +0000
+++ b/bzrlib/builtins.py	2009-07-19 04:47:49 +0000
@@ -3788,16 +3788,16 @@
             base_branch, base_path = Branch.open_containing(base_loc,
                 possible_transports)
         # Find the revision ids
-        if revision is None or len(revision) < 1 or revision[-1] is None:
+        other_revision_id = None
+        base_revision_id = None
+        if revision is not None:
+            if len(revision) >= 1:
+                other_revision_id = revision[-1].as_revision_id(other_branch)
+            if len(revision) == 2:
+                base_revision_id = revision[0].as_revision_id(base_branch)
+        if other_revision_id is None:
             other_revision_id = _mod_revision.ensure_null(
                 other_branch.last_revision())
-        else:
-            other_revision_id = revision[-1].as_revision_id(other_branch)
-        if (revision is not None and len(revision) == 2
-            and revision[0] is not None):
-            base_revision_id = revision[0].as_revision_id(base_branch)
-        else:
-            base_revision_id = None
         # Remember where we merge from
         if ((remember or tree.branch.get_submit_branch() is None) and
              user_location is not None):

=== modified file 'bzrlib/tests/blackbox/test_merge.py'
--- a/bzrlib/tests/blackbox/test_merge.py	2009-03-24 05:12:24 +0000
+++ b/bzrlib/tests/blackbox/test_merge.py	2009-07-19 04:47:49 +0000
@@ -582,3 +582,14 @@
         self.addCleanup(this_tree.unlock)
         self.assertEqual([],
                          list(this_tree.iter_changes(this_tree.basis_tree())))
+
+    def test_merge_missing_second_revision_spec(self):
+        """Merge uses branch basis when the second revision is unspecified."""
+        this = self.make_branch_and_tree('this')
+        this.commit('rev1')
+        other = self.make_branch_and_tree('other')
+        self.build_tree(['other/other_file'])
+        other.add('other_file')
+        other.commit('rev1b')
+        self.run_bzr('merge -d this other -r0..')
+        self.failUnlessExists('this/other_file')




More information about the bazaar-commits mailing list