Monday, December 08, 2008

How to use subversion to synch with multiple repositories.

Situation 1. If you are forking a project and you can’t submit to the other person’s project but want to receive their updates. This may happen when you are changing a project for a specific purpose that no other business is likely to need/use.

1. Create an empty repository that you will place your code in. Check out that project into a folder on your local computer. [I’ll refer to it as MYPROJECT]

2. Create an empty folder on your local computer for a remote project to be stored in. Retrieve the remote project into that folder [I’ll refer to it as REMOTEPROJECT]

3. Right-Click on the REMOTEPROJECT folder and bring up the Subversion options and select “Export”. Export it into the MYPROJECT folder.

4. All files that are the same will not be marked as having changed. All files that have been updated will be noted in subversion as having changed. You can visit each file and do a diff on it from the repository and merge any changes on an individual bases.


Situation 2. If you are going to use a remote repository but not update it, subversion externals is a good choice. Subversion externals allows you to add any number of folders into your project that get updated from remote repositories.

1. Using a tool such as tortoise SVN, you can select “Properties” and add a property with “svn:externals” as the property name and for property value you add two terms such as “framework http://framework.zend.com/svn/framework/trunk”. The first term becomes a folder in your project and the second term is the repository that it will pull from.

No comments: