views:

934

answers:

3

I have a branch which I created from the trunk some time ago. Since I created the branch, I didn't touch the trunk. Now, I want to return from the branch to the trunk. This is a very simple case, since there's not much merging to do. Nothing changed in the trunk. The branch can fully replace the trunk.

As I see it, I have two options:

  1. Delete the trunk (rename it to something else, delete it later) and rename the branch to be the trunk.
  2. Merge the branch to the trunk (move my working copy to the trunk and use the Merge command from the branch).

I'm not sure which option is preferred. It is important for me to maintain the revision context (not to break the revision graph).

Any thoughts?

A: 

In your case I would prefer the first options The other way around all modifications you done in the branch are applied as one revision to the trunk. So you loose the revision information for those changes. If you move the branch to the location of your old trunk directory revision information stays intact.

sebasgo
Recent versions of SVN can show the commit information from merged-in branches. At least my TortoiseSVN allows that, and I suspect this to be a feature of SVN, not of Tortoise.
sbi
Yes that's true, but not the point: All the modifications you made in a branch end up as one commit in the trunk on merge. So if ask later in the trunk in which particular revision some change of the branch was made all you get is that it was part of an merge operation. Then of course you can check in the branch the change originated in which revision it was really made, but it is definitly more effort.
sebasgo
A: 

I think the easiest way (dont really know if it is the best to do) is to use "svn move" inorder for you to execute the first option.

Copy and move in svn should work like file operations, also these changes are versioned.

EDIT: My answer was almost like one of the answers on the previous topics mentioned by VonC so you should take a look at this answer

Diego Dias
+2  A: 

You really should use the merge option. The argument of loosing revision information as all changes will be inside 1 commit is negligible, as subversions merge-tracking will preserve this information. If you still have a pre-1.5 installation, you can note the revision range and the branch-path in your commit message.

As you did not change anything in trunk, the merge will be a no-brainer, as you just say:

svn merge branchname <Workingcopy-Path>

(Of course your Working copy should point to trunk)

Answers to your comment

svn 1.4 has no merge tracking, so you should not rollback

Why you should not rename branch to trunk:

This is just not the way you should work In your simple setup this would be working, however, your trunk will be deleted and all files will be added again, but you cannot easily track the changed files, as in your action all files were added.

If you merge, only files you changed in branch will be displayed as modified.

Also all workingcopys from old trunk will be invalidated(as you work alone, this may not be important), so you need to check out them again.

Peter Parker
I just updated to SVN 1.6, but I can rollback to 1.4. What's the difference in that sense?Can you point me at the parallel option in Subclipse?Why is this better than renaming the branch?
zvikico