Repository navigation
x-add-version --overwrite-version: update the version scheme - #2153
Merged
Billy O'Neal (BillyONeal) merged 6 commits intoNov 13, 2026
Merged
Billy O'Neal (BillyONeal) merged 6 commits into
Billy O'Neal (BillyONeal) merged 6 commits into
Conversation
When only the version scheme of a port changed (for example from "version" to "version-semver"), --overwrite-version kept the old scheme in the versions file, and if the git tree already matched it reported that nothing needed to be updated. x-ci-verify-versions then kept suggesting --overwrite-version to fix the mismatch. Compare the recorded scheme as well: without --overwrite-version a scheme change is reported as an error, and with it the scheme is rewritten together with the git tree. Fixes microsoft#2106
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The --all --overwrite-version shortcut bypasses scheme repair, and the option help remains outdated.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Updates x-add-version --overwrite-version to detect and rewrite version schemes alongside git trees.
Changes:
- Compares recorded and declared version schemes.
- Adds end-to-end coverage for changed and stale schemes.
| File | Description |
|---|---|
src/vcpkg/commands.add-version.cpp |
Detects and updates scheme mismatches. |
azure-pipelines/end-to-end-tests-dir/versions.ps1 |
Tests scheme mismatch handling. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
1. Remove meaningless CurrentTest assignments 2. Fix help text comment 3. Fix newlines handling in the test
Billy O'Neal (BillyONeal)
left a comment
Member
There was a problem hiding this comment.
Would you consider merging Kiptoo-Deus#1 ? That will fix the other two copilot things.
overwrite-version-scheme code review nitpicks
Billy O'Neal (BillyONeal)
added a commit
that referenced
this pull request
Nov 2, 2026
An optimization I added in #2050 is complained about by @copilot in #2153 ; it points out that the "version tree shortcut" is unsound. If the version is wrong, but the tree is correct, we don't check it. With this revert it's down to about 6x faster rather than 10x faster (vs. before #2050 ) in my testing.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Billy O'Neal (BillyONeal)
enabled auto-merge (squash)
November 4, 2026 21:55
…-scheme Fixed conflicts where $CurrentTest assignments were restored. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
David Justo (davidmrdavid)
approved these changes
Nov 13, 2026
Victor Romero (vicroms)
approved these changes
Nov 13, 2026
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.



Fixes #2106.
update_version_db_filematched an existing entry by version text and port-version only, so it never compared the version scheme:"version"while the port declares"version-semver", andx-add-version --overwrite-versionprintsNo files were updated.--overwrite-versionreplaced onlygit_treeand kept the old scheme.In both cases
x-ci-verify-versionsthen reports the scheme mismatch and suggestsvcpkg x-add-version <port> --overwrite-version, which doesn't fix it.Now the recorded scheme is compared as well. A scheme change without
--overwrite-versionis an error (reusing theVersionSchemeMismatch1/VersionSchemeMismatch2text fromx-ci-verify-versions, so there are no new messages), and with--overwrite-versionthe scheme is rewritten together with the git tree. A changed git tree without--overwrite-versionstill gives the existing error.Added end-to-end tests in
versions.ps1with a newsquidport, covering both cases: a committed scheme change (git tree changed), and a versions file with the correct git tree but a stale"version"scheme. Each must fail without--overwrite-versionand record"version-semver"with it.I don't have PowerShell on this machine, so I ran the same steps with the built
vcpkgfrom zsh on macOS (arm64) against a scratch git repository. Every step gives the expected result with this change. Onmain, the stale-scheme case exits 0 without--overwrite-version, and with it still leaves"version": "1.0.0"in the file. Before the fix,x-ci-verify-versionsfailed on the result; after it, it passes.clang-format20.1.8 makes no changes.