aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Sokolovsky <paul.sokolovsky@linaro.org>2016-04-06 23:32:04 +0300
committerPaul Sokolovsky <paul.sokolovsky@linaro.org>2016-04-06 23:32:04 +0300
commitb6830d5c7e4e347e02d1f41ff64213fded656025 (patch)
tree8b6a1edc94c4e5a62c95e39542816c9e41f4e5df
parent7aad6d240e2041c79944c52a1c12735c53114dc1 (diff)
downloadlinaro-android-gerrit-support-b6830d5c7e4e347e02d1f41ff64213fded656025.tar.gz
git-gerrit-mirror: Make "create" command work for "repo_root" destination.
Previously, "create" command worked only if mirroring destination was gerrit. Allow it to work also for the case of local filesystem repo tree. Change-Id: I7afbe3374c3c9de1d93e0650e4eae4bf3923dbdc
-rwxr-xr-xgit-gerrit-mirror18
1 files changed, 18 insertions, 0 deletions
diff --git a/git-gerrit-mirror b/git-gerrit-mirror
index 4bc70d0..cfee507 100755
--- a/git-gerrit-mirror
+++ b/git-gerrit-mirror
@@ -367,8 +367,26 @@ options.dest = DEST_KEYWORD + dest
if args[0] == "create":
check_args(optparser, args, 1)
+
+ repo_root = conf.get_var(options.dest, "repo_root")
+ if repo_root:
+
+ for host in conf.get_hosts(options.upstream):
+ log.debug("=== Processing: %s ===", host)
+ projects = get_project_map_for_a_host(host).values()[:options.limit]
+ for p in projects:
+ path = "%s/%s.git" % (repo_root, p)
+ if not os.path.exists(path):
+ if not options.dry_run:
+ os.makedirs(path)
+ run_command("GIT_DIR=%s git init --bare" % path)
+ sys.exit()
+
gerrit_host = conf.get_var(options.dest, "gerrit_host")
gerrit_port = conf.get_var(options.dest, "gerrit_port")
+ if not gerrit_host:
+ log.warn("No Gerrit host defined for this destination, so nowhere to create projects")
+ sys.exit()
log.debug("Getting list of projects in target Gerrit %s:%s",
gerrit_host, gerrit_port)
existing_projects = get_cached(