Rev 2458: Lock trees in Merge3Merger correctly. in http://bazaar.launchpad.net/~bzr/bzr/dirstate

Robert Collins robertc at robertcollins.net
Thu Mar 1 04:29:36 GMT 2007


At http://bazaar.launchpad.net/~bzr/bzr/dirstate

------------------------------------------------------------
revno: 2458
revision-id: robertc at robertcollins.net-20070301042839-hgs5fy98vuws6iau
parent: robertc at robertcollins.net-20070301042042-vmcypp3mjnvuwft5
committer: Robert Collins <robertc at robertcollins.net>
branch nick: dirstate
timestamp: Thu 2007-03-01 15:28:39 +1100
message:
  Lock trees in Merge3Merger correctly.
modified:
  bzrlib/merge.py                merge.py-20050513021216-953b65a438527106
=== modified file 'bzrlib/merge.py'
--- a/bzrlib/merge.py	2007-02-26 17:09:38 +0000
+++ b/bzrlib/merge.py	2007-03-01 04:28:39 +0000
@@ -379,8 +379,11 @@
         """Initialize the merger object and perform the merge."""
         object.__init__(self)
         self.this_tree = working_tree
+        self.this_tree.lock_tree_write()
         self.base_tree = base_tree
+        self.base_tree.lock_read()
         self.other_tree = other_tree
+        self.other_tree.lock_read()
         self._raw_conflicts = []
         self.cooked_conflicts = []
         self.reprocess = reprocess
@@ -396,7 +399,6 @@
         else:
             all_ids = set(base_tree)
             all_ids.update(other_tree)
-        working_tree.lock_tree_write()
         self.tt = TreeTransform(working_tree, self.pb)
         try:
             self.pp.next_phase()
@@ -431,7 +433,9 @@
                 pass
         finally:
             self.tt.finalize()
-            working_tree.unlock()
+            self.other_tree.unlock()
+            self.base_tree.unlock()
+            self.this_tree.unlock()
             self.pb.clear()
 
     def fix_root(self):



More information about the bazaar-commits mailing list