11

I'm getting started with SVN and so many sources say that merging is very difficult in SVN as compared to DVCS tools. The most recent questions I could find here on SE are from 2012.

Sometimes there's a mention that the reason is that SVN prior to v1.5 didn't have metadata, but SVN is at version 1.8.9 now.

Given that SVN is now much more mature than v1.5, and especially the fact that we didn't use SVN 1.5 so we don't suffer from the mentioned lack of metadata -- is there still much validity in those arguments against SVN?

I understand that DVCS has a completely different approach which is often more desirable, but for those who "must" ues SVN for whatever reason, merging isn't really "hell" anymore, is it?

2 Answers2

15

It works fine if you stick to the simple cases, but there are some complex ones that don't.

The limitations I can think of:

  • It can only find the most recent ancestor if it is on one of the branches involved. So if you create branches/this and branches/that both from trunk and then try to merge branches/this to branches/that, it will not know what to do. Which means you can only merge branch to or from it's parent. You may run into this if you start two feature branches and later realize that the features are interdependent and need to combine them.

  • While it claims it can track renames, merging branches when files were moved on one side and modified on the other does not always find the right files to merge and manually fixing it up is somewhat tedious as it does not leave the necessary information around anywhere at hand.

  • Added files sometimes cause spurious conflicts on later merges.

  • Since subversion does not have separate concept of branch, you can merge only a subtree of a project and that can lead to big mess pretty quickly. It is strongly recommended to take care to always merge complete branches. Unfortunately for some reason sometimes the merge info properties appear on subdirectories even if they seem superfluous and the merge was correctly done to the whole branch.

  • Last but not least it is slow. Merges on a project of any serious size often takes minutes where most DVCS can do it under a second.

Jan Hudec
  • 18,410
1

From my experience, merging in SVN was 'fixed' in version 1.6. I work in both Mercurial and SVN, and since version 1.6 of SVN, merging seems to be about the same amount of work on both platforms. The one exception might be that you have to remember to provide the --reintegrate option when merging from a branch back into the trunk using SVN.

This is only my operational experience. I don't know anything about the internals of SVN.