Mercurial > hg
view tests/test-fastannotate-corrupt.t @ 45825:8f07f5a9c3de
worker: raise exception instead of calling sys.exit() with child's code
When a worker process returns an error code, we would call
`sys.exit()` with that exit code on the main process. The `SystemExit`
exception would then get caught in `scmutil.callcatch()`, which would
return that error code. The comment there says "Commands shouldn't
sys.exit directly", which I agree with. This patch changes it so we
raise a specific exception when a worker fails so we can catch
instead. I think that means that `SystemExit` is now always an
internal error.
(I had earlier thought that this call to `sys.exit()` was from within
the child process until Matt Harbison made me look again, so thanks
for that!)
Differential Revision: https://phab.mercurial-scm.org/D9287
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Sat, 07 Nov 2020 21:50:28 -0800 |
parents | 1ddb296e0dee |
children |
line wrap: on
line source
$ cat >> $HGRCPATH << EOF > [extensions] > fastannotate= > EOF $ hg init repo $ cd repo $ for i in 0 1 2 3 4; do > echo $i >> a > echo $i >> b > hg commit -A -m $i a b > done use the "debugbuildannotatecache" command to build annotate cache at rev 0 $ hg debugbuildannotatecache --debug --config fastannotate.mainbranch=0 fastannotate: a: 1 new changesets in the main branch fastannotate: b: 1 new changesets in the main branch "debugbuildannotatecache" should work with broken cache (and other files would be built without being affected). note: linelog being broken is only noticed when we try to append to it. $ echo 'CORRUPT!' >> .hg/fastannotate/default/a.m $ hg debugbuildannotatecache --debug --config fastannotate.mainbranch=1 fastannotate: a: rebuilding broken cache fastannotate: a: 2 new changesets in the main branch fastannotate: b: 1 new changesets in the main branch $ echo 'CANNOT REUSE!' > .hg/fastannotate/default/a.l $ hg debugbuildannotatecache --debug --config fastannotate.mainbranch=2 fastannotate: a: rebuilding broken cache fastannotate: a: 3 new changesets in the main branch fastannotate: b: 1 new changesets in the main branch $ rm .hg/fastannotate/default/a.m $ hg debugbuildannotatecache --debug --config fastannotate.mainbranch=3 fastannotate: a: rebuilding broken cache fastannotate: a: 4 new changesets in the main branch fastannotate: b: 1 new changesets in the main branch $ rm .hg/fastannotate/default/a.l $ hg debugbuildannotatecache --debug --config fastannotate.mainbranch=3 $ hg debugbuildannotatecache --debug --config fastannotate.mainbranch=4 fastannotate: a: rebuilding broken cache fastannotate: a: 5 new changesets in the main branch fastannotate: b: 1 new changesets in the main branch "fastannotate" should deal with file corruption as well $ rm -rf .hg/fastannotate $ hg fastannotate --debug -r 0 a fastannotate: a: 1 new changesets in the main branch 0: 0 $ echo 'CORRUPT!' >> .hg/fastannotate/default/a.m $ hg fastannotate --debug -r 0 a fastannotate: a: cache broken and deleted fastannotate: a: 1 new changesets in the main branch 0: 0 $ echo 'CORRUPT!' > .hg/fastannotate/default/a.l $ hg fastannotate --debug -r 1 a fastannotate: a: cache broken and deleted fastannotate: a: 2 new changesets in the main branch 0: 0 1: 1 $ rm .hg/fastannotate/default/a.l $ hg fastannotate --debug -r 1 a fastannotate: a: using fast path (resolved fctx: True) fastannotate: a: cache broken and deleted fastannotate: a: 2 new changesets in the main branch 0: 0 1: 1 $ rm .hg/fastannotate/default/a.m $ hg fastannotate --debug -r 2 a fastannotate: a: cache broken and deleted fastannotate: a: 3 new changesets in the main branch 0: 0 1: 1 2: 2