Add a feature to specify branches to be re-based

Change-Id: I00f1d6716ca5ece647d7ac15471ded25c1f164b2
Reviewed-on: https://chromium-review.googlesource.com/c/1370125
Reviewed-by: Marc-Antoine Ruel <maruel@chromium.org>
Commit-Queue: Sergiy Belozorov <sergiyb@chromium.org>
diff --git a/git_rebase_update.py b/git_rebase_update.py
index 4545ec9..e6cc930 100755
--- a/git_rebase_update.py
+++ b/git_rebase_update.py
@@ -223,6 +223,9 @@
   parser.add_argument('--no_fetch', '--no-fetch', '-n',
                       action='store_true',
                       help='Skip fetching remotes.')
+  parser.add_argument('branches', nargs='*',
+                      help='Branches to be rebased. All branches are assumed '
+                           'if none specified.')
   opts = parser.parse_args(args)
 
   if opts.verbose:  # pragma: no cover
@@ -273,6 +276,9 @@
   # Rebase each branch starting with the root-most branches and working
   # towards the leaves.
   for branch, parent in git.topo_iter(branch_tree):
+    # Only rebase specified branches, unless none specified.
+    if opts.branches and branch not in opts.branches:
+      continue
     if git.is_dormant(branch):
       print 'Skipping dormant branch', branch
     else: