Warn when --show-all is used with no files listed
At least one contributor thought that --show-all would show all owners
for the current CL, so they used it with no files specified and got
confused by the lack of output. I was fooled to. The message printed
by "git cl help owners" makes it clear but it seems worth detecting the
no-files case and printing a helpful message, especially since most
(all?) of the other git cl owners commands apply to the current CL.
Bug: 1071967
Change-Id: I77bd2e30a3b3a6eb67cd40b93f5544b20facacb8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2183219
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
diff --git a/git_cl.py b/git_cl.py
index 8bb03fc..2eea22a 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -4653,6 +4653,9 @@
author = cl.GetAuthor()
if options.show_all:
+ if len(args) == 0:
+ print('No files specified for --show-all. Nothing to do.')
+ return 0
for arg in args:
base_branch = cl.GetCommonAncestorWithUpstream()
database = owners.Database(settings.GetRoot(), open, os.path)