lock: add a method to reacquire the lock after subprocesses exit
This is part of a series that will allow locks to be inherited by subprocesses
in limited circumstances.
--- a/mercurial/lock.py Thu Sep 24 10:37:13 2015 -0700
+++ b/mercurial/lock.py Thu Sep 24 16:00:41 2015 -0700
@@ -180,6 +180,14 @@
self._inherited = True
return lockname
+ def reacquire(self):
+ if not self._inherited:
+ raise error.LockInheritanceContractViolation(
+ 'reacquire can only be called after prepinherit')
+ if self.acquirefn:
+ self.acquirefn()
+ self._inherited = False
+
def release(self):
"""release the lock and execute callback function if any