Description
Use Case
When using a staging branch, you can stack changes on the staging branch by bumping the prerelease number for every change pushed.
Determining whether to use a major, minor or patch bump on each push requires you check the whether the current prerelease version has had the appropriate bump with respect to the currently released version on master.
For example, pushing a minor change to staging when staging is at 1.0.1-rc.1
and master is at 1.0.1
, the appropriate bump here would be bump_minor()
since the staging version is not more recent than the master version.
Subsequently (when staging is at 1.1.0-rc.1
and master still at 1.0.1
), a minor change or a patch change would not bump minor or patch, but instead bump the prerelease.
On the other hand, a major change would require a bump_major()
.
Hopefully the example illustrates where you would need to find the bump type needed to go from one version to another.
Situation
At the moment there is no simple explicit (or implicit) way to determine the diff bump between versions.
One must compare each part of the version to determine which is the bumped part.
This is trivial code that is prone to errors since it must be rewritten by anyone who wishes to achieve this task.
Proposition
Write a function maybe called diff
that takes two VersionInfo
objects and returns the differential bump (type: tbd).
At first, I was going to request that
__sub__
be implemented forVersionInfo
, but I figured out what I really wanted to do with this feature. I do think this would be a possible implicit way to achieve this goal, but there are simpler and better ways to do this explicitly, such as looping through the parts and returning the first one that is different.