Rev 4837: (abentley) Fix switch with per-file mergers (#559436) in file:///home/pqm/archives/thelove/bzr/2.1/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Apr 29 07:09:55 BST 2010


At file:///home/pqm/archives/thelove/bzr/2.1/

------------------------------------------------------------
revno: 4837 [merge]
revision-id: pqm at pqm.ubuntu.com-20100429060941-xlvrrmgolwd5gu9a
parent: pqm at pqm.ubuntu.com-20100423153340-61z9lszb75goby7h
parent: andrew.bennetts at canonical.com-20100429051404-of51oixupsmpp2li
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.1
timestamp: Thu 2010-04-29 07:09:41 +0100
message:
  (abentley) Fix switch with per-file mergers (#559436)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/merge.py                merge.py-20050513021216-953b65a438527106
  bzrlib/switch.py               switch.py-20071116011000-v5lnw7d2wkng9eux-1
  bzrlib/tests/test_switch.py    test_switch.py-20071116011000-v5lnw7d2wkng9eux-2
=== modified file 'NEWS'
--- a/NEWS	2010-04-23 05:28:35 +0000
+++ b/NEWS	2010-04-29 05:14:04 +0000
@@ -5,6 +5,18 @@
 .. contents:: List of Releases
    :depth: 1
 
+bzr 2.1.2
+#########
+
+:2.1.2: NOT RELEASED YET
+
+Bug Fixes
+*********
+
+* ``bzr switch`` does not die if a ConfigurableFileMerger is used.
+  (Aaron Bentley, #559436)
+
+
 bzr 2.1.1
 #########
 

=== modified file 'bzrlib/merge.py'
--- a/bzrlib/merge.py	2010-04-15 10:23:59 +0000
+++ b/bzrlib/merge.py	2010-04-29 05:14:04 +0000
@@ -705,7 +705,8 @@
         :param this_tree: The local tree in the merge operation
         :param base_tree: The common tree in the merge operation
         :param other_tree: The other tree to merge changes from
-        :param this_branch: The branch associated with this_tree
+        :param this_branch: The branch associated with this_tree.  Defaults to
+            this_tree.branch if not supplied.
         :param interesting_ids: The file_ids of files that should be
             participate in the merge.  May not be combined with
             interesting_files.
@@ -729,6 +730,8 @@
         if interesting_files is not None and interesting_ids is not None:
             raise ValueError(
                 'specify either interesting_ids or interesting_files')
+        if this_branch is None:
+            this_branch = this_tree.branch
         self.interesting_ids = interesting_ids
         self.interesting_files = interesting_files
         self.this_tree = working_tree

=== modified file 'bzrlib/switch.py'
--- a/bzrlib/switch.py	2010-02-17 17:11:16 +0000
+++ b/bzrlib/switch.py	2010-04-29 05:14:04 +0000
@@ -17,8 +17,7 @@
 # Original author: David Allouche
 
 from bzrlib import errors, merge, revision
-from bzrlib.branch import Branch, BranchFormat, BranchReferenceFormat
-from bzrlib.bzrdir import BzrDir
+from bzrlib.branch import Branch
 from bzrlib.trace import note
 
 

=== modified file 'bzrlib/tests/test_switch.py'
--- a/bzrlib/tests/test_switch.py	2010-01-15 04:05:36 +0000
+++ b/bzrlib/tests/test_switch.py	2010-04-29 05:14:04 +0000
@@ -19,7 +19,13 @@
 
 import os
 
-from bzrlib import branch, errors, switch, tests
+from bzrlib import (
+    branch,
+    errors,
+    merge as _mod_merge,
+    switch,
+    tests,
+)
 
 
 class TestSwitch(tests.TestCaseWithTransport):
@@ -129,6 +135,24 @@
         switch.switch(checkout.bzrdir, tree2.branch)
         self.assertEqual('custom-root-id', tree2.get_root_id())
 
+    def test_switch_configurable_file_merger(self):
+        class DummyMerger(_mod_merge.ConfigurableFileMerger):
+            name_prefix = 'file'
+
+        _mod_merge.Merger.hooks.install_named_hook(
+            'merge_file_content', DummyMerger,
+            'test factory')
+        foo = self.make_branch('foo')
+        checkout = foo.create_checkout('checkout', lightweight=True)
+        self.build_tree_contents([('checkout/file', 'a')])
+        checkout.add('file')
+        checkout.commit('a')
+        bar = foo.bzrdir.sprout('bar').open_workingtree()
+        self.build_tree_contents([('bar/file', 'b')])
+        bar.commit('b')
+        self.build_tree_contents([('checkout/file', 'c')])
+        switch.switch(checkout.bzrdir, bar.branch)
+
 
 class TestSwitchHeavyweight(TestSwitch):
 




More information about the bazaar-commits mailing list