Rev 2455: Lock trees passed in to build_tree. in http://bazaar.launchpad.net/~bzr/bzr/dirstate

Robert Collins robertc at robertcollins.net
Thu Mar 1 04:07:42 GMT 2007


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

------------------------------------------------------------
revno: 2455
revision-id: robertc at robertcollins.net-20070301040645-1ky0urtukkb9gdxa
parent: robertc at robertcollins.net-20070301035615-apsvyiyqk6pqext2
committer: Robert Collins <robertc at robertcollins.net>
branch nick: dirstate
timestamp: Thu 2007-03-01 15:06:45 +1100
message:
  Lock trees passed in to build_tree.
modified:
  bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
=== modified file 'bzrlib/transform.py'
--- a/bzrlib/transform.py	2007-03-01 03:56:15 +0000
+++ b/bzrlib/transform.py	2007-03-01 04:06:45 +0000
@@ -1097,6 +1097,18 @@
       it is silently replaced.
     - Otherwise, conflict resolution will move the old file to 'oldname.moved'.
     """
+    tree.lock_read()
+    try:
+        wt.lock_tree_write()
+        try:
+            return _build_tree(tree, wt)
+        finally:
+            wt.unlock()
+    finally:
+        tree.unlock()
+
+def _build_tree(tree, wt):
+    """See build_tree."""
     if len(wt.inventory) > 1:  # more than just a root
         raise errors.WorkingTreeAlreadyPopulated(base=wt.basedir)
     file_trans_id = {}



More information about the bazaar-commits mailing list