summaryrefslogtreecommitdiffstats
path: root/subcmds/version.py
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2020-02-25 15:18:31 -0500
committerDavid Pursehouse <dpursehouse@collab.net>2020-03-17 00:08:52 +0000
commitbb930461cee056de210816e58c36a8d6dfd122be (patch)
tree3f98c279580f02ecf7c1608a20caa294f1075f45 /subcmds/version.py
parentd3639c53d56feaea81474ffd28395a124744dab7 (diff)
downloadgit-repo-bb930461cee056de210816e58c36a8d6dfd122be.tar.gz
subcmds: stop instantiating at import time
The current subcmds design has singletons in all_commands. This isn't exactly unusual, but the fact that our main & help subcommand will then attach members to the classes before invoking them is. This makes it hard to keep track of what members a command has access to, and the two code paths (main & help) attach different members depending on what APIs they then invoke. Lets pull this back a step by storing classes in all_commands and leave the instantiation step to when they're used. This doesn't fully clean up the confusion, but gets us closer. Change-Id: I6a768ff97fe541e6f3228358dba04ed66c4b070a Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259154 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Diffstat (limited to 'subcmds/version.py')
-rw-r--r--subcmds/version.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/subcmds/version.py b/subcmds/version.py
index 91dbe68f..8721bf49 100644
--- a/subcmds/version.py
+++ b/subcmds/version.py
@@ -44,9 +44,9 @@ class Version(Command, MirrorSafeCommand):
44 print('repo version %s' % rp_ver) 44 print('repo version %s' % rp_ver)
45 print(' (from %s)' % rem.url) 45 print(' (from %s)' % rem.url)
46 46
47 if Version.wrapper_path is not None: 47 if self.wrapper_path is not None:
48 print('repo launcher version %s' % Version.wrapper_version) 48 print('repo launcher version %s' % self.wrapper_version)
49 print(' (from %s)' % Version.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)