Mercurial > hg
changeset 21277:2bc778e2f9b3
pager: break pager invocation out of command check loop
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 09 May 2014 12:58:53 -0500 |
parents | 25b7c760235a |
children | e1f5f38fd944 |
files | hgext/pager.py |
diffstat | 1 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/pager.py Thu May 08 11:11:27 2014 -0500 +++ b/hgext/pager.py Fri May 09 12:58:53 2014 -0500 @@ -116,8 +116,11 @@ def pagecmd(orig, ui, options, cmd, cmdfunc): p = ui.config("pager", "pager", os.environ.get("PAGER")) + usepager = False - if p: + if not p: + pass + else: attend = ui.configlist('pager', 'attend', attended) auto = options['pager'] == 'auto' always = util.parsebool(options['pager']) @@ -129,12 +132,15 @@ if (always or auto and (cmd in attend or (cmd not in ignore and not attend))): - ui.setconfig('ui', 'formatted', ui.formatted(), 'pager') - ui.setconfig('ui', 'interactive', False, 'pager') - if util.safehasattr(signal, "SIGPIPE"): - signal.signal(signal.SIGPIPE, signal.SIG_DFL) - _runpager(ui, p) + usepager = True break + + if usepager: + ui.setconfig('ui', 'formatted', ui.formatted(), 'pager') + ui.setconfig('ui', 'interactive', False, 'pager') + if util.safehasattr(signal, "SIGPIPE"): + signal.signal(signal.SIGPIPE, signal.SIG_DFL) + _runpager(ui, p) return orig(ui, options, cmd, cmdfunc) extensions.wrapfunction(dispatch, '_runcommand', pagecmd)