Contributor(s): Dan Haig, Steve Weinberger.
This document is an introduction and user guide for Subversion (svn), the version control system that developers working on the Tibetan and Himalayan Library website are required to use. As indicated, these are the specifics for Windows users. Mac users should obtain the respective Mac document. Unix users will no doubt figure it out for themselves from the following.
If you have any questions, please contact the THL Server & Account Issues Contact.
Contents
Welcome to the world of version control. It’s worth the hassle, which is pretty minimal given the significant improvements that Subversion (or svn) has made over its antecedent (and still industry standard) cvs. If you are familiar with cvs, the switch to Subversion will be pretty straightforward, altho a few seemingly familiar cvs commands do very different things in svn, so watch it.
What does Subversion do? Here’s a good summary, from the Subversion book (very useful and available free online):
Subversion is a free/open-source version control system. That is, Subversion manages files and directories over time. A tree of files is placed into a central repository. The repository is much like an ordinary file server, except that it remembers every change ever made to your files and directories. This allows you to recover older versions of your data, or examine the history of how your data changed. In this regard, many people think of a version control system as a sort of “time machine.”
If you are new to the whole concept of version control, it goes something like this: the THL website contains a large number of files and directories that several people have the power to edit or otherwise change. This is risky - you or somebody else might inadvertently destroy valuable work, and our only recourse would be to beg the Library admins to go diving into the tape backups, which is a significant hassle for them and not liable to happen as quickly as you would like, and in the meantime the hole you’ve made in the THL dangles in the wind for all to see. Uncomfortable, no? But with Subversion you can quickly ‘go back in time’ to retrieve lost data. Of course using this safety net requires a little work up front, so please follow the directions here and within an hour you should be back to doing your real work.
If you are able to use command line for all your natural svn needs (or would like to learn: see the book url listed above), more power to you. But this section is about using a client gui application, similar to an FTP program, to access the Subversion repository.
The recommended Subversion client software for Windows is TortoiseSVN. TortoiseSVN is very easy to use - once you have it installed, all you'll need to do is go to your folders/files using Windows Explorer and use the right click to choose whichever of the offered TortoiseSVN commands you want to use for said folders/files.
Here are the steps to download and configure your TortoiseSVN client:
The Subversion repository for the THL lives on UVa’s main Subversion server, titan.lib.virginia.edu (which has an alias, subversion.lib.virginia.edu).
The THL repository is huge - some 18 gigabytes w/o the extra stuff subversion uses to manage the repository, which can as much as triple the memory requirements - so rather than checking out the whole repository, it has proven quicker and easier to pull out pieces that are relevant to any given user. Please note however that you can't just check out one directory four levels down - you need to check out its parent directories first, and maintain the same structure of the THL directory tree (you won't have to check out all of the content for all of those - more below).
Here is how most of us would want to proceed with getting set up locally with relevant parts of the THL from the svn repository:
Selecting only the top folder will provide the "trunk" folder (which represents the core version of the repository – "branches" will be made later to deploy pieces of the repository to the live web site) and whatever incidental loose files are at the top level of the site (index.html, etc), but it does not provide all of the subfolders, which you don't want right now unless you are prepared to take in the entire THL site. More importantly, your new "thdl-quandu/trunk" folder has a .svn folder, so it is ready for further Subversion directives.
It bears emphasizing that you *must create your local folder tree exactly as it is in the repository - you must not have two folders, one from the top level and one from the sixth level, sitting alongside each other at the top level of your local version.
Congratulations - you’re now in a position to get to work!
_____
Here's how to get ALL of the thl files from the repository and onto your computer:
So, you have TortoiseSVN up and running, and a copy of relevant parts of the THL on your hard drive. Let’s hack some code.
You’ll notice, in the top level of the thdl-quandu/trunk directory you checked out, a file called svn-guinea-pig.txt. This is your guinea pig for Subversion experiments. Please be sure you can do the following on test.txt *before* working on real THL files.
#Open svn-guinea-pig.txt, make some changes to it, then save and close the file.
That’s basically it for making changes. Now however you need to deploy your changes to the server environment (dev, staging, or production) so they appear online.
After you make major changes, add a feature, or fix a bug and then commit files and folders to the repository, you need to create a tag, which is a snapshot of the repository at a given time. This provides benchmarks of the repository at various points in the past that we can go back and look at later if something is wrong or we have questions about particular files or folders.
To create a tag:
You first commit the changes you made to the file or folder on your hard drive to the Repository. After this, you need to deploy the file or folder to the server environment so that it displays online.
Note that none of us has write permissions on orion for /lv6/thdl/ (which is where www.thdl.org's version resides), which is owned by root to keep people from working around the version control. This environment can only be affected by us via Subversion. No more FTP'ing to the server.
In brief, the new deployment workflow goes like this:
Note that you *can logon to orion and read the files that are in lv6 (www), to check to be sure your changes really made it thru the system, but you won't be able to edit them there.
Content to come - please contact me if you need immediate help in these areas.