Rev 4816: (abentley) Fix merge when this_tree isn't a WorkingTree. in file:///home/pqm/archives/thelove/bzr/2.1/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Feb 18 01:40:57 GMT 2010


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

------------------------------------------------------------
revno: 4816 [merge]
revision-id: pqm at pqm.ubuntu.com-20100218014056-g069j8chstznygk2
parent: pqm at pqm.ubuntu.com-20100217184632-x22zi1tydy0n75m1
parent: aaron at aaronbentley.com-20100218010038-rohfusqqwng6bjyc
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.1
timestamp: Thu 2010-02-18 01:40:56 +0000
message:
  (abentley) Fix merge when this_tree isn't a WorkingTree.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/merge.py                merge.py-20050513021216-953b65a438527106
  bzrlib/tests/test_merge.py     testmerge.py-20050905070950-c1b5aa49ff911024
  bzrlib/tests/test_merge_core.py test_merge_core.py-20050824132511-eb99b23a0eec641b
=== modified file 'NEWS'
--- a/NEWS	2010-02-17 17:14:34 +0000
+++ b/NEWS	2010-02-17 23:40:51 +0000
@@ -21,6 +21,8 @@
 * Standardize the error handling when creating a new ``StaticTuple``
   (problems will raise TypeError). (Matt Nordhoff, #457979)
 
+* Merge correctly when this_tree is not a WorkingTree.  (Aaron Bentley)
+
 
 bzr 2.1.0
 #########

=== modified file 'bzrlib/merge.py'
--- a/bzrlib/merge.py	2010-02-17 17:11:16 +0000
+++ b/bzrlib/merge.py	2010-02-17 23:40:51 +0000
@@ -130,7 +130,7 @@
         """
         affected_files = self.affected_files
         if affected_files is None:
-            config = self.merger.this_tree.branch.get_config()
+            config = self.merger.this_branch.get_config()
             # Until bzr provides a better policy for caching the config, we
             # just add the part we're interested in to the params to avoid
             # reading the config files repeatedly (bazaar.conf, location.conf,

=== modified file 'bzrlib/tests/test_merge.py'
--- a/bzrlib/tests/test_merge.py	2010-02-17 17:11:16 +0000
+++ b/bzrlib/tests/test_merge.py	2010-02-18 01:00:38 +0000
@@ -2894,6 +2894,11 @@
                         base=False, other=False)
         return builder
 
+    def test_uses_this_branch(self):
+        builder = self.make_text_conflict()
+        tt = builder.make_preview_transform()
+        self.addCleanup(tt.finalize)
+
     def test_affected_files_cached(self):
         """Ensures that the config variable is cached"""
         builder = self.make_text_conflict()

=== modified file 'bzrlib/tests/test_merge_core.py'
--- a/bzrlib/tests/test_merge_core.py	2010-02-17 17:11:16 +0000
+++ b/bzrlib/tests/test_merge_core.py	2010-02-17 23:40:51 +0000
@@ -73,6 +73,16 @@
                 new_file(tt)
 
     def merge(self, merge_type=Merge3Merger, interesting_ids=None, **kwargs):
+        merger = self.make_merger(merge_type, interesting_ids, **kwargs)
+        merger.do_merge()
+        return merger.cooked_conflicts
+
+    def make_preview_transform(self):
+        merger = self.make_merger(Merge3Merger, None, this_revision_tree=True)
+        return merger.make_preview_transform()
+
+    def make_merger(self, merge_type, interesting_ids,
+            this_revision_tree=False, **kwargs):
         self.base_tt.apply()
         self.base.commit('base commit')
         for tt, wt in ((self.this_tt, self.this), (self.other_tt, self.other)):
@@ -89,9 +99,15 @@
                 raise AssertionError()
         self.this.branch.fetch(self.other.branch)
         other_basis = self.other.branch.basis_tree()
-        merger = merge_type(self.this, self.this, self.base, other_basis,
-                            interesting_ids=interesting_ids, **kwargs)
-        return merger.cooked_conflicts
+        if this_revision_tree:
+            self.this.commit('message')
+            this_tree = self.this.basis_tree()
+        else:
+            this_tree = self.this
+        merger = merge_type(this_tree, self.this, self.base, other_basis,
+                            interesting_ids=interesting_ids, do_merge=False,
+                            this_branch=self.this.branch, **kwargs)
+        return merger
 
     def list_transforms(self):
         return [self.this_tt, self.base_tt, self.other_tt]




More information about the bazaar-commits mailing list