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
This commit is contained in:
parent
60e49d66d6
commit
57bbc40763
@ -184,6 +184,7 @@ def check_remote(remote):
|
|||||||
run_command("git remote update %s")
|
run_command("git remote update %s")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Gerrit remote not present, try to add it
|
||||||
fetch_url = ""
|
fetch_url = ""
|
||||||
for line in run_command("git remote show -n origin").split("\n"):
|
for line in run_command("git remote show -n origin").split("\n"):
|
||||||
if line.strip().startswith("Fetch URL"):
|
if line.strip().startswith("Fetch URL"):
|
||||||
@ -198,13 +199,18 @@ def check_remote(remote):
|
|||||||
username = None
|
username = None
|
||||||
port = None
|
port = None
|
||||||
|
|
||||||
|
if VERBOSE:
|
||||||
|
print "Found origin fetch URL:", fetch_url
|
||||||
|
|
||||||
# Special-case git@github urls - the rest can be parsed with urlparse
|
# Special-case git@github urls - the rest can be parsed with urlparse
|
||||||
if fetch_url.startswith("git@github.com"):
|
if fetch_url.startswith("git@github.com"):
|
||||||
hostname = "github.com"
|
hostname = "github.com"
|
||||||
team = fetch_url.split(":")[1].split("/")[0]
|
|
||||||
else:
|
else:
|
||||||
(username, hostname, port) = split_hostname(fetch_url)
|
(username, hostname, port) = split_hostname(fetch_url)
|
||||||
|
|
||||||
|
if hostname == "github.com":
|
||||||
|
team = fetch_url.split("/")[-2]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
(hostname, project) = map_known_locations(hostname, team, project_name)
|
(hostname, project) = map_known_locations(hostname, team, project_name)
|
||||||
add_remote(username, hostname, port, project)
|
add_remote(username, hostname, port, project)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user