Bug 935741 - Use HGPLAIN to fix version detection of non-English Mercurial releases. r=gps

This commit is contained in:
Maurizio De Santis 2013-11-11 16:13:53 -05:00
Родитель df3119e8a5
Коммит b8fd94c582
1 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@ -189,13 +189,24 @@ class BaseBootstrapper(object):
This should be defined in child classes.
"""
def _hgplain_env(self):
""" Returns a copy of the current environment updated with the HGPLAIN
environment variable.
HGPLAIN prevents Mercurial from applying locale variations to the output
making it suitable for use in scripts.
"""
env = os.environ.copy()
env['HGPLAIN'] = '1'
return env
def is_mercurial_modern(self):
hg = self.which('hg')
if not hg:
print(NO_MERCURIAL)
return False, False, None
info = self.check_output([hg, '--version']).splitlines()[0]
info = self.check_output([hg, '--version'], env=self._hgplain_env()).splitlines()[0]
match = re.search('version ([^\+\)]+)', info)
if not match: