diff --git a/tests/test-dirstate.t b/tests/test-dirstate.t --- a/tests/test-dirstate.t +++ b/tests/test-dirstate.t @@ -61,3 +61,28 @@ Test modulo storage/comparison of absurd $ hg debugstate n 644 2 2018-01-19 15:14:08 a #endif + +Verify that exceptions during a dirstate change leave the dirstate +coherent (issue4353) + + $ cat > ../dirstateexception.py < from mercurial import merge, extensions, util + > + > def wraprecordupdates(orig, repo, actions, branchmerge): + > raise util.Abort("simulated error while recording dirstateupdates") + > + > def reposetup(ui, repo): + > extensions.wrapfunction(merge, 'recordupdates', wraprecordupdates) + > EOF + + $ hg rm a + $ hg commit -m 'rm a' + $ echo "[extensions]" >> .hg/hgrc + $ echo "dirstateex=../dirstateexception.py" >> .hg/hgrc + $ hg up 0 + abort: simulated error while recording dirstateupdates + [255] + $ hg log -r . -T '{rev}\n' + 1 + $ hg status + ? a