Subversion for Beginners

I mentioned previously that I wanted to post how Subversion works (on the surface, for beginners) and how I use it for my development needs.

To create my WordPress plugins, Simpler iPaper and Simpler CSS, using SVN has been a must; after all, the only way to release new versions of the plugins is through SVN. I also keep this site’s WordPress installation up-to-date on the development version using Subversion. Additionally, in my current efforts to develop a working solution for HDTV’s in business and organizational settings, Display UI is being developed using Subversion for version control.

You get the idea. I use it on a daily basis, and for practical purposes. I don’t claim to understand the fine details, but hopefully this post gives you an idea of how I use it and how you can, too.

Source Code SnapshotSo what is version control? Simply put, it’s a way of keeping track of the changes made to files. It’s often impractical to make manual backups of a file before every set of changes to it, so version control systems like CVS and SVN emerged to help people — especially developers and programmers — keep track of their files, share changes with team members, and prevent stupid mistakes.

Accidentally deleted your code? Revert your changes. Came up with an ingenious way (that works) to do something? Commit your changes. Need to get the latest revision of all the files? Update the working copy.

Perhaps the most practical application of systems like Subversion is in team development. When three or more people are working on the same set of files, it’s useful to be able to merge the changes seamlessly, see the changes others have made, or even work separately on branches (kind of like forks) and tags (usually released versions that are being maintained).

I did write that I don’t claim to understand the fine details. If you really want to understand Subversion, I highly recommend this book by members of the development team: Version Control with Subversion, or the book online.

Let’s talk about how to use it. Hard-core programmers often choose to use the command line tools, where they type commands like svn up to update the files. Beginners will be glad to know that there are implementations with GUI‘s, like RapidSVN and TortoiseSVN. Eclipse users may use Subversive or Subclipse, “team providers” that let coders easily perform version control tasks inside the IDE.

Subversion tasks can be done in Windows Explorer
Subversion tasks can be done in Windows Explorer

Assuming that you’re using the command line binaries — which you can get from the Subversion site, and I recommend official CollabNet builds where possible — most of the basic tasks are rather easy.

Instead of right-clicking and picking options from a menu, tasks are done by typing commands.

First of all, a ‘repository’ is a hosted location containing all of the code, revisions and metadata. Often, one can access a repository via HTTP, as in the case of WordPress, which is found at http://core.svn.wordpress.org/ .

To ‘checkout’ a repository means to make a local copy (known as a ‘working copy’) of the contents. That’s what we have to do first when working with an established project: get the code from the repository.

To do so, type the following at an open shell (on Linux/Mac OS X) or command prompt: (don’t type the ‘$’ — that’s just a placeholder for the prompt you’ll see, such as frederick@ubuntu-pc:~# or [frederick@fedora-vm Desktop]$ — the specific prompt will differ depending on your machine and platform)

$ svn checkout http://core.svn.wordpress.org/trunk/ wordpress/

Windows users would do the same, but at a command prompt — again, without the dollar sign.

That command invokes the svn executable and tells it to checkout the WordPress trunk directory to the local folder wordpress.

Continue reading “Subversion for Beginners”

Yay for WordPress 2.8 Release Candidate

Awesome! WordPress has just released the release candidate of WordPress 2.8, which seems to contain an awesome amount of improvements over WordPress 2.7 (most of them subtle and unexposed to the end user). I’ve been running the trunk version of WordPress for months now, and I have to say that WordPress 2.8 is stable and usable.

If you want to stay up-to-date with WordPress, you can try running it from SVN. I’ll post a little guide on how I do it soon.