taapas1128 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers.
REVISION SUMMARY This patch disallows `hg merge --abort` in case an operation of higher precedence i.e unshelve, rebase, histedit are in unfinished states. This is done so as to avoid partial abort of these operations in case merge abort is called at an interrupted step. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6607 AFFECTED FILES mercurial/commands.py tests/test-shelve2.t CHANGE DETAILS diff --git a/tests/test-shelve2.t b/tests/test-shelve2.t --- a/tests/test-shelve2.t +++ b/tests/test-shelve2.t @@ -847,3 +847,38 @@ #endif $ cd .. + +Block merge abort when unshelve in progress(issue6160) +------------------------------------------------------ + + $ hg init a + $ cd a + $ echo foo > a ; hg commit -qAm "initial commit" + $ echo bar > a + $ hg shelve + shelved as default + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ echo foobar > a + $ hg unshelve + unshelving change 'default' + temporarily committing pending changes (restore with 'hg unshelve --abort') + rebasing shelved changes + merging a + warning: conflicts while merging a! (edit, then use 'hg resolve --mark') + unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') + [1] + + $ hg log --template '{desc|firstline} {author} {date|isodate} \n' -r . + pending changes temporary commit shelve@localhost 1970-01-01 00:00 +0000 + $ hg merge --abort + abort: cannot abort merge with unshelve in progress + (use 'hg unshelve --continue' or 'hg unshelve --abort') + [255] + + $ hg unshelve --abort + unshelve of 'default' aborted + + $ hg log -G --template '{desc|firstline} {author} {date|isodate} \n' -r . + @ initial commit test 1970-01-01 00:00 +0000 + + $ cd .. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -4013,6 +4013,14 @@ opts = pycompat.byteskwargs(opts) abort = opts.get('abort') + unfinishedstate = None + for state in statemod._unfinishedstates: + if state.isunfinished(repo): + unfinishedstate = state + if abort and unfinishedstate._opname != 'merge': + raise error.Abort(_('cannot abort merge with %s in progress') % + (unfinishedstate._opname), + hint=unfinishedstate.hint()) if abort and repo.dirstate.p2() == nullid: cmdutil.wrongtooltocontinue(repo, _('merge')) if abort: To: taapas1128, #hg-reviewers Cc: mercurial-devel _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel