Bug 2312 - color extension broken on win32 with hg 1.6.1
Summary: color extension broken on win32 with hg 1.6.1
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: unspecified
Hardware: All All
: normal bug
Assignee: brodie
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-01 13:53 UTC by Pascal Quantin
Modified: 2010-08-06 15:00 UTC (History)
6 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pascal Quantin 2010-08-01 13:53 UTC
With color extension activated on a windows box, a simple hg version raises
the following backtrace:
@ Dev> hg version
Traceback (most recent call last):
  File "hg", line 27, in <module>
  File "mercurial\dispatch.pyc", line 16, in run
  File "mercurial\dispatch.pyc", line 34, in dispatch
  File "mercurial\dispatch.pyc", line 165, in _runcatch
  File "mercurial\ui.pyc", line 505, in warn
  File "hgext\color.pyc", line 166, in write_err
NameError: global name 'orig' is not defined

The culprit seems to be changeset d8d0fc3988ca
Comment 1 Dirkjan Ochtman 2010-08-01 14:08 UTC
Ugh, that sounds pretty bad. Quick 1.6.2?
Comment 2 brodie 2010-08-01 14:23 UTC
Can you test this?

diff -r 56b41b2cc690 hgext/color.py
--- a/hgext/color.py	Sun Aug 01 13:49:43 2010 -0500
+++ b/hgext/color.py	Sun Aug 01 16:21:50 2010 -0400
@@ -154,7 +154,7 @@ class colorui(uimod.ui):
             self._buffers[-1].extend([(str(a), label) for a in args])
         elif self._colormode == 'win32':
             for a in args:
-                win32print(a, orig, **opts)
+                win32print(a, super(colorui, self).write, **opts)
         else:
             return super(colorui, self).write(
                 *[self.label(str(a), label) for a in args], **opts)
@@ -163,7 +163,7 @@ class colorui(uimod.ui):
         label = opts.get('label', '')
         if self._colormode == 'win32':
             for a in args:
-                win32print(a, orig, **opts)
+                win32print(a, super(colorui, self).write_err, **opts)
         else:
             return super(colorui, self).write(
                 *[self.label(str(a), label) for a in args], **opts)
Comment 3 Pascal Quantin 2010-08-01 14:30 UTC
Hi Brodie,
your patch is working fine.
Comment 4 HG Bot 2010-08-06 15:00 UTC
Fixed by http://hg.intevation.org/mercurial/crew/rev/c34a1ab80550
Brodie Rao <brodie@bitheap.org>
color: pass write/write_err to win32print correctly (issue2312)
Comment 5 Bugzilla 2012-05-12 09:11 UTC

--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:11 EDT  ---

This bug was previously known as _bug_ 2312 at http://mercurial.selenic.com/bts/issue2312