From 57bbc4076311dff81961830c8747872616c290e0 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Sun, 2 Oct 2011 11:15:07 -0400 Subject: [PATCH] Handle repos cloned from github git urls. Cloning from git:// wasn't being detected as a github url by check_remote, causing git-review not to be able to guess the correct team. Change-Id: I2aa89066a670f09926faacfd326e25a7c9b19412 --- git-review | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/git-review b/git-review index 21f08fd..b702e23 100755 --- a/git-review +++ b/git-review @@ -184,6 +184,7 @@ def check_remote(remote): run_command("git remote update %s") return + # Gerrit remote not present, try to add it fetch_url = "" for line in run_command("git remote show -n origin").split("\n"): if line.strip().startswith("Fetch URL"): @@ -198,13 +199,18 @@ def check_remote(remote): username = None port = None + if VERBOSE: + print "Found origin fetch URL:", fetch_url + # Special-case git@github urls - the rest can be parsed with urlparse if fetch_url.startswith("git@github.com"): hostname = "github.com" - team = fetch_url.split(":")[1].split("/")[0] else: (username, hostname, port) = split_hostname(fetch_url) + if hostname == "github.com": + team = fetch_url.split("/")[-2] + try: (hostname, project) = map_known_locations(hostname, team, project_name) add_remote(username, hostname, port, project)