subversion-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoff Hoffman <ghoff...@cardinalpath.com>
Subject Re: Do svn:externals changes need to be committed to work?
Date Tue, 02 Aug 2011 08:02:35 GMT
Hey André,

On Mon, Aug 1, 2011 at 6:54 PM, André Hänsel <andre@webkr.de> wrote:

> I am trying to add an svn:externals definition to a working copy. I set the
> property on a directory and ran svn update on that directory, but nothing
> is
> fetched.
>

One of my favorite topics.

svn:externals is tricky to understand and use at first but very powerful and
worth learning.

The syntax is

svn propset svn:externals 'A B' C

Where:
 A is the name of the folder you want your external reference checked out
into (created);
 B is the URL to the external repository dir you want to reference in the
current working dir;
 C is the path to the local working dir folder on which you want to set the
svn:externals property

I think you created the folder first - let your externals definition create
the folder 'A'.

An example (from [2])

svn propset svn:externals 'akismet
http://plugins.svn.wordpress.org/akismet/trunk' .


Note the dot at the end. In this example, the svn:externals property is
being set on the current folder (probably htdocs/wp-plugins - just a hunch)

What most examples don't show you is to cd into the directory you want to
set the property on first then call it '.'  (no quotes, dot = current dir)

Also the SVN Book[1] says because this property is multi-line, better off
using svn editor (vi) versus trying it all on the command line as it is
"extra tricky" to do this way.

You can see why this is important; if you wanted to load all the wp-plugins
from their source repos you would need multiple svn:externals set on the
wp-plugins dir, one for akismet, another for w3 total cache, and so on. It
is *very* easy to accidentally erase all of the previously set externals
definitions if you try this on the command line.

Due to this I strongly recommend to use your IDE to load the existing
property value, edit it as desired, then save/set/apply/update.


I found this article:
> http://blogs.gnome.org/johannes/2008/02/20/svnexternals-for-noobs/
> However, from other documentation it's unclear to me if a commit is really
> necessary for svn:external to work. Of course, I don't want to commit an
> untested external definition.
>
> I am using TortoiseSVN 1.6.15 built with Subversion 1.6.16.
>


The order is, you apply the property with propset (you have just modified
only the property of the directory, nothing else.)
Svn status shows you '.' is modified. or 'wp-plugins' is modified.
Next, do an svn update. Your content from external repo defined, comes
streaming down, and `akismet` folder is created in
htdocs/wp-plugins/akismet.
Svn status still shows you only '.' is modified. or 'wp-plugins' is
modified.
Now, commit - only the dir props are commited

If your external code is also your own code (your own shared library in
another repo you control, for example) be very careful when changing stuff
in [working copy] and [external code] in same commit. Most IDEs will let you
do this, but warn 'You're about to commit to multiple repositories...' This
may be exactly what you want, but often it is not.


I recommend reading these

[1] http://svnbook.red-bean.com/en/1.5/svn.advanced.externals.html

[2]
http://beerpla.net/2009/06/20/how-to-properly-set-svn-svnexternals-property-in-svn-command-line/

HTH -

Mime
View raw message