sapling/eden/scm/tests/test-undo-corrupt.t
Jun Wu ff66f7deed undo: do not crash other commands if undo revlog is corrupted
Summary:
Undo revlog corruption should not affect other commands.
There were multiple user reports. This should not need a reclone.

Reviewed By: markbt

Differential Revision: D29723869

fbshipit-source-id: 8f48f45c1e25478ac9ff713fbcf69eaa08f464a8
2021-07-16 10:06:52 -07:00

42 lines
736 B
Perl

#chg-compatible
$ configure modern
$ enable undo remotenames
$ setconfig hint.ack-hint-ack=1
$ newrepo
$ drawdag << 'EOS'
> B
> |
> A
> EOS
Break the undo log
$ cat > a.py << EOF
> import os
> with open('.hg/undolog/index.i', 'rb+') as f:
> f.seek(-10, os.SEEK_END)
> f.write(b"x")
> EOF
$ hg debugpython a.py
Command should not abort
$ hg debugdrawdag << 'EOS'
> C
> |
> desc(A)
> EOS
hint[undo-corrupt]: undo history is corrupted
(try deleting $TESTTMP/repo1/.hg/undolog to recover)
Undo itself does not crash
$ hg undo
cannot undo: undo history is corrupted
hint[undo-corrupt]: undo history is corrupted
(try deleting $TESTTMP/repo1/.hg/undolog to recover)