diff mercurial/lock.py @ 26321:db4c192cb9b3

lock: move acquirefn call to inside the lock We're going to need to call it again as part of reinitialization after a subprocess inherits the lock.
author Siddharth Agarwal <sid0@fb.com>
date Tue, 22 Sep 2015 14:09:42 -0700
parents 1d33842c5b3e
children 927fa07a2ba4
line wrap: on
line diff
--- a/mercurial/lock.py	Tue Sep 22 13:25:41 2015 -0700
+++ b/mercurial/lock.py	Tue Sep 22 14:09:42 2015 -0700
@@ -38,16 +38,20 @@
 
     _host = None
 
-    def __init__(self, vfs, file, timeout=-1, releasefn=None, desc=None):
+    def __init__(self, vfs, file, timeout=-1, releasefn=None, acquirefn=None,
+                 desc=None):
         self.vfs = vfs
         self.f = file
         self.held = 0
         self.timeout = timeout
         self.releasefn = releasefn
+        self.acquirefn = acquirefn
         self.desc = desc
         self.postrelease  = []
         self.pid = os.getpid()
         self.delay = self.lock()
+        if self.acquirefn:
+            self.acquirefn()
 
     def __del__(self):
         if self.held: