Merging changes from two SVN repositories

207 views Asked by At

We use an open source project which is hosted on a SVN server for which we have only read access (call it SVN1). We checked out this code, and for our private use, have done some modifications.

The open source project gets developed further, bugs get fixed, features get added. But my own private changes still apply.

What is a good versioning approach, so that I can persist and version my own code to my own SVN (SVN2), while still getting the updates from the open source SVN?

I'm doing all this from Eclipse, so a solution which can be done with the Eclipse SVN tool (Subclipse) is welcome.

1

There are 1 answers

2
bahrep On BEST ANSWER

It looks like you are looking for Vendor Branches.

As described in the Vendor Branches section of SVNBook, you can do the following:

This is a sample workflow which follows SVNBook instructions; you may need to adjust to fit your needs.

  1. Perform the initial import with svn import to your repository to <repo-URL>/vendor/current

  2. svn copy the <repo-URL>/vendor/current to <repo-URL>/vendor/1.0 in order to create a tag, for example. (1.0 here corresponds to the open-source project version, you can use any name or version number in your real case).

  3. svn copy <repo-URL>/vendor/1.0 to your development branch in the repository, for example to <repo-URL>/project1/trunk.

  4. svn checkout <repo-URL>/project1/trunk to the same directory on local system which you've imported initially.

  5. Now you can modify the data stored in the working copy and commit it to the project.

  6. If some time later you want to upgrade the open-source project to a newer version (for example, OS developers release 1.1 version) with keeping your changes, you should svn checkout the <repo-URL>/vendor/current atop of the unversioned folder that contains 1.1 version of the OS project. You will be required to svn add and svn remove files that have changed their location between 1.0 and 1.1 version. This way you'll get a working copy that contains 1.1 version which you commit to <repo-URL>/vendor/current. This way you commit only changes between 1.0 and 1.1 version. Later you can svn copy the <repo-URL>/vendor/current to <repo-URL>/vendor/1.1 to create a tag for it.

  7. If you want to upgrade the OS project in your development branch to version 1.1 keeping your changes, you can perform 2-URL merge with a working copy that contains your modified project data, the command-line would look like this:

    svn merge "<repo-URL>/vendor/1.0" "<repo-URL>/vendor/1.1" "<path-to-WC>"

The above description does not pick up file layout changes made between 1.0 and 1.1 versions of the OS project and you will be required to manually process them. If you want to automate the task of adding / removing files, you can use svn_load_dirs.pl Perl script (or similar python script) for this task. The script is available at http://svn.apache.org/repos/asf/subversion/trunk/contrib/client-side/svn_load_dirs/ and is also explained in the SVNBook 1.7.