Rev 6419: (jelmer) Distinguish between working tree and this tree in merge. (Jelmer in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

Patch Queue Manager pqm at pqm.ubuntu.com
Tue Jan 3 16:52:04 UTC 2012


At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 6419 [merge]
revision-id: pqm at pqm.ubuntu.com-20120103165203-ni17x57ylfpli2j0
parent: pqm at pqm.ubuntu.com-20120103141205-ietjvfpwrl368osv
parent: jelmer at samba.org-20120102213059-y1wjbtbliki1fb06
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2012-01-03 16:52:03 +0000
message:
  (jelmer) Distinguish between working tree and this tree in merge. (Jelmer
   Vernooij)
modified:
  bzrlib/merge.py                merge.py-20050513021216-953b65a438527106
=== modified file 'bzrlib/merge.py'
--- a/bzrlib/merge.py	2012-01-02 17:59:40 +0000
+++ b/bzrlib/merge.py	2012-01-02 21:30:59 +0000
@@ -764,7 +764,8 @@
             this_branch = this_tree.branch
         self.interesting_ids = interesting_ids
         self.interesting_files = interesting_files
-        self.this_tree = working_tree
+        self.working_tree = working_tree
+        self.this_tree = this_tree
         self.base_tree = base_tree
         self.other_tree = other_tree
         self.this_branch = this_branch
@@ -790,7 +791,9 @@
 
     def do_merge(self):
         operation = cleanup.OperationWithCleanups(self._do_merge)
-        self.this_tree.lock_tree_write()
+        self.working_tree.lock_tree_write()
+        operation.add_cleanup(self.working_tree.unlock)
+        self.this_tree.lock_read()
         operation.add_cleanup(self.this_tree.unlock)
         self.base_tree.lock_read()
         operation.add_cleanup(self.base_tree.unlock)
@@ -799,13 +802,13 @@
         operation.run()
 
     def _do_merge(self, operation):
-        self.tt = transform.TreeTransform(self.this_tree, None)
+        self.tt = transform.TreeTransform(self.working_tree, None)
         operation.add_cleanup(self.tt.finalize)
         self._compute_transform()
         results = self.tt.apply(no_conflicts=True)
         self.write_modified(results)
         try:
-            self.this_tree.add_conflicts(self.cooked_conflicts)
+            self.working_tree.add_conflicts(self.cooked_conflicts)
         except errors.UnsupportedOperation:
             pass
 
@@ -818,7 +821,7 @@
         return operation.run_simple()
 
     def _make_preview_transform(self):
-        self.tt = transform.TransformPreview(self.this_tree)
+        self.tt = transform.TransformPreview(self.working_tree)
         self._compute_transform()
         return self.tt
 
@@ -1123,14 +1126,14 @@
     def write_modified(self, results):
         modified_hashes = {}
         for path in results.modified_paths:
-            file_id = self.this_tree.path2id(self.this_tree.relpath(path))
+            file_id = self.working_tree.path2id(self.working_tree.relpath(path))
             if file_id is None:
                 continue
-            hash = self.this_tree.get_file_sha1(file_id)
+            hash = self.working_tree.get_file_sha1(file_id)
             if hash is None:
                 continue
             modified_hashes[file_id] = hash
-        self.this_tree.set_merge_modified(modified_hashes)
+        self.working_tree.set_merge_modified(modified_hashes)
 
     @staticmethod
     def parent(entry, file_id):




More information about the bazaar-commits mailing list