Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN merge question

Tags:

svn

I have a directory under subversion control. I created a branch out of it just to test merging stuff. I took a file, modified line X in the trunk as "abc" and modified the same line X as "def" in its branch.

Then, from the branch working dir I did:

svn merge branchURL trunkURL .

It updated the file with the content as "abc" at that line number, i.e. it did not give me a conflict at the same line number as svn update would have given me if I had done it in the same working dir and someone had committed the "def" in the repository.

So does the svn merge just replace the content while merging and not bring any conflicts?

And if so the very reason of branching out a proj dir out of main trunk would be useless when one can't merge in a way so as to keep both the changes in trunk and branch.

like image 317
ashishsony Avatar asked Feb 21 '09 03:02

ashishsony


1 Answers

You do realize what

svn merge branchUrl trunkUrl branchWorkingCopy

Actually does, yes?

Here's a translation:

Figure out the set of changes necessary to make the contents of branchUrl identical to those of trunkUrl. Now perform those changes on the branchWorkingCopy.

You won't get any conflicts merging this way. When you check in your branchWorkingCopy, however, you will have made your branch identical to your trunk, which is almost certainly not what you want.

If you just want to copy selected changes from trunk to branch, you'll need to tell Subversion which changes you want to copy and use a different form of the merge command:

svn merge -r100:103 trunkUrl branchWorkingCopy

Which means: Determine the set of changes necessary to get from r100 to r103 on trunk. Perform those changes on the working copy (of branch). Note that this "set of changes" will not include the changes made by r100, as those are captured by the set of changes necessary to get from r99 to r100. Revision ranges in Subversion are half open.

Also, consider reading the fine manual, if you haven't yet.

like image 105
bendin Avatar answered Oct 31 '22 09:10

bendin