Rev 5186: (abentley) Fix switch with per-file mergers (#559436) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Apr 27 02:04:48 BST 2010


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

------------------------------------------------------------
revno: 5186 [merge]
revision-id: pqm at pqm.ubuntu.com-20100427010445-rargwg6u8xyjv80b
parent: pqm at pqm.ubuntu.com-20100426165034-e7tdcndfb0jlr11e
parent: aaron at aaronbentley.com-20100426233810-ktj5qkyowq33iuya
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2010-04-27 02:04:45 +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-24 09:08:27 +0000
+++ b/NEWS	2010-04-26 23:36:26 +0000
@@ -110,6 +110,9 @@
   http://bugs.python.org/issue8396 .
   (Parth Malwankar, #413406)
 
+* ``bzr switch`` does not die if a ConfigurableFileMerger is used.
+  (Aaron Bentley, #559436)
+
 * ``bzr update`` when a pending merge in the working tree has been merged
   into the master branch will no longer claim that old commits have become
   pending merges. (Robert Collins, #562079)

=== modified file 'bzrlib/merge.py'
--- a/bzrlib/merge.py	2010-04-16 07:56:51 +0000
+++ b/bzrlib/merge.py	2010-04-26 23:36:26 +0000
@@ -704,7 +704,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.
@@ -728,6 +729,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-03-25 14:22:41 +0000
+++ b/bzrlib/switch.py	2010-04-26 23:38:10 +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-24 00:29:12 +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