Use svn move to move the contents of the old trunk somewhere else and rename the branch to trunk afterward.
Note that copy and move in svn work like file operations. You can use them to move/copy stuff around in your repository and these changes are versioned as well. Think of "move" as "copy+delete".
[EDIT] Nilbus just notified me that you will get merge conflicts when you use svn move
.
I still think that this is the correct approach. It will cause conflicts but if you merge carefully, chances are that you won't lose any data. If that bothers you, use a better VCS like Mercurial or Git.
I agree with using the svn move command to accomplish this goal.
I know others here think its unusual, but I like to do it this way. When I have a feature branch and am ready to merge it with a trunk that has also be significantly modified, I will merge it to a new branch, usually named <FeatureBranchName>-Merged
. Then I resolve conflicts and test the merged code. Once that's complete I move the trunk to the tags folder so I don't lose anything. Lastly I move my <FeatureBranchName>-Merged
to the trunk.
In addition I prefer to avoid the working copy when doing the moves, here are samples of the commands:
svn move https://SVNUrl/svn/Repo/trunk https://SVNUrl/svn/Repo/tags/AnyName
svn move https://SVNUrl/svn/Repo/branches/BranchName-Merged https://SVNUrl/svn/Repo/trunk
Note: I use 1.5
I was just looking at this problem recently, and the solution that I was very happy with was performing
svn merge --ignore-ancestry trunk-url branch-url
on the working copy of my trunk.
This does not try to apply changes in a historical manner (maintaining changes in the trunk). It simply "applies the diff" between the trunk and the branch. This will not create any conflicts for your users in the files that were not modified. You will however lose your Historical information from the branch, but that happens when you peform a merge anyway.
Recommend you do these changes via the repository browser tool.
Attempting large delete+move operations via the working copy is a great way to kill the working copy. If you are forced to use the working copy, perform incremental commits after each delete or move operation and UPDATE your working copy after each commit.
If you want to make the branch the new trunk (i.e.) get rid of all changes in the trunk which were made since the branch was created, you could 1. Create a branch of the trunk (for backup purposes) 2. "revert changes" on the trunk (select all revisions after the branch was created 3. Merge branch back to trunk.
History should be remaining this way.
Regards, Roger
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With