Skip to content

tests(remotes): git URL schemes #419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,23 @@ $ pipx install --suffix=@next 'vcspull' --pip-args '\--pre' --force

<!-- Maintainers, insert changes / features for the next release here -->

### Breaking changes

- Python 3.7 Dropped (#421)
- libvcs: Bumped from 0.22.2 -> 0.24.0 (#419)

### Bug fixes

- Git Remote URLs: Fix bug that would cause git remotes with `@` to be chopped off after the
protocol (#419, fixes #425)

### Development

- Refactor of two testsuites to used `NamedTuple` parametrization (#423):

- test_config_variations
- test_updating_remote

### Breaking changes

- Python 3.7 Dropped (#421)

## vcspull v1.22.0 (2023-09-02)

_Maintenance only, no bug fixes, or new features_
Expand Down
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ vcspull = 'vcspull:cli.cli'

[tool.poetry.dependencies]
python = "^3.9"
libvcs = "~0.22.1"
libvcs = "~0.24.0"
colorama = ">=0.3.9"
PyYAML = "^6.0"

Expand Down
44 changes: 42 additions & 2 deletions tests/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,28 @@ class ConfigVariationTest(t.NamedTuple):
""",
remote_list=["secondremote"],
),
ConfigVariationTest(
test_id="expanded_repo_style_with_unprefixed_remote",
config_tpl="""
{tmp_path}/study/myrepo:
{CLONE_NAME}:
repo: git+file://{dir}
remotes:
git_scheme_repo: [email protected]:tmux-python/tmuxp.git
""",
remote_list=["git_scheme_repo"],
),
ConfigVariationTest(
test_id="expanded_repo_style_with_unprefixed_remote_2",
config_tpl="""
{tmp_path}/study/myrepo:
{CLONE_NAME}:
repo: git+file://{dir}
remotes:
git_scheme_repo: [email protected]:tony/vcspull.git
""",
remote_list=["git_scheme_repo"],
),
]


Expand Down Expand Up @@ -131,7 +153,6 @@ def test_config_variations(
assert len(repos) == 1

for repo_dict in repos:
repo_url = repo_dict["url"].replace("git+", "")
repo: GitSync = update_repo(repo_dict)
remotes = repo.remotes() or {}
remote_names = set(remotes.keys())
Expand All @@ -142,7 +163,26 @@ def test_config_variations(
for remote_name in remotes:
current_remote = repo.remote(remote_name)
assert current_remote is not None
assert current_remote.fetch_url == repo_url
assert repo_dict is not None
assert isinstance(remote_name, str)
if (
"remotes" in repo_dict
and isinstance(repo_dict["remotes"], dict)
and remote_name in repo_dict["remotes"]
):
if repo_dict["remotes"][remote_name].fetch_url.startswith(
"git+file://"
):
assert current_remote.fetch_url == repo_dict["remotes"][
remote_name
].fetch_url.replace(
"git+", ""
), "Final git remote should chop git+ prefix"
else:
assert (
current_remote.fetch_url
== repo_dict["remotes"][remote_name].fetch_url
)


class UpdatingRemoteFixture(t.NamedTuple):
Expand Down