abandon: add support for --quiet

Also fix the normal output to write to stdout.

Change-Id: I6c117eea9cec08f5be9a44b90dbe9bf1f824ec95
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/256114
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
Mike Frysinger 2020-02-20 00:48:39 -05:00
parent aa611a2ca2
commit e6e27b338b

View File

@ -37,6 +37,9 @@ It is equivalent to "git branch -D <branchname>".
"""
def _Options(self, p):
p.add_option('-q', '--quiet',
action='store_true', default=False,
help='be quiet')
p.add_option('--all',
dest='all', action='store_true',
help='delete all branches in all projects')
@ -93,11 +96,14 @@ It is equivalent to "git branch -D <branchname>".
file=sys.stderr)
sys.exit(1)
else:
print('Abandoned branches:', file=sys.stderr)
# Everything below here is displaying status.
if opt.quiet:
return
print('Abandoned branches:')
for br in success.keys():
if len(all_projects) > 1 and len(all_projects) == len(success[br]):
result = "all project"
else:
result = "%s" % (
('\n' + ' ' * width + '| ').join(p.relpath for p in success[br]))
print("%s%s| %s\n" % (br, ' ' * (width - len(br)), result), file=sys.stderr)
print("%s%s| %s\n" % (br, ' ' * (width - len(br)), result))