diff --git a/hgext3rd/interactiveui.py b/hgext3rd/interactiveui.py --- a/hgext3rd/interactiveui.py +++ b/hgext3rd/interactiveui.py @@ -12,6 +12,12 @@ import termios import tty +from mercurial.i18n import _ + +from mercurial import ( + error, +) + def clearline(): w = sys.stdout # ANSI @@ -107,8 +113,10 @@ def view(viewobj): done = False + if viewobj.ui.pageractive: + raise error.Abort(_("interactiveui doesn't work with pager")) s = viewobj.render() - print(s) + sys.stdout.write(s) while not done: output = getchar(sys.stdin.fileno()) if repr(output) == '\'q\'': @@ -123,7 +131,7 @@ viewobj.rightarrow() if repr(output) == '\'\\x1b[D\'': viewobj.leftarrow() - for i in range(len(s.split("\n"))): + for i in range(len(s.split("\n")) - 1): clearline() s = viewobj.render() - print(s) + sys.stdout.write(s) diff --git a/hgext3rd/undo.py b/hgext3rd/undo.py --- a/hgext3rd/undo.py +++ b/hgext3rd/undo.py @@ -653,6 +653,10 @@ ui = self.ui ui.pushbuffer() _preview(ui, self.repo, self.index) + repo.ui.status(_("left arrow for next, " + "right arrow for previous, " + "enter for goto, " + "q for quit\n")) return ui.popbuffer() def rightarrow(self): self.index += 1 @@ -862,8 +866,8 @@ commandstr = _readnode(repo, "command.i", nodedict["command"]) commandlist = commandstr.split("\0")[1:] commandstr = " ".join(commandlist) - uimessage = 'undone to %s, before %s\n' % (time, commandstr) - repo.ui.status(_(uimessage)) + uimessage = _('undone to %s, before %s\n') % (time, commandstr) + repo.ui.status((uimessage)) def _computerelative(repo, reverseindex, absolute=False, branch=""): # allows for relative undos using @@ -1069,6 +1073,9 @@ # None # override "UNDOINDEX" as a variable usable in template + if not _gapcheck(ui, repo, reverseindex): + repo.ui.status(_("WARN: missing history between present and this" + " state\n")) overrides = { ('templates', 'UNDOINDEX'): str(reverseindex), } @@ -1082,6 +1089,17 @@ try: with ui.configoverride(overrides): cmdutil.graphlog(ui, repo, None, opts) + # informative output + nodedict = _readindex(repo, reverseindex) + time = _readnode(repo, "date.i", nodedict["date"]) + time = util.datestr([float(x) for x in time.split(" ")]) + + nodedict = _readindex(repo, reverseindex - 1) + commandstr = _readnode(repo, "command.i", nodedict["command"]) + commandlist = commandstr.split("\0")[1:] + commandstr = " ".join(commandlist) + uimessage = _('undo to %s, before %s\n') % (time, commandstr) + repo.ui.status((uimessage)) except IndexError: # don't print anything pass