Skip to content

Commit 4b2e97e

Browse files
authored
vcspull fmt: Detect and merge identical roots, snapshot tests (#479)
Summary: - enable `vcspull fmt` to detect duplicate workspace roots and merge entries by default, logging detailed normalization hints - introduce `--no-merge` to retain duplicate sections while still reporting diagnostics for manual review - run formatting across all discovered configs (`--all`) with merge control, reusing the new logic - switch formatter unit and CLI tests to Syrupy snapshots (`snapshot_json` and custom `snapshot_yaml`) so dictionary ordering and YAML output stay stable - document the change in CHANGES under Improvements and Development, linking to PR #479 Testing: - uv run ruff check . --fix --show-fixes - uv run ruff format . - uv run mypy - uv run py.test
2 parents cab8fd9 + 0456d73 commit 4b2e97e

20 files changed

+611
-43
lines changed

CHANGES

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,24 @@ $ uvx --from 'vcspull' --prerelease allow vcspull
3333

3434
_Upcoming changes will be written here._
3535

36+
### Improvements
37+
38+
#### `vcspull fmt` gains duplicate root merging (#479)
39+
40+
- Detects repeated workspace root labels and merges their repositories during
41+
formatting so users keep a single normalized section.
42+
- Adds `--no-merge` for workflows that need to preserve duplicate entries while
43+
still seeing diagnostic warnings.
44+
45+
### Development
46+
47+
#### Snapshot coverage for formatter tests (#479)
48+
49+
- Formatter scenarios now use [Syrupy]-backed JSON and YAML snapshots to guard
50+
against regressions in duplicate workspace-root merging.
51+
52+
[syrupy]: https://github.com/syrupy-project/syrupy
53+
3654
## vcspull v1.42.0 (2025-11-01)
3755

3856
### Breaking changes

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ dev = [
8585
# Testing
8686
"gp-libs",
8787
"pytest",
88+
"syrupy",
8889
"pytest-asyncio",
8990
"pytest-rerunfailures",
9091
"pytest-mock",
@@ -119,6 +120,7 @@ docs = [
119120
testing = [
120121
"gp-libs",
121122
"pytest",
123+
"syrupy",
122124
"pytest-asyncio",
123125
"pytest-rerunfailures",
124126
"pytest-mock",

src/vcspull/cli/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,4 +386,9 @@ def cli(_args: list[str] | None = None) -> None:
386386
dry_run=args.dry_run,
387387
)
388388
elif args.subparser_name == "fmt":
389-
format_config_file(args.config, args.write, args.all)
389+
format_config_file(
390+
args.config,
391+
args.write,
392+
args.all,
393+
merge_roots=args.merge_roots,
394+
)

0 commit comments

Comments
 (0)