views:

166

answers:

2

I don't understand svn merge. Here's the scenario:

We have a branch that contains the latest stable copy of our code. I will refer to this branch as 'the branch'. There's also a trunk branch which contains a few new additions, but we don't want to mess with that at this point.

We have a vendor branch which contains an updated version of the library on which our app runs. I want to merge the new changes in this vendor branch with 'the branch' so that we get updates to the library without me having to go through, file by file, and figure out what is new. No Thanks.

Now, I realize this is probably simple, but I have tried a lot of stuff, and read a lot of tutorials, but I am still unable to wrap my head around what, exactly, I should be merging with what.

For the record, I am using Tortoise.

EDIT: This is a clarification, but our app runs the library at the root level. I don't know if it matters. So 'the branch' is basically the same as 'vendor', but with our changes.

+1  A: 

Something like this should do it for you. Subversion understands standard diff and diff3 pretty well, but it doesn't always play nice with 3rd party (graphical) diff utilities.

$ cd "the branch"
$ svn merge --diff3-cmd=diff3 svn+ssh://yourrepository/path/to/vendor_branch"
Carl Norum
Unless you have specific filetypes that aren't handled properly by the builtin diff you could leave out the '--diff3-cmd=' part, as the subversion builtin merge normally handles things just fine.
Bert Huijben
Araxis merge for OS X seems to fail on that front for me every time. I thought maybe the question was due to similar trouble.
Carl Norum
+1  A: 

Vendor branches are a technique that allows you to maintain your own patches against an external code base, while keeping the ability to absorb new releases ("vendor drops"). This involves merging of your own changes and the vendor changes. I wouldn't recommend trying such a thing as your first experiment with merging, because it is an advanced and complex use case.

However, it sounds like you are not modifying the third-party code at all. Upgrading to a newer version of the third-party code therefore shouldn't involve merging.

The trick is to keep your own code and the third-party code separate (they are separate projects) and bring them together with svn:externals. Example repository layout:

/externallib/1.0
/externallib/2.0
/project/trunk
/project/trunk/externallib

The /project/trunk/externallib folder doesn't really exist in the repository, but appears in your working copy because of svn:externals property on the trunk folder with this value:

^/externallib/1.0 externallib

Upgrading the trunk to version 2.0 of the external library is then a matter of changing svn:externals definition to this:

^/externallib/2.0 externallib

Note that you should treat the externallib releases as tags; if you start modifying them you will influence the content of /project/trunk/externallib without any explicit commits in /project/trunk, which is a bad thing.

Wim Coenen
I appreciate your commentary, but we are in fact modifying the third party code. It's simply not possible to do as you suggest.
Allyn
So you are already using svn:externals, and your problem is with merging between the different branches of /externallib?
Wim Coenen
Nope, we're not using externals. Just a vendor folder and a trunk. Vendor contains the latest from the 3rd party distro, and trunk contains the previous distro with our custom code intertwined.
Allyn
So it's almost like a feature branch, and almost like a vendor branch, but not quite each or the other.
Allyn
Is there a common ancestry? In other words, do you see common revisions if you do a svn log on both folders which contain the different versions of the vendor code?
Wim Coenen
No - our trunk isn't related to vendor through svn in any meaningful manner.
Allyn