fix(manifest): avoid KeyError when override bottle has repos absent from base

merge_bottles_runtime used .get(n, base_repos_by_name[n]) which eagerly
evaluates the default, crashing when a repo exists only in the override
bottle. Replaced with a conditional expression so the base lookup only
runs when needed.

Adds three regression tests covering override-only, base-only, and
name-collision cases.

Closes #457

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-07-23 22:17:32 +00:00
committed by didericis
parent f2c3710d0d
commit bf72282f8e
2 changed files with 25 additions and 1 deletions
+1 -1
View File
@@ -57,7 +57,7 @@ def _merge_two_bottles_runtime(base: "ManifestBottle", override: "ManifestBottle
n for n in override_repos_by_name if n not in base_repos_by_name
]
merged_git = tuple(
override_repos_by_name.get(n, base_repos_by_name[n])
override_repos_by_name[n] if n in override_repos_by_name else base_repos_by_name[n]
for n in merged_repos_names
)