[PATCH 2 of 2 pager-tweaks] dispatch: consolidate pager flag handling to a single place
Martin von Zweigbergk
martinvonz at google.com
Mon Feb 20 03:24:51 EST 2017
On Sun, Feb 19, 2017 at 5:19 PM, Augie Fackler <raf at durin42.com> wrote:
> # HG changeset patch
> # User Augie Fackler <augie at google.com>
> # Date 1487553371 18000
> # Sun Feb 19 20:16:11 2017 -0500
> # Node ID 86a8d5ba8a05485fa1f90927c41ead4e7bb84b54
> # Parent 147cbbe59b257eac92c779361894ae361a788f83
> dispatch: consolidate pager flag handling to a single place
>
> This makes a little more sense, thanks to Martin for suggesting it.
And thanks for following up. Queued, thanks!
>
> diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
> --- a/mercurial/dispatch.py
> +++ b/mercurial/dispatch.py
> @@ -749,7 +749,10 @@ def _dispatch(req):
> for ui_ in uis:
> ui_.setconfig('ui', 'interactive', 'off', '-y')
>
> - if options['pager'] != 'auto' and not util.parsebool(options['pager']):
> + pagerbool = util.parsebool(options['pager'])
> + if pagerbool:
> + ui.pager('internal-always-' + cmd)
> + elif options['pager'] != 'auto' and not pagerbool:
pagerbool was tested above, so we know it's false here, so I dropped
the extra check in flight. Since that meant that pagerbool was used in
only one place, I also inlined the variable there.
> ui.disablepager()
>
> if cmdoptions.get('insecure', False):
> @@ -822,8 +825,6 @@ def _dispatch(req):
>
> def _runcommand(ui, options, cmd, cmdfunc):
> """Run a command function, possibly with profiling enabled."""
> - if util.parsebool(options['pager']):
> - ui.pager('internal-always-' + cmd)
> try:
> return cmdfunc()
> except error.SignatureError:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list