changeset 26439:b50f5beadf3e

localrepo: allow creating inherited locks 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 Fri, 25 Sep 2015 12:28:12 -0700
parents 024644b1900b
children 85b992177d2a
files mercurial/localrepo.py
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Fri Sep 25 12:56:05 2015 -0700
+++ b/mercurial/localrepo.py	Fri Sep 25 12:28:12 2015 -0700
@@ -1211,10 +1211,15 @@
                 continue
             ce.refresh()
 
-    def _lock(self, vfs, lockname, wait, releasefn, acquirefn, desc):
+    def _lock(self, vfs, lockname, wait, releasefn, acquirefn, desc,
+              parentenvvar=None):
+        parentlock = None
+        if parentenvvar is not None:
+            parentlock = os.environ.get(parentenvvar)
         try:
             l = lockmod.lock(vfs, lockname, 0, releasefn=releasefn,
-                             acquirefn=acquirefn, desc=desc)
+                             acquirefn=acquirefn, desc=desc,
+                             parentlock=parentlock)
         except error.LockHeld as inst:
             if not wait:
                 raise