forked from Mirror/pmbootstrap
git.get_upstream_remote: add fallback code path (MR 2429)
When running some commands like "pmbootstrap chroot" or even "pmbootstrap work_migrate", pmbootstrap will attempt to read the pmaports.cfg from origin/master *before* doing the work dir migration. In order to do this, the "get_upstream_remote" function tries to find the upstream remote by URL. Let it search with the outdated URLs too, so this doesn't fail right before migrating to the new URLs.
This commit is contained in:
parent
344d6f22d9
commit
a6d34d66b3
1 changed files with 9 additions and 0 deletions
|
@ -113,6 +113,15 @@ def get_upstream_remote(aports: Path):
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if any(u in line for u in urls):
|
if any(u in line for u in urls):
|
||||||
return line.split("\t", 1)[0]
|
return line.split("\t", 1)[0]
|
||||||
|
|
||||||
|
# Fallback to old URLs, in case the migration was not done yet
|
||||||
|
if name_repo == "pmaports":
|
||||||
|
urls_outdated = OUTDATED_GIT_REMOTES_HTTP + OUTDATED_GIT_REMOTES_SSH
|
||||||
|
for line in lines:
|
||||||
|
if any(u in line.lower() for u in urls_outdated):
|
||||||
|
logging.warning("WARNING: pmaports has an outdated remote URL")
|
||||||
|
return line.split("\t", 1)[0]
|
||||||
|
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
f"{name_repo}: could not find remote name for any URL '{urls}' in git"
|
f"{name_repo}: could not find remote name for any URL '{urls}' in git"
|
||||||
f" repository: {aports}"
|
f" repository: {aports}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue