Fix status reporting, unify dry-run JSON schema, support non-git VCS#514
Merged
Fix status reporting, unify dry-run JSON schema, support non-git VCS#514
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #514 +/- ##
==========================================
+ Coverage 80.83% 81.54% +0.70%
==========================================
Files 16 16
Lines 2249 2254 +5
Branches 471 473 +2
==========================================
+ Hits 1818 1838 +20
+ Misses 276 266 -10
+ Partials 155 150 -5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
94b9e19 to
330132f
Compare
why: When no upstream is tracked, ahead/behind stayed at 0, causing _determine_plan_action to report "up to date" instead of "remote state unknown." what: - Change ahead/behind initialization from 0 to None - None propagates correctly when upstream is unavailable - _determine_plan_action already handles None via isinstance check
…matter why: JSON dry-run output bypassed OutputFormatter, producing a different schema (nested workspaces) than other commands (flat array) and skipping centralized output logic. what: - Replace sys.stdout.write(json.dumps(...)) with formatter.emit() calls - JSON and NDJSON dry-run now use the same emit path - Update test parsing to expect flat JSON array format - Remove unused json import
…nSync why: Return type was annotated as GitSync but create_project() returns GitSync | HgSync | SvnSync. The type:ignore comment masked this. what: - Import HgSync and SvnSync from libvcs - Change return type to union of all VCS sync types - Add explicit type annotation on create_project result - Remove type:ignore and TODO comments - Add isinstance assertions in tests that access git-specific attributes
why: The _theme colorization code hooks into CPython 3.13+ argparse internals but lacked type documentation and test coverage, leading reviewers to mistakenly flag it as dead code. what: - Add _HelpTheme protocol documenting the argparse theme attributes - Type _fill_text's getattr with cast to _HelpTheme | None - Type _colorize_example_line's theme param as _HelpTheme instead of Any - Update class docstring explaining the CPython integration - Add tests/cli/test_formatter.py with 11 tests covering: - _fill_text with None theme (pre-3.13 fallback) - _fill_text with mock theme (colorization active) - _fill_text with non-example text (passthrough) - Section heading variants - Parameterized _colorize_example_line token classification
why: argparse _theme was added in CPython 3.14 (PR #132323), not 3.13. what: - Fix docstring references in _HelpTheme and VcspullHelpFormatter - Fix test comment referencing pre-3.13 path
why: Since v1.53.0 bare `vcspull sync` prints help; needs --all or a pattern. what: - Update README.md sync example to use --all - Update docs/quickstart.md sync examples to use --all
…orkspace_mapping why: After _emit_plan_output was refactored to stream entries through formatter.emit(), these methods were dead code only called from their test. what: - Remove to_workspace_mapping() and to_json_object() from PlanResult - Remove test_plan_result_grouping_and_json_output test - Clean up unused PlanResult import in test file
why: Missing flags caused the formatter to misclassify the next token when those options appeared in help example lines. what: - Add --exit-on-error, -x, --fetch, --long, --offline, --relative-paths, --show-unchanged, --summary-only, --version, -V, --no-concurrent, --sequential, --no-merge, --verbose to OPTIONS_FLAG_ONLY - Add --max-concurrent, --name, --url to OPTIONS_EXPECTING_VALUE - Add parametrized tests for representative new flags
…counts why: Non-git directories have clean=None, which was treated as falsy and counted as dirty in the summary. what: - Use identity checks (is True / is False) instead of truthiness - Add test verifying non-git dirs are not counted as dirty
…in dry-run why: The actual sync (update_repo → create_project) supports all VCS types. Only the dry-run plan was blocking non-git repos. what: - Change non-git repos from BLOCKED to UPDATE with descriptive detail - Update test fixture to expect PlanAction.UPDATE
why: When multiple patterns match the same repo (e.g. "myrepo" and "*"), the repo was synced multiple times. what: - Add deduplication by path after the pattern-matching loop - Add test verifying a repo matched by two patterns only syncs once
why: discover_repos only scans for .git directories; .hg and .svn are not detected despite vcspull supporting all three VCS types. what: - Add TODO comment noting the missing .hg/.svn scanning
why: update_repo supports all VCS types via create_project but only had git-focused tests. what: - Add test_update_repo_svn using create_svn_remote_repo fixture - Add test_update_repo_hg using create_hg_remote_repo fixture - Both use skip decorators for graceful skip when binaries unavailable - Use bare file:// URLs with explicit vcs since VCS binaries don't understand the vcs+ prefix used by vcspull for detection
why: -d is the short form of --detailed but was absent from OPTIONS_FLAG_ONLY, causing the formatter to misclassify the next token after -d in help example lines. what: - Add "-d" to OPTIONS_FLAG_ONLY set
why: Inline imports inside function bodies are harder to find and violate the project convention of top-level stdlib imports. what: - Move `import json` from inside test_sync_deduplicates function to module-level imports
e9d02c8 to
a07516e
Compare
Member
Author
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code |
why: The dry-run --json output changed from a nested workspace schema to a flat array. Scripts parsing sync --dry-run --json would break. what: - Move cli(sync) OutputFormatter entry from Bug fixes to Breaking changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Fixes incorrect repository status counts, standardizes the
sync --dry-runJSON output schema, and improves support forSVN / Mercurial repositories in status checks and dry-run plans.
Breaking: dry-run JSON schema changed
sync --dry-run --jsonpreviously emitted a nestedworkspace-grouped object. It now emits a flat array of plan
entries, matching the schema used by
sync --jsonandstatus --json. Scripts consuming the old nested format willneed updating.
Status reporting fixes
shown as "up to date" (
ahead=0, behind=0instead ofNone)as "dirty" in the summary even though their clean state is
unknown
Sync improvements
synced only once (deduplicated by path)
UPDATEin dry-run plans instead ofBLOCKED, sinceupdate_repoalready supports SVN and Hgupdate_reporeturn type corrected fromGitSynctoGitSync | HgSync | SvnSyncHelp formatter completeness
_HelpThemeprotocol documenting CPython 3.14+ argparsecolor attributes
-d,-x,-V,--fetch,--offline,--verbose,--max-concurrent,--name,--url, and others)Docs
syncexamples to use--all(matching the v1.53.0 CLI change)
Test plan
SVN/Hg sync tests)