Rev 3750: (jam) Fix 'bzr revert' on win32 by taking a write lock out earlier. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon Sep 29 06:42:39 BST 2008


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3750
revision-id: pqm at pqm.ubuntu.com-20080929054234-s2ajcaxxm75errlz
parent: pqm at pqm.ubuntu.com-20080927233809-mlgk5zkwowkb8q8z
parent: john at arbash-meinel.com-20080925220546-rvodcd1e46xyud4k
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2008-09-29 06:42:34 +0100
message:
  (jam) Fix 'bzr revert' on win32 by taking a write lock out earlier.
modified:
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
    ------------------------------------------------------------
    revno: 3737.2.1
    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.
    modified:
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
=== 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