6
votes

Lets say I have a feature branch named "branches/BigFeature". I want to push those changes to the Trunk, make some changes to Trunk and merge back it all back into the "BigFeature" branch so development can continue.

My steps were to:

  1. Merge the latest changes in Trunk to branches/BigFeature. (Tortoise SVN -> Merge a range of revisions)

  2. Merge the changes in branches/BigFeature to Trunk. (Tortoise SVN -> Reintegrate a branch)

  3. Make some changes to Trunk.

  4. Merge the changes in Trunk to branches/BigFeatures. (Tortoise SVN -> Merge a range of revisions)

The problem arises in step 4. When I merge back to BigFeature I get all kinds of conflicts. It seems to have a problem with files that were originally added in branches/BigFeature but were merged to the Trunk.

The message it gives me is "The last merge operation tried to add the file 'blah' but it was already added locally.

This kinda makes sense because the file was originally added in the branches/BigFeature branch and then merged to Trunk. But why can't the merge operation realize this? Why is it coming up as a conflict?

The same kind of error happens for deleted files.

The last merge operation tried to delete/move/rename the directory 'blah', but it was deleted, moved or renamed locally.

Thanks for you help.

1
SVN merge in general doesn't work well.alternative
Anyone who says svn merge doesn't work isn't doing it right. Svn's conceptual view of changes isn't the best (later SCMs such as git got it a little closer to the mark), but it's not true at all that one can't do merges with subversion or even manage a complicated codebase with merges coming in and out.Ether
Yes, there are alternatives, Git and MercurialJackie Chan

1 Answers

7
votes

Unfortunately it is a deficiency of svn, the way it is built.

The steps in svn must look like this:

1. (not modified) Merge the latest changes in Trunk to branches/BigFeature. (Tortoise SVN -> Merge a range of revisions)
2. (not modified) Merge the changes in branches/BigFeature to Trunk. (Tortoise SVN -> Reintegrate a branch)

2a. Delete branch branches/BigFeature
2b. Create branch branches/BigFeature from current trunk

3. (not modified) Make some changes to Trunk.
4. (not modified) Merge the changes in Trunk to branches/BigFeatures. (Tortoise SVN -> Merge a range of revisions)

SVN branch is no longer usable after a reintegrate operation.

Update: there is a second way, instead of deleting the branch.

2a. on branch: 
    $ svn update
    Updated to revision X
    $ svn merge --record-only -c X ^/trunk
    $ svn commit -m "Block revision X from being merged into the branch."

I did not know this trick, I learned it thanks to your question :D