Patchwork [06,of,13,V2] color: clarify name of an argument of 'win32print'

login
register
mail settings
Submitter Pierre-Yves David
Date Feb. 24, 2017, 10:09 p.m.
Message ID <a13f493b42dd655ebed3.1487974180@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/18759/
State Accepted
Headers show

Comments

Pierre-Yves David - Feb. 24, 2017, 10:09 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1487968307 -3600
#      Fri Feb 24 21:31:47 2017 +0100
# Node ID a13f493b42dd655ebed3d291181510e2607b9512
# Parent  fd0b7fed70ddeaf0568b02d5e0f9d982a68f1cb4
# EXP-Topic color
color: clarify name of an argument of 'win32print'

In the current code, the function called to write happens to the 'orig' version
of the method calling 'win32print' (obtained with a 'super' call). However, the
variable could have a better name. That will be useful when we'll stop having
inheritance in play.

Patch

diff -r fd0b7fed70dd -r a13f493b42dd mercurial/color.py
--- a/mercurial/color.py	Thu Feb 23 19:45:32 2017 +0100
+++ b/mercurial/color.py	Fri Feb 24 21:31:47 2017 +0100
@@ -288,7 +288,7 @@  if pycompat.osname == 'nt':
             ansire = re.compile('\033\[([^m]*)m([^\033]*)(.*)',
                                 re.MULTILINE | re.DOTALL)
 
-    def win32print(text, orig, **opts):
+    def win32print(text, writefunc, **opts):
         label = opts.get('label', '')
         attr = origattr
 
@@ -325,7 +325,7 @@  if pycompat.osname == 'nt':
                     if sattr:
                         attr = mapcolor(int(sattr), attr)
                 _kernel32.SetConsoleTextAttribute(stdout, attr)
-                orig(m.group(2), **opts)
+                writefunc(m.group(2), **opts)
                 m = re.match(ansire, m.group(3))
         finally:
             # Explicitly reset original attributes