summaryrefslogtreecommitdiffstats
path: root/subcmds/diffmanifests.py
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2019-08-27 01:10:59 -0400
committerMike Frysinger <vapier@google.com>2019-08-28 03:54:11 +0000
commitae6cb08ae52d488a4cc6892f811c1c1acf8c3c12 (patch)
treec927415df288d9bf9076e758835db53cc633597d /subcmds/diffmanifests.py
parent3fc157285cb61d6a4faa55dc4f011fb94d598c20 (diff)
downloadgit-repo-ae6cb08ae52d488a4cc6892f811c1c1acf8c3c12.tar.gz
split out cli validation from executionv1.13.5
A common pattern in our subcommands is to verify the arguments & options before executing things. For some subcommands, that check stage is quite long which makes the execution function even bigger. Lets split that logic out of the execute phase so it's easier to manage these. This is most noticeable in the sync subcommand whose Execute func is quite large, and the option checking makes up ~15% of it. The manifest command's Execute can be simplified significantly as the optparse configuration always sets output_file to a string. Change-Id: I7097847ff040e831345e63de6b467ee17609990e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/234834 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'subcmds/diffmanifests.py')
-rw-r--r--subcmds/diffmanifests.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/subcmds/diffmanifests.py b/subcmds/diffmanifests.py
index cae776a7..b999699e 100644
--- a/subcmds/diffmanifests.py
+++ b/subcmds/diffmanifests.py
@@ -176,10 +176,11 @@ synced and their revisions won't be found.
176 self.printText(log) 176 self.printText(log)
177 self.out.nl() 177 self.out.nl()
178 178
179 def Execute(self, opt, args): 179 def ValidateOptions(self, opt, args):
180 if not args or len(args) > 2: 180 if not args or len(args) > 2:
181 self.Usage() 181 self.OptionParser.error('missing manifests to diff')
182 182
183 def Execute(self, opt, args):
183 self.out = _Coloring(self.manifest.globalConfig) 184 self.out = _Coloring(self.manifest.globalConfig)
184 self.printText = self.out.nofmt_printer('text') 185 self.printText = self.out.nofmt_printer('text')
185 if opt.color: 186 if opt.color: