##// END OF EJS Templates
afterlock: add the callback to the top level lock (issue4608)...
Pierre-Yves David -
r24821:57f1dbc9 stable
parent child Browse files
Show More
@@ -1194,13 +1194,16 b' class localrepository(object):'
1194 1194 return l
1195 1195
1196 1196 def _afterlock(self, callback):
1197 """add a callback to the current repository lock.
1197 """add a callback to be run when the repository is fully unlocked
1198 1198
1199 The callback will be executed on lock release."""
1200 l = self._lockref and self._lockref()
1201 if l:
1199 The callback will be executed when the outermost lock is released
1200 (with wlock being higher level than 'lock')."""
1201 for ref in (self._wlockref, self._lockref):
1202 l = ref and ref()
1203 if l and l.held:
1202 1204 l.postrelease.append(callback)
1203 else:
1205 break
1206 else: # no lock have been found.
1204 1207 callback()
1205 1208
1206 1209 def lock(self, wait=True):
@@ -1,4 +1,5 b''
1 1 commit hooks can see env vars
2 (and post-transaction one are run unlocked)
2 3
3 4 $ hg init a
4 5 $ cd a
@@ -16,6 +17,7 b' commit hooks can see env vars'
16 17 > pretxnclose = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" pretxnclose"
17 18 > txnclose = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" txnclose"
18 19 > txnabort = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" txnabort"
20 > txnclose.checklock = hg debuglock > /dev/null
19 21 > EOF
20 22 $ echo a > a
21 23 $ hg add a
General Comments 0
You need to be logged in to leave comments. Login now