1
0
mirror of https://github.com/golang/go synced 2024-11-25 07:57:56 -07:00

codereview: fix hg change in Windows console

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
This commit is contained in:
Yasuhiro Matsumoto 2011-10-05 12:07:13 -04:00 committed by Russ Cox
parent a55de2ba61
commit 319dba4750

View 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]