diff options
| author | Mike Frysinger <vapier@google.com> | 2019-07-10 15:42:30 -0400 |
|---|---|---|
| committer | Mike Frysinger <vapier@google.com> | 2019-07-11 01:30:18 +0000 |
| commit | ca540aed19bb89a4cd71de83ba123338e1e721f6 (patch) | |
| tree | b0a368eb98116602d239778d68e16256782524a8 /git_command.py | |
| parent | f88b2fe5699ed224ad693e22a4c26fb76b8befc8 (diff) | |
| download | git-repo-ca540aed19bb89a4cd71de83ba123338e1e721f6.tar.gz | |
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>
Diffstat (limited to 'git_command.py')
| -rw-r--r-- | git_command.py | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/git_command.py b/git_command.py index 1807b55e..54db4d16 100644 --- a/git_command.py +++ b/git_command.py | |||
| @@ -80,22 +80,12 @@ def terminate_ssh_clients(): | |||
| 80 | _git_version = None | 80 | _git_version = None |
| 81 | 81 | ||
| 82 | class _GitCall(object): | 82 | class _GitCall(object): |
| 83 | def version(self): | ||
| 84 | p = GitCommand(None, ['--version'], capture_stdout=True) | ||
| 85 | if p.Wait() == 0: | ||
| 86 | if hasattr(p.stdout, 'decode'): | ||
| 87 | return p.stdout.decode('utf-8') | ||
| 88 | else: | ||
| 89 | return p.stdout | ||
| 90 | return None | ||
| 91 | |||
| 92 | def version_tuple(self): | 83 | def version_tuple(self): |
| 93 | global _git_version | 84 | global _git_version |
| 94 | if _git_version is None: | 85 | if _git_version is None: |
| 95 | ver_str = git.version() | 86 | _git_version = Wrapper().ParseGitVersion() |
| 96 | _git_version = Wrapper().ParseGitVersion(ver_str) | ||
| 97 | if _git_version is None: | 87 | if _git_version is None: |
| 98 | print('fatal: "%s" unsupported' % ver_str, file=sys.stderr) | 88 | print('fatal: unable to detect git version', file=sys.stderr) |
| 99 | sys.exit(1) | 89 | sys.exit(1) |
| 100 | return _git_version | 90 | return _git_version |
| 101 | 91 | ||
