This commit is contained in:
@@ -17,6 +17,11 @@ REPO_NAME = r"\w[\w.-]*"
|
||||
CLONE_ADDRESS = rf"https://[\w.-]+(:\d+)?/\S+|ssh://[\w.@-]+(:\d+)?/\S+|\w[\w.-]*@[\w.-]+:[\w./~-]+"
|
||||
|
||||
|
||||
def shown(url: str) -> str:
|
||||
"""url without any `user:token@` after its scheme, since an Unsure may be posted where the team reads it."""
|
||||
return re.sub(r"^(\w+://)[^/@]*@", r"\1", url)
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Located:
|
||||
"""checkout is the repo's git checkout, and config the project config that names it."""
|
||||
@@ -73,11 +78,11 @@ def place_of(name: str, others: list[pathlib.Path], git: Git) -> str | Failure:
|
||||
return Unsure(f"cannot read the origin of {other}: {origin.reason}. Where does {name} live?")
|
||||
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?")
|
||||
return Unsure(f"{other} has an origin, {shown(origin.strip())}, with no place to put another repo in. Where does {name} live?")
|
||||
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(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?")
|
||||
return Unsure(f"{shown(url)} is not an https, ssh or scp-style address. Where does {name} live?")
|
||||
return url
|
||||
|
||||
Reference in New Issue
Block a user