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")
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user