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

Add a HASH part #222

Merged
merged 4 commits into from Oct 3, 2023
Merged

Add a HASH part #222

merged 4 commits into from Oct 3, 2023

Conversation

atwam
Copy link
Contributor

@atwam atwam commented Oct 3, 2023

Hi,
Having spent now a few months with bumpver for a project, I became frustated by the GITHASH part:
Because GITHASH forces a starting . then a hash, it is not possible to have a version that matches
both v2023.40.0 and v2023.40.0+1234. The former can be obtained with vYYYY.0W.INC0, the latter with vYYYY.0W.GITHASH. If one combines both with vYYYY.0W[.INC0][GITHASH], then trying to set a version to
v2023.40.0 will just omit the last .0, because it's the default value of optional .INC0. The resulting version v2023.40
is not semver compliant, and will break some tools (for example cargo)

I have added the HASH part, to be any hexadecimal hash.
This is useful to add a hash-like that may come from any checksum, vsc.

This allows patterns where a hash may be present or ommitted, such as vYYYY.0W.INC0[\+HASH] which can accept v2023.40.0 or v2023.40.1+abc123

HASH can be any hexadecimal hash.
This is useful to add a hash-like that may come from any
checksum, vsc.

This allows patterns where a hash may be present or ommitted, such
as vYYYY.0W.INC0[\\+HASH] which can accept v2023.40.0 or
v2023.40.1+abc123
@mbarkhau
Copy link
Owner

mbarkhau commented Oct 3, 2023

I've renamed the part to HEXHASH, primarily to avoid this lint error: A001 variable "hash" is shadowing a python builtin.

@mbarkhau
Copy link
Owner

mbarkhau commented Oct 3, 2023

As with the GITHASH part, I'm going to leave this undocumented. Ultimately I think this still needs some work to be populated automatically. As far as I can tell, this part can only be populated using --set-version, which defeats a large part of the purpose of bumpver.

@atwam
Copy link
Contributor Author

atwam commented Oct 3, 2023

Thanks for fixing the checks. I agree that this defeats partly the purpose of bumpver, or rather it makes a partial use of it in my case:

  • bumpver still sets the calendar part of things
  • That part is then combined with a git describe for the last part of the hash
  • And then we use set-version for bumpver to update the various files.
    But thanks for adding this.

@mbarkhau mbarkhau merged commit 6953b35 into mbarkhau:master Oct 3, 2023
2 checks passed
@mbarkhau
Copy link
Owner

mbarkhau commented Oct 3, 2023

Fixed with 2023.1127

@atwam atwam deleted the add-hash-part branch October 4, 2023 07:35
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.

None yet

2 participants