Who Should Read This
Read on if you are new to change control, or believe that change control only applies to software, or that it is only meant for large projects.
If you are a software pro working with large software projects, you can still read this if you want a gentle introduction to Subversion or svn as it is called.
We have all heard those trite remarks about change — “… change is the only constant …”, or similar ones, especially before an unpleasant corporate announcement. These overused remarks about change are unfortunately true. During the course of a day, we make numerous (hopefully!) interrelated changes, updates, or transformations to our work products to reach specific project goals. Needless to say, these changes need to be tracked along with the rationale behind each if we are to prevent ourselves from repeating mistakes, or simply want to recall why we did what we did one month ago! Note that we are not talking about only code or documents here; your work products could be a portfolios of photographs, animations, or some arbitrary binary format.
A change control discipline also gives you additional advantages such as being able to develop simultaneous versions of work products for different purposes or clients, rolling back to a previous arbitrary version, or setting up trial development in a so-called branch to bring it back to the main work stream after due review. You also have a running history of how your work product has evolved over time and features. Fetching from a change managed repository also prevents you from creating those fancifully named multiple copies of a file just to keep track of its versions. To reiterate: we use the words ‘work product’ and ‘development’ in the broadest sense and not just as applied to software. You might as well be creating a banner ad for your client as much as a Firefox plugin.
In the rest of this article we will see how to build a simple personal change control discipline for your day-to-day work using a version control tool. As you will note, ‘control’ and ‘management’ have been used interchangeably, though a little hair splitting will yield rich dividends in terms of how different these terms are.
Subversion is version control system available on the Linux (and similar) platforms. If you are trapped in a proprietary world by choice, circumstance, or compulsion, you should try TortoiseSVN. Here, we confine ourselves to the Linux platform.
Subversion works by creating a time line of your work products from their inception (or from the point they are brought under version control) to the present point in time, by capturing snapshots of your work products at discrete points that you decide. Each snapshot is a version. You can traverse this time line and extract specific versions for use.
How does subversion do it? It versions entire directories. A new version of your directory will be created even if you change one file in it. Don’t worry; this does not lead to an explosion of file size with each version.
Explaining some terminology, albeit informally, should make the going easier from here. Subversion stores your project(s) in a repository. For the purpose of this article, our repository will stay on the local machine. A revision is nothing but a particular snapshot of the project directory. A working directory is your sandbox. This is where you check out a particular version of your project directory from the repository, make any modifications to it, and then do a check in back into the repository. Revision numbers are bumped up with each check in. You can revert a configuration item, which is like undoing any changes you made. If all this sounds a little abstruse, don’t worry, because we will shortly set up our repository so that you can try things out. A commit is when you…., well commit a change done to a file into the repository.
Subversion is mostly bundled with a Linux distribution. Find out if you have yours with a ‘man svn’ or ‘svn -h’ or a ‘whereis svn’ command.
Setting up Your Repository
You can set up your repository in your home directory if you are working on a shared environment. If you have a machine to yourself, you might want to create an ‘svn’ account with /sbin/nologin (politely refuses logins) as the shell. Your repository might then be ‘/home/svn/repos’.
Subversion is a command line tool. But the only command you will ever issue for the purpose of this article will be to set up your repository:
$ svnadmin create /path/to/your/repository
The rest, as they say, is GUI!
Let Us Get Visual
A GUI for subversion is a great tool for learning and working even if you decide to settle for the command line once you get more proficient. eSvn (http://zoneit.free.fr/esvn/) is a Qt-based graphical front end for Subversion. Follow the instructions with the download to compile and install eSvn. Run esvn and this is how it will look with the File | Options… dialog open. Make sure you enter the correct path to svn if not for the other items.