Closed YishGene closed 2 months ago
Hi! This is intentional:
Version.bump()
always bumps and lets you bump by more than 1. This is for cases where you have custom logic/conditions and want more control.
bump_version()
is the same, but only for the base.Version.serialize(bump=True)
only bumps when distance != 0
and only bumps by 1. This is for streamlining the most common case.The CLI only exposes the latter. I could add a --force-bump
/--bump-always
option if there's interest, though.
Hi!
Thanks for your quick reply!
I think the confusion on my side stems from "bumping" being something I thought someone would do to a version, so once I found a bump method, I stopped looking, assuming this is the way bumping works.
It required looking deep through the code to find that the cml bumps through the serialize method, which I wasn't expecting.
I think a possible solution here is to add a boolean to the Version.bump method in order to allow it to replicate the cml behavior.
Thanks, Yishai
On Thu, Mar 21, 2024, 14:35 Matthew Kennerly @.***> wrote:
Hi! This is intentional:
- Version.bump() always bumps and lets you bump by more than 1. This is for cases where you have custom logic/conditions and want more control.
- bump_version() is the same, but only for the base.
- Version.serialize(bump=True) only bumps when distance != 0 and only bumps by 1. This is for streamlining the most common case.
The CLI only exposes the latter. I could add a --force-bump option if there's interest, though.
— Reply to this email directly, view it on GitHub https://github.com/mtkennerly/dunamai/issues/79#issuecomment-2012171207, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBURVN5RH5EKB2XQY5TTTDYZLHZVAVCNFSM6AAAAABFBE2X6OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJSGE3TCMRQG4 . You are receiving this because you authored the thread.Message ID: @.***>
You can now do this in v1.20.0:
Version.from_any_vcs(Pattern.DefaultUnprefixed).bump(smart=True).serialize(format="{base}")
Great, thanks for the implementation!
using dunamai 1.19.2
Say I have a tag 1.3.0 in the current commit with a clean git. Running this:
produces '1.3.1' (desired: '1.3.0')
command line:
dunamai from any --pattern default-unprefixed --format "{base}" --bump
correctly produces 1.3.0Putting the bump inside serialize (emulating what the command line does) produces the correct 1.3.0.