Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 23129:eb315418224c stable
hook: protect commit hooks against stripping of temporary commit (issue4422)
History rewriting commands like histedit tend to use temporary
commits. They may schedule hook execution on these temporary commits
for after the lock has been released. But temporary commits are likely
to have been stripped before the lock is released (and the hook run).
Hook executed for missing revisions leads to various crashes.
We disable hooks execution for revision missing in the repo. This
provides a dirty but simple fix to user issues.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Sat, 01 Nov 2014 23:17:50 +0000 |
parents | 8b4a8a9176e2 |
children | 3872d563e01a 53a65929ef1f |
comparison
equal
deleted
inserted
replaced
23128:b6f7cf47f5d1 | 23129:eb315418224c |
---|---|
1368 ms.reset() | 1368 ms.reset() |
1369 finally: | 1369 finally: |
1370 wlock.release() | 1370 wlock.release() |
1371 | 1371 |
1372 def commithook(node=hex(ret), parent1=hookp1, parent2=hookp2): | 1372 def commithook(node=hex(ret), parent1=hookp1, parent2=hookp2): |
1373 self.hook("commit", node=node, parent1=parent1, parent2=parent2) | 1373 # hack for command that use a temporary commit (eg: histedit) |
1374 # temporary commit got stripped before hook release | |
1375 if node in self: | |
1376 self.hook("commit", node=node, parent1=parent1, | |
1377 parent2=parent2) | |
1374 self._afterlock(commithook) | 1378 self._afterlock(commithook) |
1375 return ret | 1379 return ret |
1376 | 1380 |
1377 @unfilteredmethod | 1381 @unfilteredmethod |
1378 def commitctx(self, ctx, error=False): | 1382 def commitctx(self, ctx, error=False): |