Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 10, 2025

This PR adds a --what-if option to the nbgv prepare-release command that allows users to simulate the prepare-release operation and see what versions would be set without actually making any git changes.

What it does

The --what-if flag enables users to preview the results of a prepare-release operation before committing to it:

# See what versions would be set with default settings
nbgv prepare-release --what-if

# Preview with custom version increment
nbgv prepare-release --what-if --versionIncrement Major

# Get machine-readable JSON output
nbgv prepare-release --what-if --format json

Implementation

  • New --what-if option: Added to the prepare-release command with appropriate help text
  • SimulatePrepareRelease method: New method in ReleaseManager that performs all the same validation and version calculation logic as the regular PrepareRelease method, but without making any git changes
  • Consistent validation: The what-if mode uses the exact same validation logic, so errors and warnings are identical to the regular mode
  • Output formats: Supports both human-readable text output (with "What-if:" prefixes) and machine-readable JSON output
  • Comprehensive testing: Added 12 new tests covering various scenarios including version increments, prerelease tags, error conditions, and edge cases

Example outputs

Text format:

What-if: v3.8 branch would track v3.8 stabilization and release.
What-if: main branch would track v3.9-alpha development.

JSON format:

{
  "CurrentBranch": {
    "Name": "main",
    "Commit": "abc123...",
    "Version": "3.9-alpha"
  },
  "NewBranch": {
    "Name": "v3.8",
    "Commit": "abc123...",
    "Version": "3.8"
  }
}

This enhancement provides a safe way for users to understand the impact of prepare-release operations before executing them, addressing the need for predictable version management workflows.

Fixes #1019.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI changed the title [WIP] Simulate the future version Add --what-if option to prepare-release command for simulating version changes Aug 10, 2025
Copilot AI requested a review from AArnott August 10, 2025 19:31
…nd remove Array.Empty arguments

Co-authored-by: AArnott <[email protected]>
@AArnott AArnott marked this pull request as ready for review December 20, 2025 23:10
@AArnott AArnott enabled auto-merge December 20, 2025 23:11
@AArnott AArnott added this pull request to the merge queue Dec 20, 2025
Merged via the queue into main with commit e1a9804 Dec 20, 2025
12 checks passed
@AArnott AArnott deleted the copilot/fix-1019 branch December 20, 2025 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simulate the future version

2 participants