Skip to content

Commit 1f00ace

Browse files
committed
fix(import[prune]) Increment skip_pinned_count in prune-phase SKIP_PINNED
why: The prune loop's SKIP_PINNED branch logged a per-entry message but never incremented skip_pinned_count, causing the summary line "Skipped N pinned repositories" to undercount when pinned entries are encountered during pruning. The classification-phase branch already incremented it. what: - Add skip_pinned_count += 1 after the prune-phase SKIP_PINNED log - Add test_import_prune_pinned_skip_count_in_summary verifying the summary reports the correct count
1 parent e6aa6ba commit 1f00ace

2 files changed

Lines changed: 52 additions & 0 deletions

File tree

src/vcspull/cli/import_cmd/_common.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,7 @@ def _run_import(
10141014
repo_name,
10151015
f" ({reason})" if reason else "",
10161016
)
1017+
skip_pinned_count += 1
10171018

10181019
if error_labels:
10191020
return 1

tests/cli/test_import_repos.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3759,6 +3759,57 @@ def test_import_prune_respects_pin(
37593759
assert "Skipping pruning pinned repo" in caplog.text
37603760

37613761

3762+
def test_import_prune_pinned_skip_count_in_summary(
3763+
tmp_path: pathlib.Path,
3764+
monkeypatch: MonkeyPatch,
3765+
caplog: pytest.LogCaptureFixture,
3766+
) -> None:
3767+
"""Prune-phase SKIP_PINNED increments skip_pinned_count for the summary."""
3768+
caplog.set_level(logging.INFO)
3769+
monkeypatch.setenv("HOME", str(tmp_path))
3770+
workspace = tmp_path / "repos"
3771+
workspace.mkdir()
3772+
config_file = tmp_path / ".vcspull.yaml"
3773+
3774+
save_config_yaml(
3775+
config_file,
3776+
{
3777+
"~/repos/": {
3778+
"pinned-repo": {
3779+
"repo": _SSH,
3780+
"options": {"pin": True},
3781+
"metadata": {"imported_from": "github:testuser"},
3782+
},
3783+
}
3784+
},
3785+
)
3786+
3787+
importer = MockImporter(repos=[_make_repo("repo1")])
3788+
_run_import(
3789+
importer,
3790+
service_name="github",
3791+
target="testuser",
3792+
workspace=str(workspace),
3793+
mode="user",
3794+
language=None,
3795+
topics=None,
3796+
min_stars=0,
3797+
include_archived=False,
3798+
include_forks=False,
3799+
limit=100,
3800+
config_path_str=str(config_file),
3801+
dry_run=False,
3802+
yes=True,
3803+
output_json=False,
3804+
output_ndjson=False,
3805+
color="never",
3806+
prune=True,
3807+
import_source="github:testuser",
3808+
)
3809+
3810+
assert "Skipped 1 pinned repositories" in caplog.text
3811+
3812+
37623813
def test_import_prune_dry_run(
37633814
tmp_path: pathlib.Path,
37643815
monkeypatch: MonkeyPatch,

0 commit comments

Comments
 (0)