Patchwork [6,of,8,V2] color: pass 'ui' to 'win32print'

login
register
mail settings
Submitter Pierre-Yves David
Date Feb. 28, 2017, 10:54 a.m.
Message ID <b29fb424dbc9e6fc13c3.1488279270@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/18834/
State Accepted
Delegated to: Martin von Zweigbergk
Headers show

Comments

Pierre-Yves David - Feb. 28, 2017, 10:54 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1478459453 -3600
#      Sun Nov 06 20:10:53 2016 +0100
# Node ID b29fb424dbc9e6fc13c369c34277e3fb36284cd4
# Parent  244883d4b3dcd860631dde2fb2610ad3d8b52139
# EXP-Topic color
color: pass 'ui' to 'win32print'

Same logic as before,'win32print' relies on some data we will move on the 'ui'
object soon, we update the API beforehand for clarity.

Patch

diff --git a/mercurial/color.py b/mercurial/color.py
--- a/mercurial/color.py
+++ b/mercurial/color.py
@@ -423,11 +423,11 @@  if pycompat.osname == 'nt':
             ansire = re.compile('\033\[([^m]*)m([^\033]*)(.*)',
                                 re.MULTILINE | re.DOTALL)
 
-    def win32print(writefunc, *msgs, **opts):
+    def win32print(ui, writefunc, *msgs, **opts):
         for text in msgs:
-            _win32print(text, writefunc, **opts)
+            _win32print(ui, text, writefunc, **opts)
 
-    def _win32print(text, writefunc, **opts):
+    def _win32print(ui, text, writefunc, **opts):
         label = opts.get('label', '')
         attr = origattr
 
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -805,7 +805,7 @@  class ui(object):
         elif self._colormode == 'win32':
             # windows color printing is its own can of crab, defer to
             # the color module and that is it.
-            color.win32print(self._write, *args, **opts)
+            color.win32print(self, self._write, *args, **opts)
         else:
             msgs = args
             if self._colormode is not None:
@@ -831,7 +831,7 @@  class ui(object):
         elif self._colormode == 'win32':
             # windows color printing is its own can of crab, defer to
             # the color module and that is it.
-            color.win32print(self._write_err, *args, **opts)
+            color.win32print(self, self._write_err, *args, **opts)
         else:
             msgs = args
             if self._colormode is not None: