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
This commit is contained in:
Jeremy Stanley 2013-05-06 20:42:45 +00:00 committed by Jenkins
parent 9023a46782
commit f57025d559

View File

@ -70,6 +70,8 @@ class Mirror(object):
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 @@ class Mirror(object):
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):