diff options
Diffstat (limited to 'git-gerrit-mirror')
-rwxr-xr-x | git-gerrit-mirror | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/git-gerrit-mirror b/git-gerrit-mirror index 2655f11..9fbf956 100755 --- a/git-gerrit-mirror +++ b/git-gerrit-mirror @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import os import sys import time @@ -7,7 +7,7 @@ import logging import re import subprocess import urllib -import urlparse +import urllib.parse from xml.dom import minidom @@ -178,7 +178,7 @@ def get_gerrit_projects(gerrit_host): ssh_identity_option, parts[1], parts[0]) log.debug("Running command: %s", cmd) return [x.strip() for x in - subprocess.check_output(cmd, shell=True).split('\n') if x] + subprocess.check_output(cmd, shell=True).decode().split('\n') if x] def get_url_project_list(url): @@ -313,7 +313,7 @@ def host_url_to_path(host): "Convert host url from config to mirror dir path." parts = host.rsplit("#", 1) host = parts[0] - host_p = urlparse.urlparse(host.rstrip("/")) + host_p = urllib.parse.urlparse(host.rstrip("/")) path_adjusted = host_p.path.replace("/", "__") ret = options.mirror_dir + "/" + host_p.netloc + path_adjusted if len(parts) > 1: @@ -393,7 +393,7 @@ if args[0] == "create": # Create repository locally for host in conf.get_hosts(options.upstream): log.debug("=== Processing: %s ===", host) - projects = get_project_map_for_a_host(host).values()[:options.limit] + projects = get_project_map_for_a_host(host).values() for p in projects: path = "%s/%s.git" % (repo_root, p) if not os.path.exists(path): @@ -412,7 +412,7 @@ if args[0] == "create": get_gerrit_projects, ("%s:%s" % (gerrit_host, gerrit_port),)) for host in conf.get_hosts(options.upstream): log.debug("=== Processing: %s ===", host) - projects = get_project_map_for_a_host(host).values()[:options.limit] + projects = get_project_map_for_a_host(host).values() for p in projects: if p not in existing_projects: create_gerrit_projects([p]) @@ -424,8 +424,8 @@ elif args[0] == "clone": optparser.error("--mirror-dir is required") for host in conf.get_hosts(options.upstream): log.debug("=== Processing: %s ===", host) - projects = get_project_map_for_a_host(host).keys()[:options.limit] - host_p = urlparse.urlparse(host) + projects = get_project_map_for_a_host(host).keys() + host_p = urllib.parse.urlparse(host) new_repos = clone_repos(host, host_url_to_path(host), projects) handle_updated_repos(conf, host, new_repos) elif args[0] == "fetch": @@ -433,8 +433,8 @@ elif args[0] == "fetch": if not options.mirror_dir: optparser.error("--mirror-dir is required") for host in conf.get_hosts(options.upstream): - host_p = urlparse.urlparse(host) - git_repos = scan_git_projects(host_url_to_path(host))[:options.limit] + host_p = urllib.parse.urlparse(host) + git_repos = scan_git_projects(host_url_to_path(host)) log.info("=== Processing: %s (%d repositories) ===", host, len(git_repos)) fetch_repos(git_repos) @@ -443,8 +443,8 @@ elif args[0] == "push": if not options.mirror_dir: optparser.error("--mirror-dir is required") for host in conf.get_hosts(options.upstream): - host_p = urlparse.urlparse(host) - git_repos = scan_git_projects(host_url_to_path(host))[:options.limit] + host_p = urllib.parse.urlparse(host) + git_repos = scan_git_projects(host_url_to_path(host)) log.info("=== Processing: %s (%d repositories) ===", host, len(git_repos)) push_repos(host, git_repos, force=options.force) @@ -454,7 +454,7 @@ elif args[0] in ("upstream-ls", "ls-upstream"): for host in conf.get_hosts(options.upstream): print("%s:" % host) projects = sorted( - get_project_map_for_a_host(host).keys())[:options.limit] + get_project_map_for_a_host(host).keys()) for p in projects: print(p) print |