semver icon indicating copy to clipboard operation
semver copied to clipboard

Incrementing

Open ben-biddington opened this issue 9 years ago • 4 comments

Glad to find this library does most things -- are there plans to align versioning incrementing with semver 2.0.0?:

... Patch and minor version MUST be reset to 0 when major version is incremented.

semver incrementing major does not zero minor and patch.

(I will add it of you're interested.)

ben-biddington avatar May 29 '15 01:05 ben-biddington

I had no actual plans to include versioning incrementing, but if you contribute the functionality, I certainly welcome it.

maxhauser avatar Jun 01 '15 05:06 maxhauser

What are people's thoughts on an Increment(Part) method where Part is an enum of Major, Minor, Patch vs three methods IncrementPatch(), IncrementMinor(), IncrementMajor()?

Also, what should happen to the prerelease and build metadata when incrementing. I'm kind of thinking they should be cleared, but I can imagine situations where you wouldn't want that.

WalkerCodeRanger avatar Oct 25 '19 23:10 WalkerCodeRanger

An alternative API would be a Next(Part) method or NextMajorVersion, NextMinorVersion, and NextPatchVersion.

Another question is how these should handle starting from prerelease. For example SemVersion.Parse("1.1.0-rc").NextMinorVersion(), should that return 1.1.0 or 1.2.0?

WalkerCodeRanger avatar Jun 19 '21 15:06 WalkerCodeRanger

What are people's thoughts on an Increment(Part) method where Part is an enum of Major, Minor, Patch vs three methods IncrementPatch(), IncrementMinor(), IncrementMajor()?

I prefer the fixed methods <name>Patch(), <name>Minor(), <name>Major() to not introduce any new types. However for the name I'd say the Next<type>Version() methods are more clear on intent to create a new successor version instead of incrementing the current one.

Also, what should happen to the prerelease and build metadata when incrementing. I'm kind of thinking they should be cleared, but I can imagine situations where you wouldn't want that.

I dont think metadata or prereleases should be kept. A new version definitely signals a new build context (new (or the same) metadata can be added in a second call if needed). Prereleases should also be cleared in my opinion, as they refer to the patch version instead of the minor in case of a bump.

cn-ml avatar Aug 01 '23 21:08 cn-ml