diff options
author | Gavin Mak <gavinmak@google.com> | 2023-03-11 06:46:20 +0000 |
---|---|---|
committer | LUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-03-22 17:46:28 +0000 |
commit | ea2e330e43c182dc16b0111ebc69ee5a71ee4ce1 (patch) | |
tree | dc33ba0e56825b3e007d0589891756724725a465 /subcmds/version.py | |
parent | 1604cf255f8c1786a23388db6d5277ac7949a24a (diff) | |
download | git-repo-ea2e330e43c182dc16b0111ebc69ee5a71ee4ce1.tar.gz |
Format codebase with black and check formatting in CQ
Apply rules set by https://gerrit-review.googlesource.com/c/git-repo/+/362954/ across the codebase and fix any lingering errors caught
by flake8. Also check black formatting in run_tests (and CQ).
Bug: b/267675342
Change-Id: I972d77649dac351150dcfeb1cd1ad0ea2efc1956
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/363474
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Diffstat (limited to 'subcmds/version.py')
-rw-r--r-- | subcmds/version.py | 75 |
1 files changed, 41 insertions, 34 deletions
diff --git a/subcmds/version.py b/subcmds/version.py index c68cb0af..c539db63 100644 --- a/subcmds/version.py +++ b/subcmds/version.py | |||
@@ -22,45 +22,52 @@ from wrapper import Wrapper | |||
22 | 22 | ||
23 | 23 | ||
24 | class Version(Command, MirrorSafeCommand): | 24 | class Version(Command, MirrorSafeCommand): |
25 | wrapper_version = None | 25 | wrapper_version = None |
26 | wrapper_path = None | 26 | wrapper_path = None |
27 | 27 | ||
28 | COMMON = False | 28 | COMMON = False |
29 | helpSummary = "Display the version of repo" | 29 | helpSummary = "Display the version of repo" |
30 | helpUsage = """ | 30 | helpUsage = """ |
31 | %prog | 31 | %prog |
32 | """ | 32 | """ |
33 | 33 | ||
34 | def Execute(self, opt, args): | 34 | def Execute(self, opt, args): |
35 | rp = self.manifest.repoProject | 35 | rp = self.manifest.repoProject |
36 | rem = rp.GetRemote() | 36 | rem = rp.GetRemote() |
37 | branch = rp.GetBranch('default') | 37 | branch = rp.GetBranch("default") |
38 | 38 | ||
39 | # These might not be the same. Report them both. | 39 | # These might not be the same. Report them both. |
40 | src_ver = RepoSourceVersion() | 40 | src_ver = RepoSourceVersion() |
41 | rp_ver = rp.bare_git.describe(HEAD) | 41 | rp_ver = rp.bare_git.describe(HEAD) |
42 | print('repo version %s' % rp_ver) | 42 | print("repo version %s" % rp_ver) |
43 | print(' (from %s)' % rem.url) | 43 | print(" (from %s)" % rem.url) |
44 | print(' (tracking %s)' % branch.merge) | 44 | print(" (tracking %s)" % branch.merge) |
45 | print(' (%s)' % rp.bare_git.log('-1', '--format=%cD', HEAD)) | 45 | print(" (%s)" % rp.bare_git.log("-1", "--format=%cD", HEAD)) |
46 | 46 | ||
47 | if self.wrapper_path is not None: | 47 | if self.wrapper_path is not None: |
48 | print('repo launcher version %s' % self.wrapper_version) | 48 | print("repo launcher version %s" % self.wrapper_version) |
49 | print(' (from %s)' % self.wrapper_path) | 49 | print(" (from %s)" % self.wrapper_path) |
50 | 50 | ||
51 | if src_ver != rp_ver: | 51 | if src_ver != rp_ver: |
52 | print(' (currently at %s)' % src_ver) | 52 | print(" (currently at %s)" % src_ver) |
53 | 53 | ||
54 | print('repo User-Agent %s' % user_agent.repo) | 54 | print("repo User-Agent %s" % user_agent.repo) |
55 | print('git %s' % git.version_tuple().full) | 55 | print("git %s" % git.version_tuple().full) |
56 | print('git User-Agent %s' % user_agent.git) | 56 | print("git User-Agent %s" % user_agent.git) |
57 | print('Python %s' % sys.version) | 57 | print("Python %s" % sys.version) |
58 | uname = platform.uname() | 58 | uname = platform.uname() |
59 | if sys.version_info.major < 3: | 59 | if sys.version_info.major < 3: |
60 | # Python 3 returns a named tuple, but Python 2 is simpler. | 60 | # Python 3 returns a named tuple, but Python 2 is simpler. |
61 | print(uname) | 61 | print(uname) |
62 | else: | 62 | else: |
63 | print('OS %s %s (%s)' % (uname.system, uname.release, uname.version)) | 63 | print( |
64 | print('CPU %s (%s)' % | 64 | "OS %s %s (%s)" % (uname.system, uname.release, uname.version) |
65 | (uname.machine, uname.processor if uname.processor else 'unknown')) | 65 | ) |
66 | print('Bug reports:', Wrapper().BUG_URL) | 66 | print( |
67 | "CPU %s (%s)" | ||
68 | % ( | ||
69 | uname.machine, | ||
70 | uname.processor if uname.processor else "unknown", | ||
71 | ) | ||
72 | ) | ||
73 | print("Bug reports:", Wrapper().BUG_URL) | ||