Mercurial close before merge not working

Hi we are currently using RhodeCode 4.19.2 community on a private server.

We have the global vcs setting “Close branch before merging it” enabled.
However for all of our pull requests when using server-side merging, the branch is being closed after the merge, leaving behind the branch head.

Can anyone give me any pointers as to why this might be?
The merge checks on the pull requests tell me its going to be closed after merge, but I dont know why, given we have enabled this setting to avoid this.

Many Thanks.

We’re going to check this, and get back to you.

Cheers

thanks @rhodecode-support look forward to hearing from you.

After some thinking, we decided this is infact subotimal, we’ll change the order, and close the branch before the merge.

Thanks thats good news.
From looking at the code myself, I suspect the merge / close are happening in the right order, but the required pushes appear to happen out of order, merge first then close. I didnt get a far as experimenting locally myself so I cannot confirm this. I havent looked at it for a few days, so I will check later today and post more detail if I can.

Thanks,

Here’s the relevant code for this: https://code.rhodecode.com/rhodecode-enterprise-ce/files/default/rhodecode/lib/vcs/backends/hg/repository.py?at=default#L808-819

You might want to edit this on your instance if you want to experiment more.

We’ve fixed this now. It will be included in the next release 4.20.X If you want you can apply this patch on top of your current CE code, and it will change the behavior to the expected.

https://code.rhodecode.com/rhodecode-enterprise-ce/artifacts/download/0-9b13c54e-f5e5-4547-8b58-0ce5d52a2d34.diff