Skip to content

Commit 6675320

Browse files
committed
Clean up comments
1 parent fb7e4c6 commit 6675320

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

doc/nbgv-cli.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@ version and the `versionIncrement` setting in `version.json`.
8484
To customize this behaviour, you can either explicitly set the next version
8585
or override the version increment setting.
8686

87-
To explicitly set the next version, run
87+
To explicitly set the next version, run:
8888

8989
```ps1
9090
nbgv prepare-release --nextVersion 2.0
9191
```
9292

93-
To override the `versionIncrement` setting from `version.json`, run
93+
To override the `versionIncrement` setting from `version.json`, run:
9494

9595
```ps1
9696
nbgv prepare-release --versionIncrement Major

src/NerdBank.GitVersioning/ReleaseManager.cs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using LibGit2Sharp;
77
using Validation;
88
using Version = System.Version;
9-
using static Nerdbank.GitVersioning.VersionOptions;
109

1110
/// <summary>
1211
/// Methods for creating releases
@@ -116,9 +115,9 @@ public ReleaseManager(TextWriter outputWriter = null, TextWriter errorWriter = n
116115
/// If specified, value will be used instead of the increment specified in <c>version.json</c>.
117116
/// Parameter will be ignored if the current branch is a release branch.
118117
/// </param>
119-
public void PrepareRelease(string projectDirectory, string releaseUnstableTag = null, Version nextVersion = null, ReleaseVersionIncrement? versionIncrement = null)
118+
public void PrepareRelease(string projectDirectory, string releaseUnstableTag = null, Version nextVersion = null, VersionOptions.ReleaseVersionIncrement? versionIncrement = null)
120119
{
121-
Requires.NotNull(projectDirectory, nameof(projectDirectory));
120+
Requires.NotNull(projectDirectory, nameof(projectDirectory));
122121

123122
// open the git repository
124123
var repository = this.GetRepository(projectDirectory);
@@ -280,7 +279,7 @@ private static bool IsVersionDecrement(SemanticVersion oldVersion, SemanticVersi
280279
}
281280
}
282281

283-
private SemanticVersion GetNextDevVersion(VersionOptions versionOptions, Version nextVersionOverride, ReleaseVersionIncrement? versionIncrementOverride)
282+
private SemanticVersion GetNextDevVersion(VersionOptions versionOptions, Version nextVersionOverride, VersionOptions.ReleaseVersionIncrement? versionIncrementOverride)
284283
{
285284
var currentVersion = versionOptions.Version;
286285

@@ -291,26 +290,26 @@ private SemanticVersion GetNextDevVersion(VersionOptions versionOptions, Version
291290
}
292291
else
293292
{
294-
// determine the increment to use.
295-
// Use parameter if it has a value, otherwise use setting from version.json
293+
// Determine the increment to use:
294+
// Use parameter versionIncrementOverride if it has a value, otherwise use setting from version.json.
296295
var versionIncrement = versionIncrementOverride ?? versionOptions.ReleaseOrDefault.VersionIncrementOrDefault;
297296

298-
// the increment is only valid if the current version has the required precision
299-
// increment settings "Major" and "Minor" are always valid
300-
// increment setting "Build" is only valid if the version has at lease three segments
301-
var isValidIncrement = versionIncrement != ReleaseVersionIncrement.Build ||
297+
// The increment is only valid if the current version has the required precision:
298+
// - increment settings "Major" and "Minor" are always valid.
299+
// - increment setting "Build" is only valid if the version has at lease three segments.
300+
var isValidIncrement = versionIncrement != VersionOptions.ReleaseVersionIncrement.Build ||
302301
versionOptions.Version.Version.Build >= 0;
303302

304-
// increment is ignored when the next version was specified explicitly
305303
if (!isValidIncrement)
306304
{
307-
this.stderr.WriteLine($"Cannot apply version increment 'build' to version '{versionOptions.Version}' because it only has major and minor segments");
305+
this.stderr.WriteLine($"Cannot apply version increment 'build' to version '{versionOptions.Version}' because it only has major and minor segments.");
308306
throw new ReleasePreparationException(ReleasePreparationError.InvalidVersionIncrementSetting);
309307
}
310308

311309
nextDevVersion = currentVersion.Increment(versionIncrement);
312310
}
313311

312+
// return next version with prerelease tag specified in version.json
314313
return nextDevVersion.SetFirstPrereleaseTag(versionOptions.ReleaseOrDefault.FirstUnstableTagOrDefault);
315314
}
316315
}

src/nbgv/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public static int Main(string[] args)
113113
prepareRelease = syntax.DefineCommand("prepare-release", ref commandText, "Prepares a release by creating a release branch for the current version and adjusting the version on the current branch.");
114114
syntax.DefineOption("p|project", ref projectPath, "The path to the project or project directory. The default is the current directory.");
115115
syntax.DefineOption("nextVersion", ref releaseNextVersion, "The version to set for the current branch. If omitted, the next version is determined automatically by incrementing the current version.");
116-
syntax.DefineOption("versionIncrement", ref releaseVersionIncrement, "Specifies how the next version for the current branch is determined overriding the 'versionIncrement' setting in version.json");
116+
syntax.DefineOption("versionIncrement", ref releaseVersionIncrement, "Overrides the 'versionIncrement' setting set in version.json for determining the next version of the current branch.");
117117
syntax.DefineParameter("tag", ref releasePreReleaseTag, "The prerelease tag to apply on the release branch (if any). If not specified, any existing prerelease tag will be removed. The preceding hyphen may be omitted.");
118118

119119
if (syntax.ActiveCommand == null)
@@ -579,7 +579,7 @@ private static ExitCodes OnPrepareReleaseCommand(string projectPath, string prer
579579
return ExitCodes.InvalidParameters;
580580
}
581581

582-
// parse versionIncrement is parameter was specified
582+
// parse versionIncrement if parameter was specified
583583
VersionOptions.ReleaseVersionIncrement? versionIncrementParsed = default;
584584
if (!string.IsNullOrEmpty(versionIncrement))
585585
{

0 commit comments

Comments
 (0)