aboutsummaryrefslogtreecommitdiff
path: root/git-gerrit-mirror
diff options
context:
space:
mode:
authorKelley Spoon <kelley.spoon@linaro.org>2021-01-07 07:34:03 -0600
committerKelley Spoon <kelley.spoon@linaro.org>2021-01-07 08:55:02 -0600
commit978ff5bd46221c386e2a0fc7aa45e7224f7e5ebb (patch)
tree0d9e91291e966954090d42a224784abdeb254599 /git-gerrit-mirror
parent4b4557dfe225a8f4e3cb49d28818700094df51da (diff)
git-gerrit-mirror: add ability to override repo_root per section
The way this script was previously working is that we define several DESTINATIONs with one acting as a default. The destination for git pushes can be changed via command line option, but all pushes are still sent to the same location. We have a situation with an android mirror where we do *not* want to push it through gerrit as it is served only via gitolite. Since the upstream contains around 1060 repos, we prefer to push it straight to disk and leave gerrit out instead of creating a huge load for the server. This change allows us to specify the repo_root variable in a host section to bypass the default DESTINATION. Change-Id: Ibbb5470b632e29598f4a8d1e77b1b9d955067755
Diffstat (limited to 'git-gerrit-mirror')
-rwxr-xr-xgit-gerrit-mirror9
1 files changed, 6 insertions, 3 deletions
diff --git a/git-gerrit-mirror b/git-gerrit-mirror
index ed0c7f8..2655f11 100755
--- a/git-gerrit-mirror
+++ b/git-gerrit-mirror
@@ -282,7 +282,10 @@ def push_repos(host, git_repos, force=False):
extra_opts += " --force"
if not options.debug:
extra_opts += " --no-progress"
- repo_root = conf.get_var(options.dest, "repo_root")
+ # allow to override repo_root
+ repo_root = conf.get_var(
+ host, "repo_root", conf.get_var(options.dest, "repo_root")
+ )
cmdline = "time git push%s %s/%s.git 'refs/heads/*' 'refs/tags/*'" % (
extra_opts, repo_root, mirror_projname)
run_command(cmdline)
@@ -449,11 +452,11 @@ elif args[0] == "push":
elif args[0] in ("upstream-ls", "ls-upstream"):
check_args(optparser, args, 1)
for host in conf.get_hosts(options.upstream):
- print "%s:" % host
+ print("%s:" % host)
projects = sorted(
get_project_map_for_a_host(host).keys())[:options.limit]
for p in projects:
- print p
+ print(p)
print
else:
optparser.error("Unknown command")