Comments
Patch
@@ -1192,17 +1192,20 @@ class localrepository(object):
if acquirefn:
acquirefn()
return l
def _afterlock(self, callback):
- """add a callback to the current repository lock.
+ """add a callback to be run when the repository if fully unlocked
- The callback will be executed on lock release."""
- l = self._lockref and self._lockref()
- if l:
- l.postrelease.append(callback)
- else:
+ The callback will be executed when the "top most" lock is released
+ (with wlock being higher level than 'lock')."""
+ for ref in (self._wlockref, self._lockref):
+ l = ref and ref()
+ if l and l.held:
+ l.postrelease.append(callback)
+ break
+ else: # no lock have been found.
callback()
def lock(self, wait=True):
'''Lock the repository store (.hg/store) and return a weak reference
to the lock. Use this before modifying the store (e.g. committing or
@@ -1,6 +1,7 @@
commit hooks can see env vars
+(and post-transaction one are run unlocked)
$ hg init a
$ cd a
$ cat > .hg/hgrc <<EOF
> [hooks]
@@ -14,10 +15,11 @@ commit hooks can see env vars
> post-cat = python "$TESTDIR/printenv.py" post-cat
> pretxnopen = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" pretxnopen"
> pretxnclose = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" pretxnclose"
> txnclose = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" txnclose"
> txnabort = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" txnabort"
+ > txnclose.checklock = hg debuglock > /dev/null
> EOF
$ echo a > a
$ hg add a
$ hg commit -m a
precommit hook: HG_PARENT1=0000000000000000000000000000000000000000