diff options
author | Mike Frysinger <vapier@google.com> | 2020-02-20 00:48:39 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@google.com> | 2020-02-20 06:14:00 +0000 |
commit | e6e27b338b31ec5b1e7567c3639523c3739e4c2e (patch) | |
tree | d1f7581c0c16b5b1e2f93ae7df6f64a2c50c24ee /subcmds/abandon.py | |
parent | aa611a2ca284333521624f7095c9cff42278a4b9 (diff) | |
download | git-repo-e6e27b338b31ec5b1e7567c3639523c3739e4c2e.tar.gz |
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>
Diffstat (limited to 'subcmds/abandon.py')
-rw-r--r-- | subcmds/abandon.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/subcmds/abandon.py b/subcmds/abandon.py index 5d56abf7..33011210 100644 --- a/subcmds/abandon.py +++ b/subcmds/abandon.py | |||
@@ -37,6 +37,9 @@ It is equivalent to "git branch -D <branchname>". | |||
37 | """ | 37 | """ |
38 | 38 | ||
39 | def _Options(self, p): | 39 | def _Options(self, p): |
40 | p.add_option('-q', '--quiet', | ||
41 | action='store_true', default=False, | ||
42 | help='be quiet') | ||
40 | p.add_option('--all', | 43 | p.add_option('--all', |
41 | dest='all', action='store_true', | 44 | dest='all', action='store_true', |
42 | help='delete all branches in all projects') | 45 | help='delete all branches in all projects') |
@@ -93,11 +96,14 @@ It is equivalent to "git branch -D <branchname>". | |||
93 | file=sys.stderr) | 96 | file=sys.stderr) |
94 | sys.exit(1) | 97 | sys.exit(1) |
95 | else: | 98 | else: |
96 | print('Abandoned branches:', file=sys.stderr) | 99 | # Everything below here is displaying status. |
100 | if opt.quiet: | ||
101 | return | ||
102 | print('Abandoned branches:') | ||
97 | for br in success.keys(): | 103 | for br in success.keys(): |
98 | if len(all_projects) > 1 and len(all_projects) == len(success[br]): | 104 | if len(all_projects) > 1 and len(all_projects) == len(success[br]): |
99 | result = "all project" | 105 | result = "all project" |
100 | else: | 106 | else: |
101 | result = "%s" % ( | 107 | result = "%s" % ( |
102 | ('\n' + ' ' * width + '| ').join(p.relpath for p in success[br])) | 108 | ('\n' + ' ' * width + '| ').join(p.relpath for p in success[br])) |
103 | print("%s%s| %s\n" % (br, ' ' * (width - len(br)), result), file=sys.stderr) | 109 | print("%s%s| %s\n" % (br, ' ' * (width - len(br)), result)) |