Subversion repository dependencies with svn:externals

svn-125x125Here’s how to use svn propset with single or multiple dependencies along with the pre-revprop-change hook setup. It was a pain in the butt at first because it just didn’t make sense, but now I get it.

If you use a GUI client, you may be able do propset subversion commands by pointing and clicking, but from the command line, it’s a little tricky.

I use –revprop -r HEAD but you can leave that out. I wish you could put that in the file.txt and not have to specify it manually. It would make my next stop of programmatic automation easier.

pre-revprop-change

You will also need to copy the pre-revprop-change.tmpl that you’ll find in the repository’s hooks directory as pre-revprop-change and make it executable and add svn:externals allow an exit 0 so that commits will work with revision dependencies.

if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then
    exit 0
elif [ "$ACTION" = "M" -a "$PROPNAME" = "svn:externals" ]; then
    exit 0
elif [ "$ACTION" = "A" -a "$PROPNAME" = "svn:externals" ]; then
    exit 0
elif [ "$ACTION" = "A" -a "$PROPNAME" = "svn:externals" ]; then
    exit 0
else
    echo "Only svn:log and svn:externals are allowed" >&2
    exit 1
fi

propset for a single repo/path

$ svn propset –revprop -r HEAD subdir svn://server/repository/trunk/subdir .

1. subdir is the directory I want to get created where the svn path I check out will place all its files and directories.

2. svn://server/…subdir is the other repository and full path to the base of whatever I want checked out.

3. the . (dot) at the end is because my $PWD is the directory to start the subdir at.

propset for multiple repos/paths

$ svn propset –revprop -r HEAD -F file.txt

file.txt has the list of SVN paths and directory destinations of where to check them out under.

Viewing properties

Once you change properties, you can view them and see which properties are set.

$ svn proplist

Properties on ‘.’:
svn:externals

$ svn propget svn:externals

subdir/dir1 svn://server/app/trunk/dir1
subdir/dir2 svn://server/app/trunk/dir2

Posted by admica   @   6 January 2010

Related Posts

Like this post? Share it!

Digg Twitter StumbleUpon Delicious Technorati Facebook RSS

0 Comments

No comments yet. Be the first to leave a comment !
Leave a Comment

Name

Email

Website

Previous Post
« EVE Online’s Rippling Effects of War on the Economy
Next Post
The current Balance of Power in the EVE Online universe »
Powered by Wordpress   |   Lunated designed by ZenVerse