Pragmatism in the real world

Subversion's svn:externals

I know everyone else is already doing it, but I’ve only just got around to working out how svn externals works and why it’s quite cool.

I’ve got a Zend Framework application that I’m working on in subversion and it has a lib directory which contains a zf directory. The zf directory is a checkout of the latest trunk version of the framework. Up to to now, I’ve been doing this manually.

Today I sat down for all of 10 mins and sorted out subversion’s svn:externals functionality to make it do the legwork. It’s dead easy.

Command line:

cd lib
svn propedit svn:externals .

(Don’t forget to ensure that the EDITOR environment variable is set!)

I then added

zf http://framework.zend.com/svn/framework/trunk

in the editor (a file called svn-prop.tmp, apparently) and saved and closed the editor.

All that’s required now is an svn update to automatically pull in the Zend Framework code automatically for me.

By the way, you have to do a svn commit to actually commit the propedit change too.

3 thoughts on “Subversion's svn:externals

  1. Other random related things :

    1) Remember you can lock the external against a particular revision such as :

    zf -r 555555 http://framework.zend.com/svn/framework/trunk

    so ensuring it doesn't break when someone at Zend changes something

    2) You might instead be better looking at :
    http://svnbook.red-bean.com/en/1.2/svn.advanced.vendorbr.html

    which probably provides a better approach in many circumstances; especially if you're likely to patch the ZF for your own internal usage.

    David.

  2. Hi David,

    Pinning to a specific revision is a good idea for production. At the moment, I want to follow bleeding edge, so I'm ok :)

    Vendor branches are also cool, but require me to have all the code in my local subversion server. The nice thing about the Zend Framework bits that I've used so far is that overriding what I don't like is as easy to do with a new class.

    Regards,

    Rob…

  3. I did the very same thing on Friday. I just never blog about this stuff :). Thanks for the post.

Comments are closed.