Changes redo to straight up undo the previous undo. This is a bit trickier than
it may seem. The previous redo capabilities are still covered in hg undo as
--index accepts negative numbers allowing you to step both forward and
backwards one step at a time. The new redo reads the linear undo log to find
out where to undo to while updating the undo/redo index allowing you to continue
from where you left off.
Details
- Reviewers
quark - Group Reviewers
Restricted Project - Commits
- rFBHGX916de186acdc: undo: no argument redo
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
hgext3rd/undo.py | ||
---|---|---|
585 | I want to allow hg undo --index -1 --branch #. Not only is this somewhat useful for the user, it allows for interactive branch undoes if I ever want to add that. (--index -1 is stepping one repo state forward) |
The test looks solid. Great!
Parsing the undo command line flags manually could easily miss corner cases. I'd suggest use what Mercurial actually uses:
opts = {} mercurial.fancyopts.fancyopts(['--ind=4', '-fa'], cmdtable['undo'][1], opts) opts # {'absolute': True, 'branch': '', 'force': True, 'index': 4, 'keep': False}
hgext3rd/undo.py | ||
---|---|---|
677–686 | --index=4 is also a valid way to provide the flag. | |
692–695 | Could be simplify to if i in ('-a', '--absolute'): |
Second and reverseindex != -1 is not necessary