This is an archive of the discontinued Mercurial Phabricator instance.

undo: basic single repo undo
ClosedPublic

Authored by felixmerk on Jul 20 2017, 6:20 PM.
Tags
None
Subscribers

Details

Reviewers
stash
Group Reviewers
Restricted Project
Commits
rFBHGX0ad0bc61a332: undo: basic single repo undo
Summary

Add the ability to undo changes within one 'localbranch'. In the future, this
will probably become default behavior. Undo -b changecontext will undo changes
belonging to the local branch identified by the changecontext (see revset
localbranch). Based on obs markers we can identify connected commits that we
in turn reveal or hide outside of this localbranch. This undo allows users to
work on multiple branches independantly.

Currently, indexing for undoes is still on the repo level. This isn't good
from a ux experience. Next up would be localbranch level indexing logic and
redo logic.

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.Jul 20 2017, 6:20 PM
Herald added a reviewer: Restricted Project. · View Herald TranscriptJul 20 2017, 6:20 PM
felixmerk updated this revision to Diff 385.Jul 21 2017, 7:08 PM
stash accepted this revision.Jul 25 2017, 1:28 PM
stash added a subscriber: stash.

This LGTM, I'll let you decide what to do with bookmark movements.
Also consider renaming variables to make it clear whethere it's a binnode or hash node

hgext3rd/undo.py
526–533

I'm not sure if your code handles this case, but bookmark can have '\n' inside.

537–551

Do I understand correctly that if bookmark was moved from some commit outside of localbranch back to commit in localbranch then this bookmark will just be deleted? Is that what we want? I think it's better to return this bookmark to the previous location

557–560

It's unclear for me when do you need to use bin(...) and when you don't. I usually try to use names like hexnode or binnode to make it clear. No need to change it in this diff, but would be cool to do it in the separate diff

This revision is now accepted and ready to land.Jul 25 2017, 1:28 PM
felixmerk added inline comments.Jul 25 2017, 2:29 PM
hgext3rd/undo.py
526–533

I'm under the impression that bookmarks can not have '\n' inside. I ran the following using python to illustrate this:

>>> subprocess.check_call(['hg', 'bookmark', 'abc\ndef'])
abort: '\n' cannot be used in a name

537–551

That does make more sense behavior wise. I'll make the change.

557–560

Good call

stash added inline comments.Jul 25 2017, 5:32 PM
hgext3rd/undo.py
526–533

Oh, ok, for some reason I thought it's possible. Thanks for checking!

felixmerk updated this revision to Diff 404.Jul 25 2017, 6:17 PM
felixmerk updated this revision to Diff 405.Jul 25 2017, 6:30 PM
felixmerk updated this revision to Diff 418.Jul 26 2017, 6:39 PM
felixmerk updated this revision to Diff 421.Jul 26 2017, 8:27 PM
felixmerk updated this revision to Diff 463.Jul 31 2017, 6:04 PM
felixmerk updated this revision to Diff 476.Aug 1 2017, 2:20 PM
felixmerk updated this revision to Diff 508.Aug 2 2017, 4:31 PM
This revision was automatically updated to reflect the committed changes.