callowayproject/bump-my-version

unable to tag if a commit is not being made

Closed this issue · 3 comments

  • bump-my-version version: 0.15.3
  • Python version: 3.11.6
  • Operating System: Arch Linux 6.6.8

Description

My goal for version bumping behavior is for it to be opinionated, yet run in the background silently in a manner where you don't really need to care about its existence unless you are doing something like bumping a major version.

Personally, I strongly dislike creating commits every time a version is bumped. Every commit inherently describes a version of software, and I don't want an extra commit just to assert the version number of the previous commit. Therefore, my CI jobs use a mix of git describe and a version bumper like bump2version to automatically determine a fitting version depending on branch and other factors. This is especially important to me in environments where builds are often deployed somewhere, not only on the main branch.

I am moving to bump-my-version as bump2version is deprecated, but from what I can see, bump-my-version does not allow you to simply create a tag for the most recent commit, without editing files and committing it. This does not support my use-case, i don't want every second commit on my main branch to be a "bumped version" commit. This is a good use-case for many, especially larger projects with many moving parts, but not for me.

What I did to test:

 $ bump-my-version bump --tag --current-version "0.20.0" --verbose minor
Starting BumpVersion 0.15.3                                                                                                                         
Reading configuration                                                                                                                               
  Parsing current version '0.20.0'                                                                                                                  
    Parsing version '0.20.0' using regexp '(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)'                                                          
      Parsed the following values: major=0, minor=20, patch=0                                                                                       
  Attempting to increment part 'minor'                                                                                                              
    Values are now: major=0, minor=21, patch=0                                                                                                      
  New version will be '0.21.0'                                                                                                                      
                                                                                                                                                    
No configuration file found to update.                                                                                                              
Would not commit                                                                                                                                    
Would not tag since we are not committing                                                                                                           
Done.                                                                                                                                               

My suggestion

I suggest a new command line flag, --force-tag, which acts like --tag but also forces a new tag to be created, regardless of whether or not a commit will be made.

I am more than willing to make this change myself, but I want to discuss it with the project owners first to ensure it would actually be welcome.

Thank you for your consideration, and thank you for your efforts on maintaining this project.

Also may I add, from what I can see without having read the entire history of this package, it seems that the original goal was backwards-compatability: c4urself/bump2version#268

In that case this behavior would be a bug.

You are correct, the original commit and tag behavior were decoupled.

This is an error on my part.

If you could fix this behavior, I would appreciate it. Otherwise I will get to it soon.

Ok @coordt , I made an attempt at fixing it. What do you think?