I use automatic branch merging for release branches into the master branch. This has worked for the most part except for this case.
We name the release branches in the following way: release/V9.0, release/V9.1, release/V9.2
We created a new branch
release/V10.0
When I merge a pull request created off of release/V9.1 to that branch, the automatic merge dialog shows that it will automerge to release/V9.2 and then to master. I was expecting to see that it merge from release/V9.2 to release/V10.0 and then from release/V10.0 to master.
I've tried recreating this in a simple repo with the same branching structure and can reproduce this issue. It's unclear to me where the branch ordering algorithm is failing but it doesn't seem to detect that V10.0 is greater than V9.1 or V9.2.
Is this a known issue with how we are naming our branches?
Thanks in advance!
Tim
Hi Timothy,
Thanks for your question. I had a look at the documentation for the Branch ordering algorithm, and it states:
Bitbucket Server uses the following ordering algorithm to determine the branches in the merge chain:
- Branches are selected and ordered on the basis of the name of the branch that started the cascade (i.e. the target of the pull request for the merge).
- Branch names are split into tokens using any of these characters: underscore '_', hyphen '-', plus '+', or period '.'.
- Only branches matching the name of the pull request target are added into the merge path. Matching means that every token before the first numeric token must be equal to the corresponding tokens of the target branch's name.
- Branches are ordered by number, if a given token is numeric. When comparing a numeric token with an ASCII token, the numeric is ranked higher (i.e. is considered as being a newer version).
- If both tokens are non-numeric, a simple ASCII comparison is used.
- In the unlikely case of the above algorithm resulting in equality of 2 branch names, a simple string comparison is performed on the whole branch name.
- There is a limit of 30 merges.
Following this logic, your branch name V9.2 and V10.0 would be split into these tokens:
"V9" and "V10" are non-numeric, so an ASCII comparison is used. I don't know the implementation details of this comparsion, but I would expect this is where the problem occurs.
As per the above specification, I would highly recommend adding an underscore '_', hyphen '-', plus '+', or period '.' after 'V'. For example, V10.0 becomes V.10.0. Then, the tokenization would look like:
Which should work without issues.
I hope this helps! Cheers
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.