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:
http://svnserver/myrepos/ mirror/ elsewhere/ 3rdparty/ somelib/ project/ trunk/ somelib/
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.