Subversion/Linking External Repositories

From Gentoo Linux Wiki

Jump to: navigation, search

Contents

[edit] Introduction

Sometimes when you are building a project you will want to link in a repository from another project. Perhaps a library supplied by another project or a complete other project that runs as a subset of your own.

In any case you have 2 options when placing this project into your own. You can copy their project into your own and personally make sure you update it on a regular basis (i.e. the hard way). Or you can use the svn:externals property to link into your project (the easy way).

[edit] Getting Started

[edit] Step one

Create a basic repository, or use an existing one.

[edit] Step two

make a directory in your project where you want the external repository to go (or use an existing one). For this example we will use /repos/externals

[edit] Step three

run svn propedit svn:externals /repos/externals and add something similar to the following: patTemplate http://www.php-tools.net/svn/patTemplate/trunk

Warning: any directory you specify for an svn:externals checkout should not already exist in your repository. If it does, you will get an error like the following:
svn: Working copy 'sharedproject' locked
svn: run 'svn cleanup' to remove locks

That's it you're all set. run an svn up and it will download the external repository into /repos/externals/patTemplate and automatically re-check this repository on every update.

[edit] Setting a revision number

When linking an external library it is generally best practice to link a specific revision. you can do this by making your line in the svn:externals property patTemplate -r113 http://www.php-tools.net/svn/patTemplate/trunk

Personal tools