diff options
author | Mike Frysinger <vapier@google.com> | 2019-09-30 22:46:45 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@google.com> | 2019-10-01 05:47:35 +0000 |
commit | 9bfdfbe117d16107e07e1c376fec8eb245aab424 (patch) | |
tree | 121bf9495b48f1175f97caca0ba21e1024c10786 /subcmds/version.py | |
parent | 2f0951b216489ecbd0a28935ca589fb0067a8381 (diff) | |
download | git-repo-9bfdfbe117d16107e07e1c376fec8eb245aab424.tar.gz |
version: add source versions & User-Agents to the output
Depending on where/how repo is invoked, the active version might be
from a git tree, and it might be different from the .repo/repo.git/
version in the current repo client checkout. Report both if they're
different so it's clearer.
Lets also include the two different User-Agent's that we set up when
talking to networked services.
Bug: https://crbug.com/gerrit/11144
Change-Id: I2ebb6e3ac30e374a8406cab3e4438087246a8c57
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/239234
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'subcmds/version.py')
-rw-r--r-- | subcmds/version.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/subcmds/version.py b/subcmds/version.py index 9fb694df..761172b7 100644 --- a/subcmds/version.py +++ b/subcmds/version.py | |||
@@ -17,7 +17,7 @@ | |||
17 | from __future__ import print_function | 17 | from __future__ import print_function |
18 | import sys | 18 | import sys |
19 | from command import Command, MirrorSafeCommand | 19 | from command import Command, MirrorSafeCommand |
20 | from git_command import git | 20 | from git_command import git, RepoSourceVersion, user_agent |
21 | from git_refs import HEAD | 21 | from git_refs import HEAD |
22 | 22 | ||
23 | class Version(Command, MirrorSafeCommand): | 23 | class Version(Command, MirrorSafeCommand): |
@@ -34,12 +34,20 @@ class Version(Command, MirrorSafeCommand): | |||
34 | rp = self.manifest.repoProject | 34 | rp = self.manifest.repoProject |
35 | rem = rp.GetRemote(rp.remote.name) | 35 | rem = rp.GetRemote(rp.remote.name) |
36 | 36 | ||
37 | print('repo version %s' % rp.work_git.describe(HEAD)) | 37 | # These might not be the same. Report them both. |
38 | src_ver = RepoSourceVersion() | ||
39 | rp_ver = rp.bare_git.describe(HEAD) | ||
40 | print('repo version %s' % rp_ver) | ||
38 | print(' (from %s)' % rem.url) | 41 | print(' (from %s)' % rem.url) |
39 | 42 | ||
40 | if Version.wrapper_path is not None: | 43 | if Version.wrapper_path is not None: |
41 | print('repo launcher version %s' % Version.wrapper_version) | 44 | print('repo launcher version %s' % Version.wrapper_version) |
42 | print(' (from %s)' % Version.wrapper_path) | 45 | print(' (from %s)' % Version.wrapper_path) |
43 | 46 | ||
47 | if src_ver != rp_ver: | ||
48 | print(' (currently at %s)' % src_ver) | ||
49 | |||
50 | print('repo User-Agent %s' % user_agent.repo) | ||
44 | print('git %s' % git.version_tuple().full) | 51 | print('git %s' % git.version_tuple().full) |
52 | print('git User-Agent %s' % user_agent.git) | ||
45 | print('Python %s' % sys.version) | 53 | print('Python %s' % sys.version) |