tags:

views:

232

answers:

3

Here's the situation: On a particular branch, some changes have been merged in from the trunk, and also changes to the branch have been merged back into the trunk.

The question I have is this: What, if anything, does the merge management in Subversion do if I try to merge back into the trunk from the branch a revision that was in itself just a merge from the trunk to the branch?

Will this cause problems? If so, what sorts? Or should this be a perfectly fine thing to do?

Or does the new merge just treat those changes like any other and simply try to apply them?

+1  A: 

That's an scenario even the merge tracking of newer SVN versions can't handle automatically. So you have specify the revisions you want to merge back into the trunk manually and you have to make sure to exclude the revisions which are merges from trunk to the branch.

If you try remerge changes which are already present trunk they will be treated as normal modifications. This will lead to conflicts inevitably.

sebasgo
A: 

It depends partially on what version of svn you are using.

Pre 1.5, there was no merge tracking at all, so you would have to merge the revisions you wanted back in. Most people used a script name "svnmerge" for that. You can use this if you want, and mark the revisions you've already done as merged - after that, svnmerge will give you some help in picking the right revisions and skipping those already merged.

1.5 (and later) gives some merge tracking, but it is not yet full featured. In your particular case (merging both ways), I don't think svn's tracking can handle it. You will probably need to merge each revision you want back and forth manually.

Personally, when I'm on projects using svn, I prefer to make branches somewhat short-lived, and only merge one way (trunk to branch) until the final merge from branch to trunk. Once I've done that, I either merge everything into the trunk and close the branch, or I merge what I want and close the branch. Hardly ever do I keep the branch alive, due to possible merge issues (it's easy to make a mistake).

Philip Rieck
+1  A: 

Using 1.5 or later version of subversion, you have to specify --reintegrate option to svn merge in order for merges that are only copies of previous merges "the other way around".

Note that 1) It is up to you to know when you should to use this option 2) It will be the very last merge from that branch. After this merge svn will consider branch to be dead and further work will require destroying and re-creating the branch.

This is straight from svn docs, although the docs could use finer breakdown into subsections.

Laurynas Biveinis