From 8e404a7e4992eaabb0f510cfb9dce2bb4a8d2d20 Mon Sep 17 00:00:00 2001 From: Allen Bauer Date: Fri, 10 Jul 2020 21:22:54 +0000 Subject: [PATCH] Added option to keep empty branches in rebase-update. Change-Id: I87b1edf242aa5c8483d8d84d223fc9187a194708 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2292962 Reviewed-by: Dirk Pranke Commit-Queue: Allen Bauer --- git_rebase_update.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/git_rebase_update.py b/git_rebase_update.py index b02ad73c2..5840f83c3 100755 --- a/git_rebase_update.py +++ b/git_rebase_update.py @@ -232,6 +232,8 @@ def main(args=None): parser.add_argument('branches', nargs='*', help='Branches to be rebased. All branches are assumed ' 'if none specified.') + parser.add_argument('--keep-empty', '-e', action='store_true', + help='Do not automatically delete empty branches.') opts = parser.parse_args(args) if opts.verbose: # pragma: no cover @@ -314,7 +316,8 @@ def main(args=None): print(' %s' % branch) if not retcode: - remove_empty_branches(branch_tree) + if not opts.keep_empty: + remove_empty_branches(branch_tree) # return_branch may not be there any more. if return_branch in git.branches():