SVN: Managing Third-party Source with Subversion

Suppose that you have an SVN repository


in which you have a project


to which you wish to add some source files from a third-party source


(SVN or otherwise). You wish to make some modifications to that source specific to your project, but also to be able to take advantage of any future bug-fixes or enhancements to the 3rd-party source.

Here is a suggestion for how this might be managed.

Unfortunately, SVN is a centralised version control system (CVCS) not a distributed version control system (DVCS) like Git. With both parties’ sources in a DVCS, this problem is easier to solve than with a CVCS such as SVN.

My suggestion for SVN is that you arrange your repository along these lines:




is a mirror of the 3rd party sources, and


is a copy within your repository of the mirror with any required local changes:

svn cp ^/mirror/elsewhere/3rdparty/somelib/ ^/project/trunk/somelib/

This is an attempt at pseudo-distributive management.

When the third party sources are upgraded, you apply that change to your mirror. This is probably the most awkward part. You will need to (rightwards-) synchronise a working copy mirror of the old version (‘right’) with a copy of the new version (‘left’), probably with the help of a script and/or a diff/patch process and/or the help of a GUI-based differencing tool.

In doing this, you should aim to try to track any file copies or renames.

Other than that, the aim is for the following changes to be made to the right:

  • left-only files: copy (becoming ‘unversioned’ on the right) and then svn-add
  • right-only files: delete (becoming ‘missing’) and then svn-delete
  • different files: copy (becoming ‘modified’)

and similarly for directories. The left is left untouched. When the right matches the left, it can be committed to the mirror directory of the repository.

The final step is to perform an svn-merge:

cd project/trunk/somelib/
svn merge ^/mirror/elsewhere/3rdparty/somelib/ .

from the mirror into a working copy of your project. This should take care of the merge between ‘remote’ changes and your ‘local’ changes.


2 Responses to “SVN: Managing Third-party Source with Subversion”

  1. Greg Prosch Says:

    Subversion supplies a script that will help to synchronize the “right” and “left”. It’s called

  2. Rob Says:

    Greg: thanks for the tip.

    I think that script comes with the source distribution, but not with the pre-compiled binary distribution. (I may be mistaken.)

    Here are a couple of useful sections on this from the SVN book:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: