Mercurial > hg
changeset 44402:9b8e13a038db stable
histedit: py3 fixes for curses mode
Differential Revision: https://phab.mercurial-scm.org/D8150
author | Steve Fink <sfink@mozilla.com> |
---|---|
date | Tue, 25 Feb 2020 13:23:37 -0800 |
parents | 92b7caf4cb9e |
children | fca7caeaa6e7 |
files | hgext/histedit.py |
diffstat | 1 files changed, 13 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/histedit.py Sun Mar 01 19:39:23 2020 +0100 +++ b/hgext/histedit.py Tue Feb 25 13:23:37 2020 -0800 @@ -1645,7 +1645,7 @@ pass -def _chistedit(ui, repo, *freeargs, **opts): +def _chistedit(ui, repo, freeargs, opts): """interactively edit changeset history via a curses interface Provides a ncurses interface to histedit. Press ? in chistedit mode @@ -1717,8 +1717,8 @@ with repo.vfs(b'chistedit', b'w+') as fp: for r in rules: fp.write(r) - opts['commands'] = fp.name - return _texthistedit(ui, repo, *freeargs, **opts) + opts[b'commands'] = fp.name + return _texthistedit(ui, repo, freeargs, opts) except KeyboardInterrupt: pass return -1 @@ -1855,23 +1855,25 @@ for intentional "edit" command, but also for resolving unexpected conflicts). """ + opts = pycompat.byteskwargs(opts) + # kludge: _chistedit only works for starting an edit, not aborting # or continuing, so fall back to regular _texthistedit for those # operations. if ( ui.interface(b'histedit') == b'curses' - and _getgoal(pycompat.byteskwargs(opts)) == goalnew + and _getgoal(opts) == goalnew ): - return _chistedit(ui, repo, *freeargs, **opts) - return _texthistedit(ui, repo, *freeargs, **opts) - - -def _texthistedit(ui, repo, *freeargs, **opts): + return _chistedit(ui, repo, freeargs, opts) + return _texthistedit(ui, repo, freeargs, opts) + + +def _texthistedit(ui, repo, freeargs, opts): state = histeditstate(repo) with repo.wlock() as wlock, repo.lock() as lock: state.wlock = wlock state.lock = lock - _histedit(ui, repo, state, *freeargs, **opts) + _histedit(ui, repo, state, freeargs, opts) goalcontinue = b'continue' @@ -1952,8 +1954,7 @@ ) -def _histedit(ui, repo, state, *freeargs, **opts): - opts = pycompat.byteskwargs(opts) +def _histedit(ui, repo, state, freeargs, opts): fm = ui.formatter(b'histedit', opts) fm.startitem() goal = _getgoal(opts)