Kill the surviving mutants of repos.py and url_beside

This commit is contained in:
2026-11-18 13:06:55 +01:00
parent 3de693f1a5
commit 2776d1694d
4 changed files with 13 additions and 13 deletions
+3 -3
View File
@@ -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?")