This is an archive of the discontinued Mercurial Phabricator instance.

undo: preview shows command and time output
ClosedPublic

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

Details

Reviewers
quark
Group Reviewers
Restricted Project
Commits
rFBHGX5d49a9e813ae: undo: preview shows command and time output
Summary

Makes hg undo -i and hg undo -p output show an "undo to time, before command"
message and adds directions (left, right, return, q). Also adds pager check as
pager break interactiveui.

Testing: run hg undo -p and hg undo -i and see output

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 18 2017, 7:18 PM
Herald added a reviewer: Restricted Project. · View Herald TranscriptAug 18 2017, 7:18 PM
felixmerk updated this revision to Diff 1082.Aug 18 2017, 7:19 PM
quark accepted this revision.Aug 18 2017, 9:34 PM
quark added a subscriber: quark.
quark added inline comments.
hgext3rd/interactiveui.py
26–27

Maybe make 1 as an argument, ex: clearline(n=1) and '\033[%dA\033[K' % n

134–135

Then you can get rid of the for loop:

clearline(s.count('\n'))
hgext3rd/undo.py
656–658

The crecord interface uses key: effect pattern. Maybe use the same:

<-: next  ->: previous  q: abort  enter: confirm
This revision is now accepted and ready to land.Aug 18 2017, 9:34 PM
felixmerk updated this revision to Diff 1127.Aug 21 2017, 2:22 PM
quark added inline comments.Aug 21 2017, 2:29 PM
hgext3rd/interactiveui.py
26–28

I meant this could be simplified to:

w.write('\033[%dA\033[K' % n)

without a for loop. Have you tried that?

felixmerk added inline comments.Aug 21 2017, 2:38 PM
hgext3rd/interactiveui.py
26–28

\033[K clears a single line. I also don't want to clear to the end of the screen.

quark added inline comments.Aug 21 2017, 3:16 PM
hgext3rd/interactiveui.py
26–28

I see. This turns out to be an area that my local Linux terminal behaviors differently (it does not even require \033K to clear lines).

I checked another project. It does \033[%dA first to move up multiple lines. Then change the output string - insert \033[K for each line.

That seems better to avoid flashing. Maybe we can try that?

This revision was automatically updated to reflect the committed changes.