SVN merge from branch to trunk

4.8k views Asked by At

I'm new to SVN, we use StarTeam 5.4, and we are going to change to SVN as soon as possible. I'm testing SmartSVN as client.

I created a repository, a trunk with one file, and a branch. In the branch, I changed the file, checked it in, and now I'm trying to "officialize" this change to trunk.

The problem is when I use "Reintegrate Merge", the file is copied to the folder, but not updated in the repository. Then I have to check it in again, now I have a Revision 3 file in my trunk and a Revision 2 file in my branch.

Is this how it work? Is it not supposed to have a Revision 2 identical file in the two folders? Or at least a identical Revision 3?

3

There are 3 answers

3
Ben On BEST ANSWER

It's not just how it works, it's a feature! By forcing you to explicitly commit a merge, it makes it easy to revert all changes and start over if something goes horribly wrong while merging. Merging is always a working-copy operation to allow you to review the changes (and test them!) before inflicting them on your team.

Also, SVN does not track versions of files. SVN tracks a series of snapshots of ALL files in the repository, on any branch or tag. These snapshots are called "revisions". You don't have "a revision 3 file on trunk" and "a revision 2 file on the branch". You have a file on trunk, and a file on branch. Both files exist in both revision 2 and revision 3. On trunk, the last change to the file was in revision 3. On the branch, the last change to that file was in revision 2. In SVN, it's not technically correct to say "revision 4 of file", although that's easier to say than "file as it appeared in revision 4 at location" so that's what people will say in most situations.

0
mclennanwandisco On

This is how it works maiconmm yes. http://svnbook.red-bean.com/ covers this so I won't paraphrase, explaining why mixed revisions are normal and even useful (including limitations). I'd recommend referencing it while you get used to SVN.

0
Jas On

You can use this utility in order to automate svn merging from one branch to another http://github.com/liveperson/Auto-Merger