Bug 6160 - "hg merge --abort" uncleanly aborts an in-progress unshelve
Summary: "hg merge --abort" uncleanly aborts an in-progress unshelve
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: shelve (show other bugs)
Version: 5.0
Hardware: PC Linux
: wish bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-20 16:55 UTC by Mitchell Plamann
Modified: 2019-07-17 00:00 UTC (History)
1 user (show)

See Also:
Python Version: ---


Attachments
A test demonstrating the bug (1.80 KB, application/x-perl)
2019-06-20 16:55 UTC, Mitchell Plamann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mitchell Plamann 2019-06-20 16:55 UTC
Created attachment 2052 [details]
A test demonstrating the bug

If an "hg unshelve" is in-progress and you run
  $ hg merge --abort
this aborts the merge portion of the in-progress unshelve, but the unshelve is still in-progress -- many hg commands still return "abort: unshelve already in progress".

But then, aborting the unshelve fails:
  $ hg unshelve --abort
  unshelve of 'default' aborted
  abort: working directory parents do not match unshelve state

The working directory is still at the "pending changes temporary commit" created by the unshelve. From here, it's easy to accidentally create more commits on top of this temporary commit.

In this situation, I would expect "hg merge --abort" to fail, directing the user to use "hg unshelve --abort".

See the attachment for a test demonstrating this bug.
Comment 1 HG Bot 2019-07-09 20:20 UTC
Fixed by https://mercurial-scm.org/repo/hg/rev/b8d54f4625cb
Taapas Agrawal <taapas2897@gmail.com>
merge: disallow merge abort in case of an unfinished operation (issue6160)

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.

The patch adds a `cmdutil.getunfinishedstate` function which checks
for operations under progress and returns a `statecheck` object for it.

Differential Revision: https://phab.mercurial-scm.org/D6607

(please test the fix)
Comment 2 Bugzilla 2019-07-17 00:00 UTC
Bug was set to TESTING for 7 days, resolving