1
votes

We need to merge changes from branch to trunk.
And we do not need any changes that we did in trunk since branch was created.
1. We do not need to merge sources - we need to replace sources in trunk with sources in branch. 2. We do not need files and directories that was created in trunk but does not exist in branch(or was deleted in branch).

How it would be better to merge sources in this case?

For now I have trunk and branch b1:
http://svnhost/svn/mtest/trunk
http://svnhost/svn/mtest/branches/b1

  1. I can move trunk to some branches directory and move branch b1 to trunk:

    svn move http://svnhost/svn/mtest/trunk http://svnhost/svn/mtest/branches/branch4trunk
    svn copy http://svnhost/svn/mtest/branches/b1 http://svnhost/svn/mtest/trunk

  2. I can remove all not needed files and directories in trunk an then merge branch to trunk

    svn co http://svnhost/svn/mtest/trunk
    cd trunk
    svn merge --reintegrate http://svnhost/svn/mtest/branches/b1

    Bit is it possible to force do not merge files but replace them?

Are there any pitfalls in these cases?
We use Subversion 1.5

I do not like the first case because I need to replicate SVN sources to MKS repository.
Our tools automatically removes files from MKS repository when such files was removed from SVN repository.
But if I move branch to trunk there will not be any actions about such files.
So I have to manually remove a lot of files from MKS repository.
It is not a good idea :(
I would like to have real actions modified/added or removed.

3

3 Answers

1
votes

I would do it like this:

svn co http://svnhost/svn/mtest/trunk
cd trunk
svn merge http://svnhost/svn/mtest/trunk http://svnhost/svn/mtest/branches/b1

This is saying, "take the changes that get me from trunk to branch, and apply them to the trunk."

In other words, "tell me the changes that would transform trunk into branch...and do them!"

0
votes

I've done option 1 myself and can report no pitfalls. If I understand correctly, you want to blow away the trunk and replace it outright with a branch, so... just do that!

0
votes

You could rollback all the changes in trunk since the branch was made, then simply re-integrate the branch into trunk in the normal way.

This is basically a reverse merge of all the changes on trunk since the branch, and gives you one revision which removes them all. Then the branch changes come in on top of that.