Kill the surviving mutants of repos.py and url_beside
This commit is contained in:
@@ -66,7 +66,7 @@ def place_of(name: str, others: list[pathlib.Path], git: Git) -> str | Failure:
|
||||
"""The address of the repo called name beside the others: all of them on one host and owner. An Unsure otherwise."""
|
||||
if not others:
|
||||
return Unsure(f"{name} is missing and no other repo of the epic shows what host to clone it from. Where does it live?")
|
||||
urls: dict[str, pathlib.Path] = {}
|
||||
urls = set()
|
||||
for other in others:
|
||||
origin = git("remote", "get-url", "origin", cwd=str(other))
|
||||
if isinstance(origin, Failure):
|
||||
@@ -74,9 +74,9 @@ def place_of(name: str, others: list[pathlib.Path], git: Git) -> str | Failure:
|
||||
beside = url_beside(origin.strip(), name)
|
||||
if beside is None:
|
||||
return Unsure(f"{other} has an origin, {origin.strip()}, with no place to put another repo in. Where does {name} live?")
|
||||
urls[beside] = other
|
||||
urls.add(beside)
|
||||
if len(urls) > 1:
|
||||
return Unsure(f"The epic's other repos sit in more than one place, so {name} could be at {' or '.join(urls)}. Which holds it?")
|
||||
return Unsure(f"The epic's other repos sit in more than one place, so {name} could be at {' or '.join(sorted(urls))}. Which holds it?")
|
||||
url = next(iter(urls))
|
||||
if not re.fullmatch(CLONE_ADDRESS, url):
|
||||
return Unsure(f"{url} is not an https, ssh or scp-style address. Where does {name} live?")
|
||||
|
||||
Reference in New Issue
Block a user