This patch adds functionality to abort a conflicted
update. A new function hg.abortupdate() is added for
the purpose which has a helper function
hg._unmarkandresolvelocal() which deals with the
Results are shown in tests.
|2092 ↗||(On Diff #16251)|
When you add more tests, please include some with 1 dirty subrepo, and then another where the first subrepo is already merged/resolved, and the second subrepo is dirty and pending a merge/resolve. If it simplifies the initial implementation to detect a dirty subrepo and then abort the --abort before it starts, that seems fine.
Here's a case I stumbled upon that is a problem. It looks like it thinks it isn't in the middle of an update, but .hgsubstate isn't put back to the pre-update state.
diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t --- a/tests/test-subrepo.t +++ b/tests/test-subrepo.t @@ -1027,10 +1027,38 @@ filesystem (see also issue4583)) > [extensions] > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py > EOF + $ hg -R repo st -S + ? s/b + $ hg -R repo diff -S + $ hg -R repo log -r . + changeset: 0:c4018e9aea1b + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: 1 + + $ cat repo/.hgsubstate + f7b1eb17ad24730a1651fccd46c43826d1bbc2ac s $ hg -R repo update b: untracked file differs abort: untracked files in working directory differ from files in requested revision (in subrepository "s")  + $ hg -R repo update --abort + abort: no update in progress +  + $ hg -R repo diff -S + diff -r c4018e9aea1b .hgsubstate + --- a/.hgsubstate Thu Jan 01 00:00:00 1970 +0000 + +++ b/.hgsubstate Thu Jan 01 00:00:00 1970 +0000 + @@ -1,1 +1,1 @@ + -f7b1eb17ad24730a1651fccd46c43826d1bbc2ac s + +cc505f09a8b2644adffa368adb4abc6f70d07bc0 s + $ hg -R repo log -r . + changeset: 0:c4018e9aea1b + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: 1 + + $ cat >> repo/.hg/hgrc <<EOF > [extensions] > fakedirstatewritetime = !
Another good way to induce this .hgsubstate issue is to hg pull -u on a repo, where the remote subrepo isn't available. You don't need http for this- you can just rename the remote subrepo.