Skip to content

Commit faab7ff

Browse files
committed
feat(import[provenance]): Add log message for provenance-only config saves
why: When only provenance tags are stamped (no adds/updates/prunes), save_config writes the file but no log message informs the user the config was modified. what: - Add log.info for provenance_tagged_count > 0 using muted bullet style - Add test_import_provenance_tagging_logs_message verifying log output
1 parent ec008a9 commit faab7ff

2 files changed

Lines changed: 51 additions & 0 deletions

File tree

src/vcspull/cli/import_cmd/_common.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,6 +1101,13 @@ def _run_import(
11011101
colors.info(str(updated_url_count)),
11021102
colors.muted(display_config_path),
11031103
)
1104+
if provenance_tagged_count > 0:
1105+
log.info(
1106+
"%s Tagged %s repositories with import provenance in %s",
1107+
colors.muted("•"),
1108+
colors.info(str(provenance_tagged_count)),
1109+
colors.muted(display_config_path),
1110+
)
11041111
if skip_unchanged_count > 0:
11051112
log.info(
11061113
"%s %s repositories unchanged",

tests/cli/test_import_repos.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3503,6 +3503,50 @@ def test_import_skip_unchanged_tags_provenance_string_entry(
35033503
assert entry["metadata"]["imported_from"] == "github:testuser"
35043504

35053505

3506+
def test_import_provenance_tagging_logs_message(
3507+
tmp_path: pathlib.Path,
3508+
monkeypatch: MonkeyPatch,
3509+
caplog: pytest.LogCaptureFixture,
3510+
) -> None:
3511+
"""Provenance-only save emits a log message about tagged repositories."""
3512+
caplog.set_level(logging.INFO)
3513+
monkeypatch.setenv("HOME", str(tmp_path))
3514+
workspace = tmp_path / "repos"
3515+
workspace.mkdir()
3516+
config_file = tmp_path / ".vcspull.yaml"
3517+
3518+
# Existing entry with matching URL — will be SKIP_UNCHANGED
3519+
save_config_yaml(
3520+
config_file,
3521+
{"~/repos/": {"repo1": {"repo": _SSH}}},
3522+
)
3523+
3524+
importer = MockImporter(repos=[_make_repo("repo1")])
3525+
_run_import(
3526+
importer,
3527+
service_name="github",
3528+
target="testuser",
3529+
workspace=str(workspace),
3530+
mode="user",
3531+
language=None,
3532+
topics=None,
3533+
min_stars=0,
3534+
include_archived=False,
3535+
include_forks=False,
3536+
limit=100,
3537+
config_path_str=str(config_file),
3538+
dry_run=False,
3539+
yes=True,
3540+
output_json=False,
3541+
output_ndjson=False,
3542+
color="never",
3543+
sync=True,
3544+
import_source="github:testuser",
3545+
)
3546+
3547+
assert "Tagged 1 repositories with import provenance" in caplog.text
3548+
3549+
35063550
# ---------------------------------------------------------------------------
35073551
# --prune standalone flag tests
35083552
# ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)