Add support for multiple Git push URLs #75
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for Git's multiple push URL feature, enabling pushing to multiple remotes (e.g., GitHub + GitLab mirrors) automatically. Uses multiline configuration syntax consistent with
version-overridesandignores.Motivation
Users often need to mirror repositories across multiple Git hosting services (GitHub, GitLab, Bitbucket) for redundancy, CI/CD pipelines, or organizational requirements. Git natively supports multiple push URLs per remote, and mxdev should support this workflow.
Changes
Core Implementation
1. Configuration Parsing (config.py):
parse_multiline_list()function to parse multiline configuration valuespushurlslistpushurlkey for backward compatibility2. Git Operations (vcs/git.py):
git_set_pushurl()to handle both single and multiple pushurlsgit config remote.origin.pushurl URLgit config --add remote.origin.pushurl URL3. Tests (tests/test_config.py, tests/test_git_additional.py):
test_config_parse_multiple_pushurls(): Validates multiline parsing and backward compattest_git_set_pushurl_multiple(): Verifies git command sequence with --add flagtest_git_checkout_with_multiple_pushurls(): End-to-end integration testConfiguration Example
When you run
git pushin the checked-out repository, Git will push to all configured pushurls sequentially.Backward Compatibility ✅
Fully backward compatible:
pushurl = git@github.com:org/repo.git(unchanged behavior, nopushurlslist)pushurlslist)"pushurl" in sourcecontinues to workTesting
Documentation
Implementation Notes
Git Behavior:
git pushis runDesign Decisions:
version-overridesandignores"pushurl" in sourcefor any value)Related
Complements the smart threading enhancement from PR #69 - HTTPS URLs with any pushurl (single or multiple) are processed in parallel as they're assumed to be public/read-only.