Since I have been posting about “finds” in Elgg’s Subversion repositories, I have been getting questions about Subversion. Please note that you don’t need to understand everything covered here to explore and use SVN. Let’s take a look at Subversion and how we can use this incredibly useful tool with Elgg.
Software development projects such as Elgg generally involve several developers working concurrently on the same project. Keeping track of and synchronizing revisions and files could quickly become a nightmare without a central system in place.
This is where Subversion comes into play. Subversion by CollabNet is a widely adopted server based version control system used by Open Source projects as well as the corporate world. Revisions are housed in a server repository. They often can be browsed through a standard web browser, but real access to the files comes through a Subversion client.
Let’s return to Elgg. Elgg actually has separate repositories for extensions and Elgg itself. You can view them in your browser by going to these addresses:
Start by clicking on the the Elgg repository. The first thing that you may notice is a security warning from your browser. You can, in this case, dismiss it. You should see a page that looks like this:

The top of the page shows the revision number. Each time developers commit new files or changes, the revision number goes up. This allows you to keep track of whether or not changes have been made. Below that are links to releases and the trunk. Releases are tested and stable versions of Elgg. Trunk represents the latest code and is not thoroughly tested. Trunk code is very much use at your own risk. It is not recommended for production sites.
If you click on releases, you get an option to select the full or core version of Elgg. Core contains a bare bones install of Elgg; whereas, full contain a set of plugins along with the core.

Note the directory with two periods. That enables you to navigate to the parent folder. Click on full and you have the specific release versions. Currently, there is only version 1.0. Soon you will see 1.1 as well, and as time goes on, subsequent version will appear there.

Returning to the first window code/elgg.org/elgg, we click on trunk and we see another view:

These links are directories and files that contain Elgg code. Click on index.php, for example, and you can view the actual code.

Click to enlarge
Now you have an overview of the repository, but what good is it other than checking progress on code?
That’s where Subversion clients come in. Clients allow you to browse the code, but also have the capability of downloading a directory and all its subdirectories with a single click. It will direct you to specify a folder on your local computer and deliver it all tidily to your hard drive.
Subversion clients come in a number of flavors for all platforms. The most popular version for Window is TortoiseSVN. It is free to download.

Note the browser style address bar to the top of the window. This is where you enter the urls mentioned earlier in this post. It has a Windows Explorer style interface.
To obtain a working copy you need to do a checkout from a repository. Select a directory in the explorer. Right click to pop up the context menu and select TortoiseSVN Checkout. This brings up:

This is where you specify the directory for your checkout (download). In most cases, you would select fully recursive.
Note: I do not have a Windows computer, so I had to get these instructions from the TortoiseSVN support site. I just included this because it is the most frequently used Subversion client. I am unable to offer help beyond what I have written here.
Subversion clients work similarly across packages and platforms. Most people that can run an Elgg site should be able to figure out the nuances of any client. Do a Google search for one suitable for your own computer. I run ZigVersion on my Mac.
From here, you have the code on your hard drive ready to upload via ftp to your server. The main advantage of this is that it gives you access to versions of Elgg that you wouldn’t otherwise.
The real power of Subversion comes into play if you have Subversion installed on your server. If you don’t have it, you should try to get it. You also need ssh access to your server.
In a terminal program, log onto your server. Go to your public_html folder:
cd public_html
Create a directory for your install:
mkdir elgg
Go to your elgg directory:
cd elgg
Give the checkout command (note the space and period following the url–they are important). For the release.
svn co https://code.elgg.org/elgg/releases/full/elgg1.0/ .
For trunk:
svn co https://code.elgg.org/elgg/trunk/ .
You will get a warning message:

Click t to accept temporarily or p for permanent and hit return.
Suddenly a scrolling flash of filenames come across your terminal window, transfering elgg to your server in seconds. No time consuming download, unpack, and upload.
If that is not enough to convince you, perhaps the upgrade process will. If you are upgrading the same version of Elgg–as you would with trunk, all you need to do is navigate to your elgg folder in terminal and repeat the command:
svn co https://code.elgg.org/elgg/trunk/ .
It will then automatically upload any updated or new files in seconds.
While I have not done this with different versions of elgg releases (as there is only one), in most software you can switch to the new version by navigating to your Elgg directory and type:
svn sw https://whateverthepathistothenewversion/
Again, all will be completed in seconds. You may need to run an upgrade script.
I hope this post is helpful and gets some of you started using Subversion. It is a powerful tool that can open doors in Elgg and many other open source software packages. It is a terrific timesaver as well.
20 comments