Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support leading zeroes in version numbers #110

Open
Kissaki opened this issue Jan 25, 2023 · 2 comments
Open

Support leading zeroes in version numbers #110

Kissaki opened this issue Jan 25, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@Kissaki
Copy link

Kissaki commented Jan 25, 2023

I would like to use v<yy>.<MM>.<nr> version labels to have date/age and date order speaking version labels.
(We only have one version in production and no (sw/lib) users that would depend on the major minor patch split.)

convco supports the three digit semver format, but semver does not allow leading zeroes for an integer version number (which occurs for MM). convco seems to follow this requirement, and if MM has a leading 0 will not identify the version (and skip the label, even with a matching prefix).

Is this something you would consider supporting or out of scope?

It could be supported by adjusting the semver parsing into being more lenient (accepting leading zeroes despite spec demanding they do not exist - but they do not break the semantic meaning of major minor or patch).

Or possibly through a fallback behavior that accepts it "not called semver", or through additional configuration(?).

@Kissaki Kissaki added the enhancement New feature or request label Jan 25, 2023
@hdevalke
Copy link
Collaborator

As we use the semver crate to parse semantic versions, the version number has to be a valid semver. (see https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=64c27c173700ead9088e595b369dfda8)

What you describe is known as CalVer, but different schemas exist.

IMO this is out of scope as it has to work with all subcommands, which have some flags that are not compatible. E.g. what should --bump do for version? Ubuntu for example only has yy.mm[.patch] where mm always is 04 or 10.

@hdevalke
Copy link
Collaborator

I once made my own parser but never used it. I repushed the branch for reference. To make it lenient this line should change https://github.com/convco/convco/blob/custom-semver/src/semver.rs#L248.

However parsing it lenient would not make convco version --bump add a leading zero.
I think if we add calver support it should do it based on the calver rules and not an a lenient semver parser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants