Rev 3968: Change 'cmd_export' to lock the trees it is working with. in lp:///~jameinel/bzr/win32-shelve

John Arbash Meinel john at arbash-meinel.com
Tue Feb 10 16:39:19 GMT 2009


At lp:///~jameinel/bzr/win32-shelve

------------------------------------------------------------
revno: 3968
revision-id: john at arbash-meinel.com-20090210163901-4m1f9jbidianssvt
parent: john at arbash-meinel.com-20090210012136-b007dchbyf3gld6q
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: win32-shelve
timestamp: Tue 2009-02-10 10:39:01 -0600
message:
  Change 'cmd_export' to lock the trees it is working with.
-------------- next part --------------
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2009-02-05 21:06:49 +0000
+++ b/bzrlib/builtins.py	2009-02-10 16:39:01 +0000
@@ -2320,15 +2320,25 @@
             tree = WorkingTree.open_containing(u'.')[0]
             b = tree.branch
             subdir = None
+            tree.lock_read()
         else:
             b, subdir = Branch.open_containing(branch_or_subdir)
             tree = None
+            b.lock_read()
 
-        rev_tree = _get_one_revision_tree('export', revision, branch=b, tree=tree)
         try:
-            export(rev_tree, dest, format, root, subdir)
-        except errors.NoSuchExportFormat, e:
-            raise errors.BzrCommandError('Unsupported export format: %s' % e.format)
+            rev_tree = _get_one_revision_tree('export', revision, branch=b,
+                                              tree=tree)
+            try:
+                export(rev_tree, dest, format, root, subdir)
+            except errors.NoSuchExportFormat, e:
+                raise errors.BzrCommandError(
+                    'Unsupported export format: %s' % e.format)
+        finally:
+            if tree is not None:
+                tree.unlock()
+            else:
+                b.unlock()
 
 
 class cmd_cat(Command):



More information about the bazaar-commits mailing list