Using Subversion externals for files

I needed to use Subversion externals property to define a reference to a file. Based on this blog, here are my notes:

Let’s say that you want to have Subversion to use the following file from another directory: https://mysvnserver.com/svn/shared/lib/thelib.jar

And have the file download into the following file in your project: myproject/lib/thelib.jar You should have lib directory already exist.

Within your myproject folder, create a text file. This is necessary if you plan to have multiple references.

$ cat > svn_externals_config.txt
lib/thelib.jar https://mysvnserver.com/svn/shared/lib/thelib.jar

Use Ctrl-D to exit the data entry mode. Alternatively, you can use your favourite text editor to create the text file.

If you want to reference a folder instead, you can have the following definition:

lib/aThirdPartyLibFolder https://mysvnserver.com/svn/shared/lib/aThirdPartyLibFolder

Make sure that the local lib folder doesn’t have aThirdPartyLibFolder or you may get the following error: svn: warning: Working copy 'aThirdPartyLibFolder' locked.

Now you can set the svn:externals property by running the following lines:

svn propset svn:externals . -F svn_externals_config.txt
svn update

Once you are set, you can commit the externals definition by running the following command:

svn commit --depth empty . -m "Modify svn externals definition only."
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s