Rev 3738: Take out a write lock right away for 'bzr revert' in http://bzr.arbash-meinel.com/branches/bzr/jam-integration

John Arbash Meinel john at arbash-meinel.com
Thu Sep 25 23:06:01 BST 2008


At http://bzr.arbash-meinel.com/branches/bzr/jam-integration

------------------------------------------------------------
revno: 3738
revision-id: john at arbash-meinel.com-20080925220546-rvodcd1e46xyud4k
parent: pqm at pqm.ubuntu.com-20080925075516-olnl5p5au2u1ml5v
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: jam-integration
timestamp: Thu 2008-09-25 17:05:46 -0500
message:
  Take out a write lock right away for 'bzr revert'
  
  Fixes a regression where 'bzr revert' stopped working on win32.
-------------- next part --------------
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2008-09-24 13:43:48 +0000
+++ b/bzrlib/builtins.py	2008-09-25 22:05:46 +0000
@@ -3263,10 +3263,14 @@
     def run(self, revision=None, no_backup=False, file_list=None,
             forget_merges=None):
         tree, file_list = tree_files(file_list)
-        if forget_merges:
-            tree.set_parent_ids(tree.get_parent_ids()[:1])
-        else:
-            self._revert_tree_to_revision(tree, revision, file_list, no_backup)
+        tree.lock_write()
+        try:
+            if forget_merges:
+                tree.set_parent_ids(tree.get_parent_ids()[:1])
+            else:
+                self._revert_tree_to_revision(tree, revision, file_list, no_backup)
+        finally:
+            tree.unlock()
 
     @staticmethod
     def _revert_tree_to_revision(tree, revision, file_list, no_backup):



More information about the bazaar-commits mailing list