Subversion at SSEL

New: Commit e-mail notification for the SSEL SVN repository can now be configured through properties (=Subversion's meta-data feature).

Context

Subversion (SVN) is an open-source version control system that aims to be a compelling replacement for CVS. While distributed offline version control can never be entirely transparent, Subversion does a good job at abstracting out the minimal concepts from CVS and providing them as a modern, well-designed and cross-platform application, free from the historical idiosyncrasies of CVS. Subversion's back-end components, command-line client and language bindings are already very mature; GUI and web clients are rapidly improving.

SVN command-line client primer

This section assumes you're already a bit familiar with basic concepts such as a repository, a working copy, update and commit. It also assumes that you downloaded and installed the svn binary (you can find here how to do that on your platform)

Sanity-check

Testing the connection with the server (by requesting a listing of repository items):

svn list https://ssel.vub.ac.be/svn-gen/

Upon the first connection, Subversion will ask if you want to accept the server certificate and will prompt for authentication credentials. This information can be stored permanently on your system so you don't have to provide it anymore.

Setup

Creating a local working copy from an existing repository folder:

svn checkout https://ssel.vub.ac.be/svn-gen/<projectfolder> <localdir>

Creating an empty repository folder for a new project:

svn mkdir -m "<log-message>" https://ssel.vub.ac.be/svn-gen/<newfolder>

Importing a local (unversioned) folder as a new project in the repository:

svn import -m "<log-message>" <localdir> https://ssel.vub.ac.be/svn-gen/<projectfolder>

import will add all files from the local folder to the repository; make sure it only contains source files (not derivates). Also note that import will not turn the local folder into a working copy. You still have to checkout.

To obtain more control when importing a local (unversioned) folder, follow these steps:

Important: ensure that all part of the local directory are really unversioned! If the following search finds anything, remove the .svn subdirs first:

find <localdir> -name .svn -type d

Create a destination directory in the repository and check this out as the local folder:

svn mkdir -m "<log-message>" https://ssel.vub.ac.be/svn-gen/<newfolder>
svn checkout https://ssel.vub.ac.be/svn-gen/<projectfolder> <localdir>

Subversion will not overwrite the local folder, it will simply add the .svn subdir. Now add the files with the commands:

cd <localdir>
svn status
svn add -N dir

Basic work cycle

All of the following commands are executed in (a subdirectory of) the local working copy

Retrieving the latest changes from the repository:

svn update [files...]

Inspecting your local changes in terms of added, modified and removed files:

svn stat

Making your local changes available to other by sending them to the repository:

svn commit -m "<log-message>" [files...]

Normally you commit your local changes when they are more or less a complete unit. For example, if you are working on a programming project, the changes you commit should at least compile.

Advanced work cycle

Inspecting your local changes in detail:

svn diff [files...]

Reverting local changes:

svn revert [files...]

Putting new local files under version control (i.e. scheduling them for addition to the repository):

svn add <files...>

It is advisable to put only source files under version control (not derivates). If you added a file by mistake, you can still do a revert before commiting.

More info

Consulting the handy build-in help:

svn help [command]

More information: selective SVN pointers

Repository Reference

Full access URLs

Read/write access for authorized members only. The usual username/password for Unix or Samba should apply.

Anonymous access URLs

Read-only access. Furthermore, reading of certain modules (directories) may be restricted.

Projects

Commit-emails

When you are in a team that collaborates on the same project, you have to keep track of each other's work. Although Subversion will prevent you from overwriting somebody else's changes, you have to pull the server (with svn update) to see what others have done, and at that point you will only see all changes at once, without log messages. Commit e-mails can help as extra information that gets pushed on every commit. On the SSEL SVN repository, they can be configured through properties (=Subversion's meta-data feature).

To receive commit-emails for all commits that influence a certain folder, add your e-mail address to the hook:commit-email property of that folder (one address per line). On every commit, a hook script checks for this property on the changed items and their parent folders. When one or more e-mail addresses are found, a commit e-mail is sent out.

Here's a walkthrough that subscribes an e-mail address in the hook:commit-email property using the SVN command-line client. It starts in the working copy of a folder for which you want to receive commit e-mails:

# Make sure the WC is up to date
svn up

# Set an environment variable with your favorite command-line editor
# (e.g. vim, joe, mcedit, gedit...)
export EDITOR=<my-editor>
# (OR, under DOS/Windows...)
set EDITOR=edit

# Edit the hook:commit-email property on the current dir (note the explicit . )
svn propedit hook:commit-email .
# In the editor, add your e-mail address to the property text (on a new line), save and exit

# Commit the property change
svn commit

You should immediately get a first commit e-mail regarding this commit. Further commit e-mails will be send on all subsequent commits for that folder, as long as the e-mail address is present in the hook:commit-email property. To unsubscribe, re-edit the property and remove your e-mail address.

Note

Since Subversion's HTTP(S) access method is built on the WebDAV standard, these repositories can be accessed as a remote file system through a WebDAV-client (using a HTTP(S) URL). Windows, MacOS and KDE include WebDAV support (described for example here), other clients can be found on the WebDAV projects page. Plain WebDAV-access is sufficient to download a working copy of the files from the server, but other uses require a Subversion client.

 
internal/svn.txt · Last modified: 21/09/2007 16:08 by bdefrain
 

© 2003-2010 • System and Software Engineering Lab • Submit comments and bugs to our Bugzilla or to the webmaster