Ever since we switched from SVN/Ant to Mercurial/Maven I have been experiencing a lot of merge problems between release branches. The following scenario is typical:
- We have a release branch, named something like stable-3-7-x, where we publish a new release with the maven release plugin.
- Then we merge the changes into a different branch (or the trunk, depending on the circumstances).
Invariably this leads to lots of merge conflicts on the Maven pom files, because every single line that specifies the version of the branch in question (at least one per pom, usually many more) has conflicting version edits in each branch. This is a major pain.
Until now I had no effective way of dealing with this, but recently I found some procedure that seems to work:
- I merge the usual way, leading lots of pom conflicts.
- I mark the poms as resolved without further ado and commit with conflicting edits still in place.
- Then I revert all pom.xml files to the last revision before the commit step above.
- Finally, I commit the reverted pom files.
This seems to work fine: we revert the pom files in the target branch to the state just before the merge (i.e., before the 'wrong' and conflicting versions of a different release branch were pulled in). This is usually OK.