Decode git version

Used by 'repo --version'
With Python 3,
* Before: b'git version 2.1.0'
* After: git version 2.1.0

Change-Id: I4321bb0f09e92cda1123c35910338b940e82a305
This commit is contained in:
Chirayu Desai 2014-08-20 09:34:10 +05:30
parent 303a82f33a
commit c46de6932a

View File

@ -80,13 +80,13 @@ class _GitCall(object):
def version(self): def version(self):
p = GitCommand(None, ['--version'], capture_stdout=True) p = GitCommand(None, ['--version'], capture_stdout=True)
if p.Wait() == 0: if p.Wait() == 0:
return p.stdout return p.stdout.decode('utf-8')
return None return None
def version_tuple(self): def version_tuple(self):
global _git_version global _git_version
if _git_version is None: if _git_version is None:
ver_str = git.version().decode('utf-8') ver_str = git.version()
_git_version = Wrapper().ParseGitVersion(ver_str) _git_version = Wrapper().ParseGitVersion(ver_str)
if _git_version is None: if _git_version is None:
print('fatal: "%s" unsupported' % ver_str, file=sys.stderr) print('fatal: "%s" unsupported' % ver_str, file=sys.stderr)