symfony svn:externals for newbs

A new job often means doing something that you new you should have done a long time ago. A little while ago, I created a new symfony project on my own @meditemple webspace. I just ftp my updates up to the server as I go (I haven’t done much lately, I’ve stopped) but I’m going to try and finish it.

Anyway, I don’t need to worry about subversion (for now) whilst I’m working on my home projects. However I need to use it more in my new job than I used to in my old one. So in at the deepend, here’s a summary of how I added symfony plugins via svn:externals.

So, I had to create a new project and I’m following along the online documentation and I get to Installing from Subversion in symfony Installation. after creating the directories to hold the symfony code I imported them in a new svn repository. Then I came to the following command in the documentation:

$ svn pe svn:externals lib/vendor/

The “pe” is an alias for propedit which means you are going to edit svn properties for that folder.

Now I understood that this was going to prepare my directory to treat the content as an svn external so that on every svn update I did, it would pull in the latest stable version of 1.4. However the command failed with:

svn: None of the environment variables SVN_EDITOR, VISUAL or EDITOR are set, and no 'editor-cmd' run-time configuration option was found

The command is trying to edit a subversion file called svn:externals but you first need to define an editor, so:

$ export SVN_EDITOR=vi
$ svn pe svn:externals lib/vendor/

Add this line:

symfony http://svn.symfony-project.com/branches/1.4

It is possible to by-pass setting the SVN_EDITOR with a shorthand version:

$ svn propset svn:externals symfony http://svn.symfony-project.com/branches/1.4 lib/vendor/

…but you will need to learn to use an editor because it will be far easier to maintain a list of externals with the editor especially if you plan to have all of your symfony plugins as svn:externals too.

Save the file and commit. Then run a svn update and the symfony code will be included in your project and the latest (v1.4) stable release will be maintained with every subsequent svn up.

I bet you’ll be able to use your new-found skills to svn:ignore log/ and cache/ too, won’t you?