Mercurial > hg
changeset 26358:de5a52e5eb9e
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.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Thu, 24 Sep 2015 16:00:41 -0700 |
parents | 6979a1369185 |
children | c545d51c901e |
files | mercurial/lock.py |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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