]> Cypherpunks repositories - gostls13.git/commitdiff
codereview: fix hg change in Windows console
authorYasuhiro Matsumoto <mattn.jp@gmail.com>
Wed, 5 Oct 2011 16:07:13 +0000 (12:07 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 5 Oct 2011 16:07:13 +0000 (12:07 -0400)
lib/codereview: Unable to use vim for 'hg change' from windows console
reload(sys) break workaround for windows.
see:
http://mercurial.selenic.com/bts/issue2888
http://mercurial.selenic.com/bts/issue1452
Also does not work with backslash paths.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5150054

lib/codereview/codereview.py

index 22b08ad0d60c72981f14fbcfdf266753dc7e7a7e..6b51256628564e045f75f7fe26b4b778338b91e1 100644 (file)
@@ -185,7 +185,9 @@ set_mercurial_encoding_to_utf8()
 # encoding for all of Python to 'utf-8', not 'ascii'.
 def default_to_utf8():
        import sys
+       stdout, __stdout__ = sys.stdout, sys.__stdout__
        reload(sys)  # site.py deleted setdefaultencoding; get it back
+       sys.stdout, sys.__stdout__ = stdout, __stdout__
        sys.setdefaultencoding('utf-8')
 
 default_to_utf8()
@@ -3216,7 +3218,7 @@ class MercurialVCS(VersionControlSystem):
                        #       A path
                        #       M path
                        # etc
-                       line = self.status[i]
+                       line = self.status[i].replace('\\', '/')
                        if line[2:] == path:
                                if i+1 < len(self.status) and self.status[i+1][:2] == '  ':
                                        return self.status[i:i+2]