From f57025d5592b223dcc427a0e285d3af10acc2cca Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Mon, 6 May 2013 20:42:45 +0000 Subject: [PATCH] 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 Approved: Clark Boylan Reviewed-by: Clark Boylan Tested-by: Jenkins --- jeepyb/cmd/run_mirror.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 @@ 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):