Compare commits
1 Commits
master
...
fix-pmapor
Author | SHA1 | Date |
---|---|---|
Oliver Smith | 1f80472dda |
|
@ -97,8 +97,11 @@ def get_upstream_remote(args, name_repo):
|
||||||
for line in output.split("\n"):
|
for line in output.split("\n"):
|
||||||
if url in line:
|
if url in line:
|
||||||
return line.split("\t", 1)[0]
|
return line.split("\t", 1)[0]
|
||||||
raise RuntimeError("{}: could not find remote name for URL '{}' in git"
|
|
||||||
" repository: {}".format(name_repo, url, path))
|
# Fallback (e.g. when pmaports CI clones a different URL as origin)
|
||||||
|
logging.verbose(f"{name_repo}: could not find remote name for URL '{url}',"
|
||||||
|
f" assuming 'origin'")
|
||||||
|
return "origin"
|
||||||
|
|
||||||
|
|
||||||
def parse_channels_cfg(args):
|
def parse_channels_cfg(args):
|
||||||
|
|
|
@ -101,10 +101,8 @@ def test_get_upstream_remote(args, monkeypatch, tmpdir):
|
||||||
run_git(["init", "."])
|
run_git(["init", "."])
|
||||||
run_git(["commit", "--allow-empty", "-m", "commit on master"])
|
run_git(["commit", "--allow-empty", "-m", "commit on master"])
|
||||||
|
|
||||||
# No upstream remote
|
# Missing upstream remote, fall back to "origin"
|
||||||
with pytest.raises(RuntimeError) as e:
|
assert func(args, name_repo) == "origin"
|
||||||
func(args, name_repo)
|
|
||||||
assert "could not find remote name for URL" in str(e.value)
|
|
||||||
|
|
||||||
run_git(["remote", "add", "hello", url])
|
run_git(["remote", "add", "hello", url])
|
||||||
assert func(args, name_repo) == "hello"
|
assert func(args, name_repo) == "hello"
|
||||||
|
|
Loading…
Reference in New Issue