[PATCH 3 of 3] [RFC] dispatch: setup color before pager
Augie Fackler
raf at durin42.com
Tue Mar 21 17:36:29 EDT 2017
On Mon, Mar 20, 2017 at 12:53:19AM -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1489985511 14400
> # Mon Mar 20 00:51:51 2017 -0400
> # Node ID 2a323109f8e7ec5548dd506c2cff05f27fa20c1e
> # Parent 6e72bb689e57c985b138c580acb4cad8053dc180
> [RFC] dispatch: setup color before pager
Oy, these two I just dunno. I'll defer to other Windows experts.
>
> With the previous order, color was None for commands invoked with --pager=yes at
> the time the pager was spawned, which meant the switch over to ANSI mode on
> Windows didn't occur. That left the color.win32print() in 'auto' mode, which
> meant no color in the pager output. Non Windows platforms are capable of
> printing color with this option.
>
> diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
> --- a/mercurial/dispatch.py
> +++ b/mercurial/dispatch.py
> @@ -760,6 +760,13 @@
> for ui_ in uis:
> ui_.setconfig('ui', 'interactive', 'off', '-y')
>
> + # setup color handling
> + coloropt = options['color']
> + for ui_ in uis:
> + if coloropt:
> + ui_.setconfig('ui', 'color', coloropt, '--color')
> + color.setup(ui_)
> +
> if util.parsebool(options['pager']):
> ui.pager('internal-always-' + cmd)
> elif options['pager'] != 'auto':
> @@ -769,13 +776,6 @@
> for ui_ in uis:
> ui_.insecureconnections = True
>
> - # setup color handling
> - coloropt = options['color']
> - for ui_ in uis:
> - if coloropt:
> - ui_.setconfig('ui', 'color', coloropt, '--color')
> - color.setup(ui_)
> -
> if options['version']:
> return commands.version_(ui)
> if options['help']:
> _______________________________________________
> 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