Rev 2450: Lock the working tree while pulling to work around _iter_changes not supplying the old path, and dirstate not allowing unlocked inventory access. in http://bazaar.launchpad.net/~bzr/bzr/dirstate

Robert Collins robertc at robertcollins.net
Thu Mar 1 02:37:31 GMT 2007


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

------------------------------------------------------------
revno: 2450
revision-id: robertc at robertcollins.net-20070301023547-g7w3o81gwczes50y
parent: robertc at robertcollins.net-20070301020403-xxmzwvejmkeiimkm
committer: Robert Collins <robertc at robertcollins.net>
branch nick: dirstate
timestamp: Thu 2007-03-01 13:35:47 +1100
message:
  Lock the working tree while pulling to work around _iter_changes not supplying the old path, and dirstate not allowing unlocked inventory access.
modified:
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2007-03-01 01:33:54 +0000
+++ b/bzrlib/builtins.py	2007-03-01 02:35:47 +0000
@@ -600,8 +600,15 @@
 
         old_rh = branch_to.revision_history()
         if tree_to is not None:
-            count = tree_to.pull(branch_from, overwrite, rev_id,
-                delta.ChangeReporter(tree_to.inventory))
+            # lock the tree we are pulling too, so that its inventory is
+            # stable. This is a hack to workaround the _iter_changes interface
+            # not exposing the old path, which will be fixed soon. RBC 20070301
+            tree_to.lock_write()
+            try:
+                count = tree_to.pull(branch_from, overwrite, rev_id,
+                    delta.ChangeReporter(tree_to.inventory))
+            finally:
+                tree_to.unlock()
         else:
             count = branch_to.pull(branch_from, overwrite, rev_id)
         note('%d revision(s) pulled.' % (count,))



More information about the bazaar-commits mailing list