git_command: drop custom version helper
Since ParseGitVersion can call `git --version` automatically, we don't
need this duplicate version() helper anymore. The only other user is
the `repo version` code, so convert that to version_tuple().full.
Bug: https://crbug.com/gerrit/11144
Change-Id: I9d77822fc39f4ba28884d9183359169cabf5f17d
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/231055
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Tested-by: Mike Frysinger <vapier@google.com>
diff --git a/git_command.py b/git_command.py
index 1807b55..54db4d1 100644
--- a/git_command.py
+++ b/git_command.py
@@ -80,22 +80,12 @@
_git_version = None
class _GitCall(object):
- def version(self):
- p = GitCommand(None, ['--version'], capture_stdout=True)
- if p.Wait() == 0:
- if hasattr(p.stdout, 'decode'):
- return p.stdout.decode('utf-8')
- else:
- return p.stdout
- return None
-
def version_tuple(self):
global _git_version
if _git_version is None:
- ver_str = git.version()
- _git_version = Wrapper().ParseGitVersion(ver_str)
+ _git_version = Wrapper().ParseGitVersion()
if _git_version is None:
- print('fatal: "%s" unsupported' % ver_str, file=sys.stderr)
+ print('fatal: unable to detect git version', file=sys.stderr)
sys.exit(1)
return _git_version