Subversion

From UIDWiki

Jump to: navigation, search

Subversion is a new version control system that improves on CVS in several ways:

  • it's easily accessible through HTTP
  • you can move and rename files and directories easily

We're switching Chickenfoot over from CVS to Subversion.

Using Subversion at CSAIL.

Using and hacking Subclipse: the Subversion plugin for Eclipse.

SVN Book: how to use Subversion.

Contents

Putting a new project into Subversion

The UID group Subversion repository is located here:

  svn+ssh://svn.csail.mit.edu/afs/csail/group/uid/svn/uid

If you look inside this repository, you'll see three root folders:

  projects/    for shared group projects like Chickenfoot and Kangaroo
  pubs/        for papers, talks, and other publications
  users/       for personal projects by UID group members

If you're using Eclipse, then you can use the SVN Repository view to browse around the repository and create a new folder for your project. You can also right-click on an project in the Package Explorer and choose Team / Share Project to import it into Subversion.

Broadcasting SVN commit messages by email

For several group projects, including Chickenfoot and Kangaroo, we have Subversion commit messages automatically mailed to the developers, so that they can be aware of how the code is changing. If you'd like to enable this for a project, you need to edit the post-commit script:

 /afs/csail/group/uid/svn/uid/hooks/post-commit

Look for the lines that look like this:

 $EMAIL "$REPOS" "$REV" -m "^projects/chickenfoot" -s "SVN commit" chickenfoot-developers@lists.csail.mit.edu

Copy one of these lines and change the "projects/chickenfoot" so that it matches the location of your project in the SVN repository, and change the target email address to the address(es) you want. You can list more than one email address.

Automatically updating a web site after every commit

We keep the UID web site in Subversion, so that the actual site (at /afs/csail/group/uid/www/data) is a working copy checked out of Subversion. We keep that working copy up-to-date by automatically doing a Subversion update on it whenever somebody makes a commit to the web site.

If you'd like to do the same thing with your own web site (or other "master working copy"), the code that does it is in the post-commit script:

 /afs/csail/group/uid/svn/uid/hooks/post-commit

Look for the lines that look like this:

 if svnlook dirs-changed "$REPOS" -r "$REV" | grep '^pubs/website'
 then /usr/bin/svn update /afs/csail.mit.edu/group/uid/www/data
 fi

Copy these lines, and change 'pubs/website' so that it matches your project's location in SVN, and change the "svn update" command to whatever command(s) you want to run when a commit is made to your project.

Creating a new SVN repository

Creating a new repository isn't recommended. You should use the existing UID repository if possible; first, because it's already set up and therefore more convenient; and second, because fresh repositories are particularly susceptible to weird AFS bugs.

Nevertheless, if you want to create a new repository, log in to a CSAIL machine with ssh (e.g. ssh login.csail.mit.edu), and run the following:

 svnadmin create --fs-type=fsfs /afs/csail/group/uid/svn/yourproject

Replace yourproject with your project's name. Note that --fs-type=fsfs is essential for SVN repositories stored on AFS; without it, the repository will quickly become corrupted.

NOTE: svn.csail.mit.edu only has subversion version 1.4 installed. If you use a later version, you must use the --pre-1.5-compatible flag to svnadmin.

Weird SVN issues on AFS

There is an AFS bug where occasionally the repository will get stuck and give you a 'Permission denied' or 'Folder "" does not exist' error message. Here's a workaround:

 ssh svn.csail.mit.edu fs flushvolume /afs/csail/group/uid/svn/uid

(Replace svn.csail.mit.edu with your SVN server, and /afs/csail/... with your SVN repository path.)

Converting CVS to SVN

Use cvs2svn, which is also available as a Debian package (sudo apt-get install cvs2svn).

Here's the command line we used to convert Chickenfoot from CVS to SVN:

 cvs2svn --keywords-off --fs-type=fsfs -s /afs/csail/group/uid/svn/chickenfoot /afs/csail/group/uid/cvs/chickenfoot


Switching to Subversion

These instructions will help current Chickenfoot developers switch from CVS to Subversion.

Eclipse instructions

Install Subclipse. Follow the directions in Using and hacking Subclipse: the Subversion plugin for Eclipse.

Configure Subclipse to use its internal svn client. In Eclipse, go to Window >> Preferences >> Team >> SVN >> JavaSVN (Pure Java)

Create the Chickenfoot repository location. Go to Window >> Open Perspective >> Other >> SVN Repository Exploring, then right click in SVN Repository >> New >> Repository Location. Enter:

 svn+ssh://svn.csail.mit.edu/afs/csail/group/uid/svn/chickenfoot

You'll have to give your CSAIL password.

Check out Chickenfoot. Open chickenfoot >> trunk, right click, Checkout, and call it chickenfoot (or chickenfoot2 if you want to keep your old Chickenfoot working project for now).

Command line instructions

Install the Subversion command-line client. It's already installed on all CSAIL Debian machines; for other platforms, go to the SVN site.

Check out Chickenfoot.

 svn checkout svn+ssh://svn.csail.mit.edu/afs/csail/group/uid/svn/chickenfoot/trunk chickenfoot
Personal tools