Allow mirror script to run on a specified branch.

* jeepyb/cmd/run_mirror.py(Mirror.__init__,Mirror.build_mirror): Add
a -b/--branch option which, if specified, limits the mirror update
to only the named branch rather than running for all available
branches.

Change-Id: I07e5fa98054c8b77bf512166e730d3e73c27286c
Reviewed-on: https://review.openstack.org/28346
Reviewed-by: James E. Blair <corvus@inaugust.com>
Approved: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Tested-by: Jenkins
diff --git a/jeepyb/cmd/run_mirror.py b/jeepyb/cmd/run_mirror.py
index 52787ff..ed9cf0a 100644
--- a/jeepyb/cmd/run_mirror.py
+++ b/jeepyb/cmd/run_mirror.py
@@ -70,6 +70,8 @@
     def __init__(self):
         parser = argparse.ArgumentParser(
             description='Build a pypi mirror from requirements')
+        parser.add_argument('-b', dest='branch',
+                            help='restrict run to a specified branch')
         parser.add_argument('-c', dest='config',
                             help='specify the config file')
         parser.add_argument('-n', dest='noop', action='store_true',
@@ -189,7 +191,11 @@
                                     short_project))
             out = self.run_command("git fetch -p origin")
 
-            for branch in self.run_command("git branch -a").split("\n"):
+            if self.args.branch:
+                branches = [self.args.branch]
+            else:
+                branches = self.run_command("git branch -a").split("\n")
+            for branch in branches:
                 branch = branch.strip()
                 if (not branch.startswith("remotes/origin")
                         or "origin/HEAD" in branch):