Allow pinning of increments
MarkusH opened this issue · 6 comments
Thank you for building bumpver
. I really like using it.
I'm using a version pattern YYYY.MM.INC1
. This generates versions like 2022.11.1
, 2022.11.2
, 2022.12.1
.
I recently ran into the case where I needed to make a hotfix release for one of the versions. My initial thought was to just increment the INC1
part (and that's what I did in the end, due to the "missing" feature requested in here).
But thinking further, what I would've liked more, was a "hotfix" increment, resulting in e.g. 2022.11.2-1
. My approach was to add [-PATCH]
to the version pattern: YYYY.MM.INC1[-PATCH]
.
However, when running bumpver update --patch
, I ended up with 2022.11.3
instead of 2022.11.2-1
.
Looking into the --help
for update
, I spotted --pin-date
. With a version pattern YYYY.MM.DD[-PATCH]
the command worked as expected. But with INC1
instead of DD
it did not.
My understanding is, that the increment just can't be pinned. Thus, I'm requesting to add this feature.
Thanks for your feedback. Are you aware of --set-version
? This seems like it might solve your problem for the moment.
Apart from that, I'm not sure it's a good idea to change the behaviour of --pin-date
for such a corner case. Is there any other approach you can think of that wouldn't break something?
Thank you. Indeed, set-version
could be used in the interim. Thank you for that.
I agree, changing the behavior of --pin-date
seems like the wrong approach. Maybe a --pin-inc
or --pin-increments
instead?
That said, if you're generally open to the feature idea, I'm happy to take a look at an implementation suggestion.
Yeah, maybe --pin-all
. This would pin all parts unless they are explicitly incremented via a CLI flag.
Do you have any interest in implementing this?
Yes, I'll take a shot at an implementation.
As for --pin-all
, looking at all the individual parts that one can have, I'd group them into 3 groups:
- date related (
YYYY
,MM
,DD
,Q
, ...) - semver related (
MAJOR
,MINOR
,PATCH
,TAG
, ...) - automatically incremented values (
BUILD
,INC0
,INC1
)
As for 1., that's updated automatically, unless --pin-date
is provided. As for 2., that's only updated when --major
, --minor
, etc. are given. And for 3., that's updated always. So, for BUILD
, I think that pinning makes no sense right now. But for INC0
and INC1
it does. As such, --pin-all
would make no difference compared to --pin-increments
.
So, for now, I suggest I start with --pin-increments
and we can check how that goes.
With #197, my specific case can now be handled with bumpver update --patch --pin-date --pin-increments