This is an archive of the discontinued Mercurial Phabricator instance.

undo: add --keep to maintian working copy changes
ClosedPublic

Authored by felixmerk on Jul 11 2017, 8:00 PM.
Tags
None
Subscribers

Details

Reviewers
quark
Group Reviewers
Restricted Project
Commits
rFBHGX720575ccec6b: undo: add --keep to maintian working copy changes
Summary

Allow user to keep working copy changes after undo, mimicking unamend and
uncommit behavior. As discussed at the team lunch, this allows undo to remain
ignorant of what command the user has run while conforming to user expectations.
In the future this could be done in a smarter way where we properly restore hg
status dynamically.

Diff Detail

Repository
rFBHGX Facebook Mercurial Extensions
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

felixmerk created this revision.Jul 11 2017, 8:00 PM
phillco added inline comments.
hgext3rd/undo.py
383–384

Should we describe the downsides of this flag too?

384

specifically :)

385

exist

386

working copy

felixmerk updated this revision to Diff 108.Jul 13 2017, 12:41 AM
felixmerk added a reviewer: Restricted Project.Jul 13 2017, 12:43 AM
felixmerk updated this revision to Diff 109.Jul 13 2017, 2:09 AM
felixmerk added inline comments.Jul 13 2017, 2:12 AM
hgext3rd/undo.py
383–384

Yes. The major downside is that it makes redo non-trivial for the user as they need to clean up the working copy beforehand. There's also potentially some performance cost to --keep in the case of a large working copy.

felixmerk updated this revision to Diff 317.Jul 19 2017, 5:31 PM
quark added a subscriber: quark.Jul 19 2017, 6:26 PM
quark added inline comments.
hgext3rd/undo.py
496

Why is the obsolete.createmarkers vs revealcommits difference? I think the behavior should be the same regardless.

felixmerk added inline comments.Jul 19 2017, 6:34 PM
hgext3rd/undo.py
496

Fundamentally, its because there isn't a connection between two (arbitrary) working copy parents. With the --keep flag though, the user is heavily implying that there is a very strong connection between the two. Granted, the user can use --keep for really "weird" operations, but I think the obs marker is allowed to reflect that.

That being said, I can remove line 491 (revealcommits), since update will not fail to hidden commit, and that commit should be revealed later anyway.

quark accepted this revision.Jul 19 2017, 6:50 PM
quark added inline comments.
hgext3rd/undo.py
496

I noticed these lines are removed in the next diff. So the end result looks good to me.

I think line 491 is still necessary since visibility and obsolesce are different. We need to make the changeset "not obsoleted", hence the revive part. With fbamend, update could "unhide" the commit, but it won't "unobsolete" a commit.

This revision is now accepted and ready to land.Jul 19 2017, 6:50 PM
felixmerk updated this revision to Diff 325.Jul 19 2017, 8:45 PM
This revision was automatically updated to reflect the committed changes.