Rev 4146: (robertc) Fix a regression in merge where --force was ignored. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon Mar 16 03:30:49 GMT 2009


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

------------------------------------------------------------
revno: 4146
revision-id: pqm at pqm.ubuntu.com-20090316033045-cs5dvs2r9xjmqirh
parent: pqm at pqm.ubuntu.com-20090316024046-58qc87pfdgu2ugok
parent: robertc at robertcollins.net-20090313064625-ufwahhop77x1v139
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2009-03-16 03:30:45 +0000
message:
  (robertc) Fix a regression in merge where --force was ignored.
  	(Robert Collins)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/tests/blackbox/test_merge.py test_merge.py-20060323225809-9bc0459c19917f41
    ------------------------------------------------------------
    revno: 4142.1.1
    revision-id: robertc at robertcollins.net-20090313064625-ufwahhop77x1v139
    parent: pqm at pqm.ubuntu.com-20090313035623-vn0615cs6bd6590e
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: merge
    timestamp: Fri 2009-03-13 17:46:25 +1100
    message:
      Make merge --force work again.
    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-03-16 01:56:18 +0000
+++ b/NEWS	2009-03-16 03:30:45 +0000
@@ -43,7 +43,9 @@
 
     * Fixed incorrect "Source format does not support stacking" warning
       when pushing to a smart server.  (Andrew Bennetts, #334114)
-      
+
+    * ``merge --force`` works again. (Robert Collins, #342105)
+
     * The GNU Changelog formatter is slightly improved in the case where
       the delta is empty, and now correctly claims not to support tags.
       (Andrea Bolognani)

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2009-03-13 01:27:47 +0000
+++ b/bzrlib/builtins.py	2009-03-13 06:46:25 +0000
@@ -3387,9 +3387,10 @@
             basis_tree = tree.revision_tree(tree.last_revision())
         except errors.NoSuchRevision:
             basis_tree = tree.basis_tree()
-        changes = tree.changes_from(basis_tree)
-        if changes.has_changed():
-            raise errors.UncommittedChanges(tree)
+        if not force:
+            changes = tree.changes_from(basis_tree)
+            if changes.has_changed():
+                raise errors.UncommittedChanges(tree)
 
         view_info = _get_view_info_for_change_reporter(tree)
         change_reporter = delta._ChangeReporter(

=== modified file 'bzrlib/tests/blackbox/test_merge.py'
--- a/bzrlib/tests/blackbox/test_merge.py	2009-02-27 08:37:19 +0000
+++ b/bzrlib/tests/blackbox/test_merge.py	2009-03-13 06:46:25 +0000
@@ -491,6 +491,18 @@
         out, err = self.run_bzr(['merge', '-d', 'a', 'b'])
         self.assertContainsRe(err, 'Warning: criss-cross merge encountered.')
 
+    def test_merge_force(self):
+        tree_a = self.make_branch_and_tree('a')
+        self.build_tree(['a/foo'])
+        tree_a.add(['foo'])
+        tree_a.commit('add file')
+        tree_b = tree_a.bzrdir.sprout('b').open_workingtree()
+        self.build_tree_contents([('a/foo', 'change 1')])
+        tree_a.commit('change file')
+        tree_b.merge_from_branch(tree_a.branch)
+        tree_a.commit('empty change to allow merge to run')
+        self.run_bzr(['merge', '../a', '--force'], working_dir='b')
+
     def test_merge_from_submit(self):
         tree_a = self.make_branch_and_tree('a')
         tree_b = tree_a.bzrdir.sprout('b').open_workingtree()




More information about the bazaar-commits mailing list