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 <dpranke@google.com>
Commit-Queue: Allen Bauer <kylixrd@chromium.org>
diff --git a/git_rebase_update.py b/git_rebase_update.py
index b02ad73..5840f83 100755
--- a/git_rebase_update.py
+++ b/git_rebase_update.py
@@ -232,6 +232,8 @@
   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 @@
       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():