Patchwork [4,of,4,marmoute-reviewed] localrepo: allow wlock to be inherited

login
register
mail settings
Submitter Siddharth Agarwal
Date Oct. 5, 2015, 3:23 a.m.
Message ID <5ab1e6decd1d0b1db4a0.1444015394@dev6666.prn1.facebook.com>
Download mbox | patch
Permalink /patch/10806/
State Accepted
Headers show

Comments

Siddharth Agarwal - Oct. 5, 2015, 3:23 a.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1443209963 25200
#      Fri Sep 25 12:39:23 2015 -0700
# Node ID 5ab1e6decd1d0b1db4a0298284f6c3c3ace82eda
# Parent  5864aca0e2d7597135a8cd061358a6fd3144325c
localrepo: allow wlock to be inherited

This is part of a series that will allow locks to be inherited by subprocesses
in limited circumstances.

When allowed, the parent process will pass down requisite information to the
child process by way of this environment variable.

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1296,7 +1296,7 @@  class localrepository(object):
 
         l = self._lock(self.vfs, "wlock", wait, unlock,
                        self.invalidatedirstate, _('working directory of %s') %
-                       self.origroot)
+                       self.origroot, parentenvvar='HG_WLOCK_LOCKER')
         self._wlockref = weakref.ref(l)
         return l
 
diff --git a/tests/test-fncache.t b/tests/test-fncache.t
--- a/tests/test-fncache.t
+++ b/tests/test-fncache.t
@@ -205,7 +205,7 @@  Aborting lock does not prevent fncache w
   > from mercurial import commands, util
   > from mercurial.extensions import wrapfunction
   > 
-  > def lockexception(orig, vfs, lockname, wait, releasefn, acquirefn, desc):
+  > def lockexception(orig, vfs, lockname, wait, releasefn, acquirefn, desc, parentenvvar=None):
   >     def releasewrap():
   >         raise util.Abort("forced lock failure")
   >     return orig(vfs, lockname, wait, releasewrap, acquirefn, desc)