SVN Externals

Home / Blogs / SVN Externals

If you are looking to reuse a project which already exists in another project and if you need that new project gets updates of the already existing project then-and-there, there is a very good feature in SVN called as externals to help on this kind of requirements.

Advantages

  1. You can avoid multiple copies of the same source in SVN/source control repositories.
  2. Get updates from the root project as and when there is an update.  So no need to manually copy the project again when there is an update.
  3. SVN-logs are maintained for the root project from the new project and hence better historical control.
  4. In case you don’t need updates from root project, use specific revision to freeze to selective version.

How does that works?

This can be best explained with hands on.

Let’s consider that I already have Tool-A which I had developed earlier and I’m currently developing a new Tool-B.  Suppose that I need to reuse the existing Tool-A in Tool-B without making a second copy in SVN repo.

Goto SVN Properties on the root folder of Tool-B where you want to reuse the Tool-A and select New >> Externals to get below one.

Goto SVN Properties on the root folder of Tool-B where you want to reuse the Tool-A and select New >> Externals

On the next popping dialog choose New to add the new external to get below one.

 
Ensure the Local Path points to the folder name which you want under the Tool-B.  Here I named that folder as Tool-A_Copy.  The URL is the SVN repo link to Tool-A.  If you want that Tool-A_Copy to get updated as and when the actual Tool-A has updates, then choose HEAD revision.  If you want to always use the current version or specific version of Tool-A and don’t want the updates from actual Tool-A then use the Revision and enter the revision number in Peg


After adding that, you should see a details of linked externals as above.


Then when you do the svn-update of the Tool-B folder, you should get the copy of Tool-A as above.  I named Tool-A_Copy in externals.

Now, as and when the Tool-A has new updates, you can just goto your Tool-B and svn-update it to get all new things from Tool-A.

Leave a Reply

Your email address will not be published. Required fields are marked *