This is an archive of the discontinued Mercurial Phabricator instance.

undo: unfinished command handling
ClosedPublic

Authored by felixmerk on Aug 15 2017, 7:46 PM.
Tags
None
Subscribers

Details

Reviewers
quark
Group Reviewers
Restricted Project
Commits
rFBHGXa6e1cbdde822: undo: unfinished command handling
Summary

hg rebase, histedit, unshelve and other commands may stop in an unfinished state
because of merge conflicts or other reasons. The user then has the ability to
continue or abort. Undoing in this case is slightly tricky as for example
aborting a rebase will perform real strips and so undo will fail with an error.
This change still records these states, but flags them as unfinished and skips
over them when undoing and redoing. Hg undo --absolute does not ignore these
states in the really unlikely situation you want to go to one of them.

Diff Detail

Repository
rFBHGX Facebook Mercurial Extensions
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

felixmerk created this revision.Aug 15 2017, 7:46 PM
Herald added a reviewer: Restricted Project. · View Herald TranscriptAug 15 2017, 7:46 PM
quark requested changes to this revision.Aug 15 2017, 9:40 PM
quark added a subscriber: quark.
quark added inline comments.
hgext3rd/undo.py
81

I think InterventionRequired is not the only cause of "unfinished" state. We probably want to have a similar check like cmdutil.checkunfinished to mark things as "unfinished". That covers wider cases than just InterventionRequired.

90–91

Maybe add a new state to undolog, like:

safelog(repo, command, unfinished=unfinished)
179

Append:

'unfinished': (unfinished and '1' or '0')

here.

This revision now requires changes to proceed.Aug 15 2017, 9:40 PM
felixmerk added inline comments.Aug 16 2017, 4:43 PM
hgext3rd/undo.py
81

Sure, I can add a checkunfinished, but the exception is still thrown. I need to explicitly catch every exception that causes and unfinished state as otherwise I won't be able to checkunfinished. I guess I could catch all exceptions, but I'm not sure that this would be safe?

felixmerk edited edge metadata.Aug 16 2017, 8:19 PM
felixmerk updated this revision to Diff 1021.
quark accepted this revision.Aug 18 2017, 11:02 AM

Looks good to me. Sorry for missing this one.

This revision is now accepted and ready to land.Aug 18 2017, 11:02 AM
This revision was automatically updated to reflect the committed changes.