How To Properly Set SVN svn:externals Property In SVN Command Line
| Share |
Updated: October 6th, 2009
Introduction
Every time I have to deal with svn:externals in SVN, I forget the command line syntax. Every single damn time. Normally, I use SVN GUI clients, such as SmartSVN, which make it very simple to add an svn:externals property. But for command line, it always takes looking at 25 different sites on google, which are all incredibly unhelpful for this question for some reason. Trying "svn help propset" on the command line was bloated and equally useless.
So this time I needed to write it down and make sure everyone who needed help with svn:externals would find exactly what they need here. I hope this page will soon come up on top of all the unhelpful results on google for "propset svn:externals" and other related queries.
The Problem
I want to set a simple svn:externals property in one of my project's directories, lets say 'plugins' (talking about Wordpress here). The outcome would be a directory called 'akismet' within 'plugins' that points to a remote svn url.
Various combinations of trying to do it produced pathetic results, like
svn propset svn:externals akismet http://plugins.svn.wordpress.org/akismet/trunk svn: Setting property on non-local target 'http://plugins.svn.wordpress.org/akismet/trunk' needs a base revision
svn propset svn:externals . akismet http://plugins.svn.wordpress.org/akismet/trunk svn: Error parsing svn:externals property on 'akismet': '.'
svn propset svn:externals akismet http://plugins.svn.wordpress.org/akismet/trunk akismet svn: Setting property on non-local target 'http://plugins.svn.wordpress.org/akismet/trunk' needs a base revision
The Solution
Finally, thanks to this post, I found the right command:
svn propset svn:externals 'akismet http://plugins.svn.wordpress.org/akismet/trunk' . property 'svn:externals' set on '.'
Note that dot at the end of the command and the quotes around the directory name and url.
Now commit via
svn commit
and then
svn up Fetching external item into 'akismet' A akismet/akismet.gif A akismet/akismet.php A akismet/readme.txt Updated external to revision 127962. Updated to revision 16.
There, was it that hard, forum gurus and blog fiends?
Edit: in order to set multiple directory/url pairs in a single svn:externals property, you should put the individual dir/url pairs into a file (let's call it 'svn.externals'), like so
akismet http://svn.wp-plugins.org/akismet/trunk all-in-one-seo-pack http://svn.wp-plugins.org/all-in-one-seo-pack/trunk
and then apply the property using
svn propset svn:externals -F svn.externals .
You should also just check in 'svn.externals' to easily keep track of it.
Artem Russakovskii is a San Francisco programmer, blogger, and future millionaire (that last part is in the works). Follow Artem on Twitter (@ArtemR) or subscribe to the RSS feed.
In the meantime, if you found this article useful, feel free to buy me a cup of coffee below.


beer planet is a blog about technology, programming, computers, and geek life. It is run by Artem Russakovskii - a local San Francisco geek who currently works at
Also you can't set property if you don't have a local working copy. If folder is tooo big to checkout completely you can run this command:
svn co svn://branck/blah -N
So easy, but I also spend lot of time figuring this out. Hope, this helps.
If you have your SVN_EDITOR set in your .bash_profile (i.e. export SVN_EDITOR=/usr/bin/vi), you can do this a lot easier with this command (run from inside the dir you want to create the external link in):
svn pe svn:externals .
This will open up your editor, and allow you to easily manage the "foldername http://repos/path" entries from a much nicer interface.
I use svn:externals so much I set up a bash alias that shortens the command even further to just: svnext
In fact, I've got a whole library of little svn shortcuts set up as aliases in .bash_profile that make working with svn on the command line easier and more powerful than any GUI.
I dont know all Eric's tricks but I really like the what you can do with these techniques. Its a huge huge huuuuuge labor saver.
I worked out the process for pulling WordPress core and plugins and themes in one script.
http://www.superwebdeveloper.com/2009/11/07/installation-script-using-wordpress-subversion-repositories/
Also, every page says "you can even specify a specific revision", but few actually give an example of the syntax for referencing a specific revision.
Augmenting the example above you do it like this:
svn propset svn:externals 'akismet -r 22 http://plugins.svn.wordpress.org/akismet/trunk' .
Notice the "-r 22" where 22 is the desired revision number.
Hey, thanks this helped out quite a bit I ended up doing it slightly differently but got it working which is the main point.
Regards
How can I commit different externals on their own repo?
Thanks
Diego, I believe this is impossible. See this post on StackOverflow for details. In short, you can try to use Eclipse's commit which handles this automatically.
Thanks Artem!
Am creating an install routine for Wordpress builds, loading public and private plugins and themes. Perfect.
*love* <– this is all I wanted to say, really, for you saving my ass on an increasingly frustrated "gaah" moment of trying to propset the svn:externals deal, but I got a "comment too short" whine at me. Bah
Glad I could help :-]
[...] Originally posted here: How To Properly Set SVN svn:externals Property In SVN Command Line … [...]
[...] or even specific revisionsif you want the bias more to stability over new features. You can also specify multiple remote repositories by creating a text file with directory and remote resource pai…s and point svn propset at that file. Be prepared to handle things that you flub up using svn [...]