Rev 5897: (jr) Add an error message when merging into empty branch (Jonathan Riddell) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu May 19 11:44:17 UTC 2011


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

------------------------------------------------------------
revno: 5897 [merge]
revision-id: pqm at pqm.ubuntu.com-20110519114413-q8x604ghdurhsjj2
parent: pqm at pqm.ubuntu.com-20110519105137-amzagrral2ldm1lq
parent: jriddell at canonical.com-20110519083255-3een679ockai9cdg
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2011-05-19 11:44:13 +0000
message:
  (jr) Add an error message when merging into empty branch (Jonathan Riddell)
modified:
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/tests/blackbox/test_merge.py test_merge.py-20060323225809-9bc0459c19917f41
  doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2011-05-18 01:55:17 +0000
+++ b/bzrlib/builtins.py	2011-05-18 12:18:39 +0000
@@ -3948,7 +3948,11 @@
         merger = None
         allow_pending = True
         verified = 'inapplicable'
+
         tree = WorkingTree.open_containing(directory)[0]
+        if tree.branch.revno() == 0:
+            raise errors.BzrCommandError('Merging into empty branches not currently supported, '
+                                         'https://bugs.launchpad.net/bzr/+bug/308562')
 
         try:
             basis_tree = tree.revision_tree(tree.last_revision())

=== modified file 'bzrlib/tests/blackbox/test_merge.py'
--- a/bzrlib/tests/blackbox/test_merge.py	2011-05-14 14:09:09 +0000
+++ b/bzrlib/tests/blackbox/test_merge.py	2011-05-19 08:32:55 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2006-2010 Canonical Ltd
+# Copyright (C) 2006-2011 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -34,6 +34,7 @@
     urlutils,
     workingtree,
     )
+from bzrlib.tests import script
 
 
 class TestMerge(tests.TestCaseWithTransport):
@@ -533,6 +534,7 @@
 
     def test_merge_from_submit(self):
         tree_a = self.make_branch_and_tree('a')
+        tree_a.commit('test')
         tree_b = tree_a.bzrdir.sprout('b').open_workingtree()
         tree_c = tree_a.bzrdir.sprout('c').open_workingtree()
         out, err = self.run_bzr(['merge', '-d', 'c'])
@@ -543,6 +545,7 @@
 
     def test_remember_sets_submit(self):
         tree_a = self.make_branch_and_tree('a')
+        tree_a.commit('rev1')
         tree_b = tree_a.bzrdir.sprout('b').open_workingtree()
         self.assertIs(tree_b.branch.get_submit_branch(), None)
 
@@ -557,6 +560,9 @@
 
     def test_no_remember_dont_set_submit(self):
         tree_a = self.make_branch_and_tree('a')
+        self.build_tree_contents([('a/file', "a\n")])
+        tree_a.add('file')
+        tree_a.commit('rev1')
         tree_b = tree_a.bzrdir.sprout('b').open_workingtree()
         self.assertIs(tree_b.branch.get_submit_branch(), None)
 
@@ -638,8 +644,9 @@
 
     def test_merge_interactive_unlocks_branch(self):
         this = self.make_branch_and_tree('this')
-        other = self.make_branch_and_tree('other')
-        other.commit('empty commit')
+        this.commit('empty commit')
+        other = this.bzrdir.sprout('other').open_workingtree()
+        other.commit('empty commit 2')
         self.run_bzr('merge -i -d this other')
         this.lock_write()
         this.unlock()
@@ -677,6 +684,17 @@
         self.assertEqual('rev-2a', target.tags.lookup_tag('tag-a'))
         target.repository.get_revision('rev-2a')
 
+class TestMergeScript(script.TestCaseWithTransportAndScript):
+    def test_merge_empty_branch(self):
+        source = self.make_branch_and_tree('source')
+        self.build_tree(['source/a'])
+        source.add('a')
+        source.commit('Added a', rev_id='rev1')
+        target = self.make_branch_and_tree('target')
+        self.run_script("""\
+$ bzr merge -d target source
+2>bzr: ERROR: Merging into empty branches not currently supported, https://bugs.launchpad.net/bzr/+bug/308562
+""")
 
 class TestMergeForce(tests.TestCaseWithTransport):
 

=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt	2011-05-18 10:02:31 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt	2011-05-18 12:18:39 +0000
@@ -89,6 +89,9 @@
   reporting subdirectories that were tree references (in formats that
   supported them). (John Arbash Meinel, #764677)
 
+* Merging into empty branches now gives an error as this is currently
+  not supported. (Jonathan Riddell, #242175)
+
 * Do not show exception to user on pointless commit error (Jonathan
   Riddell #317357)
 




More information about the bazaar-commits mailing list