Adds a remotes=[{"name": ..., "url": ...}, ...] constructor to GitClone so the config author controls how each URL maps to a git remote. The existing url=str / url=[str] shorthand is kept as backward-compatible (positional list still maps to origin, repo1, repo2, ...), so PR #2's test_git_clone_multiple_urls continues to pass.
Changes
backend/steps/git.py — GitClone.__init__ now accepts either url= or remotes=. With remotes=, every entry must carry a non-empty unique name and url; duplicates and missing fields raise ValueError. The constructor rejects passing both or neither. self.remotes becomes the source of truth; self.urls is a derived list (kept for any introspection). CheckoutMerged.find_desired_commits falls back to the configured primary remote instead of the hardcoded 'origin' when a branch key has no remote prefix, so configs that don't name a remote origin still work.
backend/configs/brencher.py, brencher2.py — switch from positional list to named remotes github, gitea_admin, gitea_hermes.
tests/test_git_integration.py — adds test_git_clone_named_remotes (asserts the user-chosen names appear verbatim and origin/repo1 do not leak) and test_git_clone_remotes_validation (covers every rejection path: empty list, missing/empty name, missing/empty url, duplicate name, both-kwargs, no-kwargs).
Targets admin/multiple_remotes so this lands on top of #2. After #2 merges, this is a clean follow-up; if #2 is reworked, this branch will need a rebase.
Verification
python3 -m py_compile on all 4 changed files: clean.
AST-driven call-shape check: every GitClone(...) in both configs uses the new remotes= kwarg with exactly {github, gitea_admin, gitea_hermes}; no positional-list leftover in configs.
Executed the new __init__ in isolation against a stubbed super() and exercised 12 cases: 3 OK shapes (url=str, url=[..], remotes=[valid]) and 9 rejection shapes (empty list, missing/empty name, missing/empty url, duplicate name, both-kwargs, no-kwargs, non-dict entry). All 12 produced the asserted ValueError/TypeError with the expected message substring.
Could not run pytest in this sandbox (PyPI is blocked by the proxy and no pytest/gitpython is pre-installed). The two new tests and PR #2's existing test should be run in a real env before merge.
Implements the review comment on #2:
> I would like to give names for remotes
## Summary
Adds a `remotes=[{"name": ..., "url": ...}, ...]` constructor to `GitClone` so the config author controls how each URL maps to a git remote. The existing `url=str` / `url=[str]` shorthand is kept as backward-compatible (positional list still maps to `origin`, `repo1`, `repo2`, ...), so PR #2's `test_git_clone_multiple_urls` continues to pass.
## Changes
- **`backend/steps/git.py`** — `GitClone.__init__` now accepts either `url=` or `remotes=`. With `remotes=`, every entry must carry a non-empty unique `name` and `url`; duplicates and missing fields raise `ValueError`. The constructor rejects passing both or neither. `self.remotes` becomes the source of truth; `self.urls` is a derived list (kept for any introspection). `CheckoutMerged.find_desired_commits` falls back to the configured primary remote instead of the hardcoded `'origin'` when a branch key has no remote prefix, so configs that don't name a remote `origin` still work.
- **`backend/configs/brencher.py`, `brencher2.py`** — switch from positional list to named remotes `github`, `gitea_admin`, `gitea_hermes`.
- **`tests/test_git_integration.py`** — adds `test_git_clone_named_remotes` (asserts the user-chosen names appear verbatim and `origin`/`repo1` do not leak) and `test_git_clone_remotes_validation` (covers every rejection path: empty list, missing/empty name, missing/empty url, duplicate name, both-kwargs, no-kwargs).
## Diff vs #2
```
backend/configs/brencher.py | 8 ++---
backend/configs/brencher2.py | 8 ++---
backend/steps/git.py | 76 +++++++++++++++++++++++++++++++++++++++-------
tests/test_git_integration.py | 75 ++++++++++++++++++++++++++++++++++++++++++
4 files changed, 147 insertions(+), 20 deletions(-)
```
Targets `admin/multiple_remotes` so this lands on top of #2. After #2 merges, this is a clean follow-up; if #2 is reworked, this branch will need a rebase.
## Verification
- `python3 -m py_compile` on all 4 changed files: clean.
- AST-driven call-shape check: every `GitClone(...)` in both configs uses the new `remotes=` kwarg with exactly `{github, gitea_admin, gitea_hermes}`; no positional-list leftover in configs.
- Executed the new `__init__` in isolation against a stubbed `super()` and exercised 12 cases: 3 OK shapes (url=str, url=[..], remotes=[valid]) and 9 rejection shapes (empty list, missing/empty name, missing/empty url, duplicate name, both-kwargs, no-kwargs, non-dict entry). All 12 produced the asserted `ValueError`/`TypeError` with the expected message substring.
- Could not run `pytest` in this sandbox (PyPI is blocked by the proxy and no `pytest`/`gitpython` is pre-installed). The two new tests and PR #2's existing test should be run in a real env before merge.
Adds a remotes=[{name,url}] constructor to GitClone so the config
author controls how each URL maps to a git remote. Implements the
review comment on PR #2 ("I would like to give names for remotes").
The url=str / url=list[str] shorthand stays supported for backward
compatibility (positional list still maps to origin, repo1, repo2, ...),
so PR #2's test_git_clone_multiple_urls keeps passing.
- backend/steps/git.py: GitClone.__init__ now accepts either url= or
remotes=. The remotes= form requires every entry to carry a non-empty
unique name and url; duplicates and missing fields raise ValueError.
self.remotes is the source of truth; self.urls is a derived list.
CheckoutMerged.find_desired_commits falls back to the configured
primary remote instead of hardcoded 'origin' when a branch key has
no remote prefix.
- backend/configs/brencher.py, brencher2.py: pass named remotes
github, gitea_admin, gitea_hermes.
- tests/test_git_integration.py: add test_git_clone_named_remotes
(asserts user-chosen names appear verbatim and origin/repo1 do not
leak) and test_git_clone_remotes_validation (every rejection path).
The '# type: ignore[call-arg]' on GitClone() was a relic from the
original __init__ signature where all params were required. After
making url=/remotes= both optional with None defaults, GitClone()
with no kwargs is well-typed; mypy with warn_unused_ignores=True
correctly flags the now-redundant ignore comment. Remove it.
The two fresh-repo setup blocks were line-for-line identical except
for the variable name. Extract a fresh_repo(prefix, message) helper
and use it twice. Also hoist 'import tempfile' to module top to match
the file's import style.
pytest tests/test_git_integration.py still passes (3/3).
mypy on tests/test_git_integration.py still clean (same single
pre-existing transitive error in backend/steps/step.py).
Two small cleanups, no behavior change:
- Remove the stray '# CI trigger check: trailing whitespace test'
comment left over from the CI-trigger experiment; it's not
documentation of the surrounding logic.
- Extract the (slash-or-no-slash) / (remote-exists-or-not) branch-key
resolution into a module-level _resolve_branch_ref() helper, replacing
four lines of nested conditionals in find_desired_commits with a
single helper call.
pytest tests/test_git_integration.py: 15/15 passed in 6.51s.
mypy on the 4 changed files: same single pre-existing transitive
error as on main; zero new errors.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Implements the review comment on #2:
Summary
Adds a
remotes=[{"name": ..., "url": ...}, ...]constructor toGitCloneso the config author controls how each URL maps to a git remote. The existingurl=str/url=[str]shorthand is kept as backward-compatible (positional list still maps toorigin,repo1,repo2, ...), so PR #2'stest_git_clone_multiple_urlscontinues to pass.Changes
backend/steps/git.py—GitClone.__init__now accepts eitherurl=orremotes=. Withremotes=, every entry must carry a non-empty uniquenameandurl; duplicates and missing fields raiseValueError. The constructor rejects passing both or neither.self.remotesbecomes the source of truth;self.urlsis a derived list (kept for any introspection).CheckoutMerged.find_desired_commitsfalls back to the configured primary remote instead of the hardcoded'origin'when a branch key has no remote prefix, so configs that don't name a remoteoriginstill work.backend/configs/brencher.py,brencher2.py— switch from positional list to named remotesgithub,gitea_admin,gitea_hermes.tests/test_git_integration.py— addstest_git_clone_named_remotes(asserts the user-chosen names appear verbatim andorigin/repo1do not leak) andtest_git_clone_remotes_validation(covers every rejection path: empty list, missing/empty name, missing/empty url, duplicate name, both-kwargs, no-kwargs).Diff vs #2
Targets
admin/multiple_remotesso this lands on top of #2. After #2 merges, this is a clean follow-up; if #2 is reworked, this branch will need a rebase.Verification
python3 -m py_compileon all 4 changed files: clean.GitClone(...)in both configs uses the newremotes=kwarg with exactly{github, gitea_admin, gitea_hermes}; no positional-list leftover in configs.__init__in isolation against a stubbedsuper()and exercised 12 cases: 3 OK shapes (url=str, url=[..], remotes=[valid]) and 9 rejection shapes (empty list, missing/empty name, missing/empty url, duplicate name, both-kwargs, no-kwargs, non-dict entry). All 12 produced the assertedValueError/TypeErrorwith the expected message substring.pytestin this sandbox (PyPI is blocked by the proxy and nopytest/gitpythonis pre-installed). The two new tests and PR #2's existing test should be run in a real env before merge.Adds a remotes=[{name,url}] constructor to GitClone so the config author controls how each URL maps to a git remote. Implements the review comment on PR #2 ("I would like to give names for remotes"). The url=str / url=list[str] shorthand stays supported for backward compatibility (positional list still maps to origin, repo1, repo2, ...), so PR #2's test_git_clone_multiple_urls keeps passing. - backend/steps/git.py: GitClone.__init__ now accepts either url= or remotes=. The remotes= form requires every entry to carry a non-empty unique name and url; duplicates and missing fields raise ValueError. self.remotes is the source of truth; self.urls is a derived list. CheckoutMerged.find_desired_commits falls back to the configured primary remote instead of hardcoded 'origin' when a branch key has no remote prefix. - backend/configs/brencher.py, brencher2.py: pass named remotes github, gitea_admin, gitea_hermes. - tests/test_git_integration.py: add test_git_clone_named_remotes (asserts user-chosen names appear verbatim and origin/repo1 do not leak) and test_git_clone_remotes_validation (every rejection path).