Developing off the Alpha trunk

Published on 2012-09-15 by John Collins. Socials: YouTube - X - Spotify - Amazon Music - Apple Podcast


As I am working on the Alpha Framework all of the time in conjunction with the projects that I work on that actually use it, I like to check out the latest trunk of Alpha into each of my projects as an SVN external. Even if you don't have write access to the Subversion repository for Alpha, you may still want to do your development off of the latest Alpha trunk code rather than one of the official releases which will always be older.

In this tutorial, I will show you how to set up your local Subversion repository for your project, check it out into a working copy, and then set up an SVN external definition that will download all of the latest trunk code from Alpha into a local directory called alpha in the trunk of your project.

Let us begin by setting up the local directory structure for our repository and working copy in our home directory (~).

Setting up the directory structure

Set up a directory structure like so (this is just a suggestion, but it works well for me):

$ mkdir ~/SVN
$ mkdir ~/SVN/repos
$ mkdir ~/SVN/work

The advantage I find in this structure is that it keeps all of the Subversion files together in one place, but keeps the repositories and working copies clearly separated.

Set up the local SVN repository for your new project

Now create the repository (I'm assuming here that you already have Subversion installed, if not use yum install subversion):

$ mkdir ~/SVN/repos/alphadevx
$ cd ~/SVN/repos/alphadevx
$ svnadmin create .

The above commands create a new directory to host my project (in my case I'm calling it alphadevx), and I then navigate to that directory and create an empty new repository there.

Now add the initial directories to the new repository, namely trunk/branches/tags by convention:

$ svn mkdir file:///home/john/SVN/repos/alphadevx/trunk -m 'Adding initial directories'
Committed revision 1.
$ svn mkdir file:///home/john/SVN/repos/alphadevx/branches -m 'Adding initial directories'
Committed revision 2.
$ svn mkdir file:///home/john/SVN/repos/alphadevx/tags -m 'Adding initial directories'
Committed revision 3.

Check out a working copy

Now that you have your repository set up, you can check out a working copy of this where you will actually do your code work:

cd ~/SVN/work
svn co file:///home/john/SVN/repos/alphadevx

The co in the above command is short-hand for checkout. There are many different protocols for talking to Subversion, but my preference is to use it like a local file system where possible for performance reasons (hence the file:/// prefix in the paths I am using here).

Add svn:externals

You should now have the following structure in your local working copy:

$ ls -l ~/SVN/work/alphadevx/
total 12
drwxrwxr-x. 2 john john 4096 Sep 15 14:19 branches
drwxrwxr-x. 2 john john 4096 Sep 15 14:19 tags
drwxrwxr-x. 3 john john 4096 Sep 15 14:43 trunk

Next up, we will add an svn:externals definition to your trunk directory, that will download all of the Alpha trunk code to your local trunk/alpha directory, which will automatically be created:

$ cd ~/SVN/work/alphadevx/trunk/
$ svn propset svn:externals "alpha" .
$ svn commit -m "Adding Alpha Framework trunk"
Sending        .
Committed revision 4.

And now finally, do an SVN update to pull down the latest Alpha Framework trunk into the local trunk/alpha folder:

$ svn update

You should now have all of the Alpha trunk code from Assembla in your local working copy:

$ tree -L 2
└── alpha
    ├── build.xml
    ├── controller
    ├── css
    ├── docs
    ├── exceptions
    ├── images
    ├── lib
    ├── logs
    ├── model
    ├── ruleset.xml
    ├── sample
    ├── scripts
    ├── service
    ├── stopwords-large.ini
    ├── stopwords-small.ini
    ├── tasks
    ├── tests
    ├── util
    └── view
16 directories, 7 files

Updated 2022 : note that the above post was originally published in 2012, and is now completely out of date. I have removed the majority of external links. Note that the Alpha Framework is now hosted on Github.