Rev 5: clean up locking by using TT's lock. Delay determining absolute path until we need it (suggested by Aaron) in http://bzr.arbash-meinel.com/plugins/x_bit

John Arbash Meinel john at arbash-meinel.com
Wed Mar 28 20:14:55 BST 2007


At http://bzr.arbash-meinel.com/plugins/x_bit

------------------------------------------------------------
revno: 5
revision-id: john at arbash-meinel.com-20070328191454-1jhr1ttjfeukrept
parent: john at arbash-meinel.com-20070328184129-qt7egrdq7nlk5yy4
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: x_bit
timestamp: Wed 2007-03-28 14:14:54 -0500
message:
  clean up locking by using TT's lock. Delay determining absolute path until we need it (suggested by Aaron)
modified:
  __init__.py                    __init__.py-20060516204016-5be79f11e31f2cb7
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py	2007-03-28 18:41:29 +0000
+++ b/__init__.py	2007-03-28 19:14:54 +0000
@@ -42,19 +42,17 @@
         # should be False.
 
         tree, relpaths = builtins.tree_files(files_list)
-        tt = None
-        tree.lock_tree_write()
+        # TreeTransform will grab a lock_tree_write()
+        tt = transform.TreeTransform(tree)
         try:
-            tt = transform.TreeTransform(tree)
             for fname in relpaths:
-                absfname = tree.abspath(fname)
-
                 fid = tree.path2id(fname)
                 if fid is None:
                     self.outf.write("Path %s is not versioned"
                                     % (fname,))
                     continue
 
+                absfname = tree.abspath(fname)
                 kind = osutils.file_kind(absfname)
                 if kind != 'file':
                     self.outf.write("Path %s is a %s not a file"
@@ -69,9 +67,7 @@
                    self.outf.write("File %s => x-bit: %r\n"
                                    % (fname, set,))
         finally:
-            if tt is not None:
-                tt.apply()
-            tree.unlock()
+            tt.apply()
 
 #/class cmd_x_bit
 



More information about the bazaar-commits mailing list