From 97ed44ada92dcca2b970f0d3b72b36fbd40c1d2e Mon Sep 17 00:00:00 2001 From: Bruce Dawson Date: Wed, 6 May 2020 17:04:03 +0000 Subject: [PATCH] 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 Commit-Queue: Bruce Dawson --- git_cl.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/git_cl.py b/git_cl.py index 8bb03fc84..2eea22ad8 100755 --- a/git_cl.py +++ b/git_cl.py @@ -4653,6 +4653,9 @@ def CMDowners(parser, args): 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)