# HG changeset patch
# User Matt Harbison <matt_harbi...@yahoo.com>
# Date 1489985511 14400
#      Mon Mar 20 00:51:51 2017 -0400
# Node ID 2a323109f8e7ec5548dd506c2cff05f27fa20c1e
# Parent  6e72bb689e57c985b138c580acb4cad8053dc180
[RFC] dispatch: setup color before pager

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@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to