Adding Merge Commit Version Strategy #4630
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
I'm posting this as a draft to get eyes on it and see if it's something to continue working on or not. Fair Warning: It's been a long time since I've worked with C#, so likely something I'm missing here. There may be someone else that wants/needs to pick it up from here.
This is my attempt at introducing an alternative strategy for identifying the version based on version names after the merger. The strategy works by looping through all the commits, looking for merges and/or tags. If it finds a merge branch, it then uses the source branch name in collaboration with the branch configuration to determine the version that the branch should have generated.
If it finds a tag, it uses it for a reset to the current version. By doing this, it allows for situations where a tag is resetting the version and/or a branch was merged in that normally should have incremented the version, but it was unintentional or incorrect.
Given the merged commit history of:
And the config of:
The version would be detected as:
Leaving you with a final version of 1.1.0.
Related Issue
#4624
#4433
Motivation and Context
I am working in an environment where there are over 90 team members all wanting to mark a feature or release as their own. This is creating a scenario where, many times, people are scratching their heads about what version a feature should go into or what version a release should be flagged. To circumvent this, I am trying to push to get Semantic Versioning adopted, but I need to be able to get the version post-merge, without any involvement from any of the developers requiring them to tag releases or similar. Once a branch is merged, the source branch name should dictate the new version name. By doing this, the developers need only be concerned with the basic rules of whether it's a feature or not, and of if it's backward compatible or not.
How Has This Been Tested?
I ran the changes against another project that has the same "post-merge" setup as discussed above. No automated testing has been done yet.
Screenshots (if appropriate):
N/A
Checklist: