Subversion merging changes from a different repository


I'm really confused. I want to do something that a) seems like it should be pretty simple, and b) other people must do all the time, but I cant find out the best way to do it anywhere.

There's an external repository that contains some 3rd party code. I want to take a copy of version 1 of the code and put it in my own repository, and then customise it for my own needs. When version 2 of that code is released I want to be able to upgrade my customised version with all of the version 2 changes, retaining my customisations.

I've read about vendor branches ( but I don't understand why merging the previous copy of the vendor code and the new copy of the vendor code needs to be so complicated (ie. Surely, if the 3rd party code is stored in an SVN repository, all of the history regarding which files have moved/been deleted is known, so why do you need to tell it what's changed manually?


For example, you will have the opportunity to tell the script that you know that the file math.c in version 1.0 of libcomplex was renamed to arithmetic.c in libcomplex 1.1.

I've also read ( that it is possible to simply run a merge between different repositories, but I didn't think that was possible, and whenever I've tried it it's failed (though I could have been doing something wrong).

Can anyone clarify this for me, and suggest the best solution?

Best Answer

I've just tried a brief experiment with TortoiseSVN:

Creating the test repositories

  1. create two new repositories in rep1 and rep2
  2. check out rep1 into co1
  3. add a text file to co1 and check it in
  4. export rep1 to ex1
  5. import ex1 into rep2

At this stage you will be in the state of having created your local 'branch' in a new repository. The last two steps are all you need for an existing project.

To simulate some changes to the original repo, modify the text file in co1 and commit the changes.

Merging Changes

Now, to create your own working copy, check out rep2 into co2.

We should be ready to try merging from rep1 into co2.

Open the merge dialog for co2 and point it at rep1.

For the 'from' revision select the revision at which you exported your copy (in this case revision 1), or the revision that you last updated your local copy to.

For the 'to' revision select the HEAD or the latest update you want to apply.


This seems to work as expected, with the modifications from rep1 being applied to the working copy of rep2 in co2. These then need to be committed back to your local repository.