Subversion Source Code Repositories

Brouhaha is now using Subversion for source code repositories. The information below explains how to access and use Subversion.

Subversion logo

Web Access

The Subversion source code repositories may be browsed using ViewVC:

altogether ViewVC Home Page
asm21 ViewVC Home Page
asm68 ViewVC Home Page
barebones ViewVC Home Page
bishops ViewVC Home Page
blackbox ViewVC Home Page
dis6502 ViewVC Home Page
dmklib ViewVC Home Page
edit33 ViewVC Home Page
glock ViewVC Home Page
la2vcd ViewVC Home Page
lcdtst ViewVC Home Page
m2psd ViewVC Home Page
m9312 ViewVC Home Page
nonpareil ViewVC Home Page
nsim ViewVC Home Page
pdp1dump ViewVC Home Page
read9144 ViewVC Home Page
tsbutils ViewVC Home Page
tumble ViewVC Home Page
vecsim ViewVC Home Page
verbum ViewVC Home Page
wrec ViewVC Home Page

The server is currently running Subversion release 1.3.2 and ViewVC 1.0.0.

Checking out a repository

Because Subversion has tried to emulate CVS commands as much as possible, this is pretty intuitive for CVS users. The repository for each project is located at:

svn://svn.brouhaha.com/projectname/

There are three directories under this. The "trunk" is the equivalent of the "HEAD" revision. Directories under "branches/" are equivalent to a CVS branch (Subversion uses logical copies for branches and tags). The "tags/" directory contains logical tags (the same as one would expect under CVS). These mostly represent some sort of milestone in the main tree. For instance, when the tree is merged with the main kernel source, we tag it. So to check out the head, do this:

svn checkout svn://svn.brouhaha.com/project/trunk/ project

The trailing "project" argument merely creates the local copy as a directory called "project" as opposed to the default of "trunk".

Checking revision status

Like CVS:

cd project
svn status

This does not check for updates available from the repository. To do that, use the -u option:

svn status -u

Updating an already checked out repository

Just like CVS:

cd project
svn up

Fairly simple.

Reverting to a previous revision

Since a Subversion repository uses a global revision number, it is easy to revert a tree to a known revision:

svn up -r 401

Note, that updating to a known revision is not sticky.

Switching to a tagged or branched tree

Let's say you checked out the "trunk", and you want to temporarily revert to a tagged revision (e.g. to try a branch):

svn switch svn://svn.brouhaha.com/project/branches/config-rom

Then to switch back:

svn switch svn://svn.brouhaha.com/project/trunk

Checking log information

Subversion has excellent log output. The basic log output shows the date, author, log message, and revision. You can also pass the --verbose option to view what files were affected by a revision. For example,

svn log | less

Would retrieve logs for all revisions.

svn log -r 400

Would retrieve just rev 400.

svn log file.c

Would retrieve logs for just the revisions that affect file.c.

svn log svn://svn.brouhaha.com/project/trunk

Would retrieve logs (server-side, so no local copy needed).

svn log --verbose

Would show verbose logs for all revisions.


Write access

Write access to the repository is restricted to project members.

Committing changes

This is almost exactly like CVS. If you do not pass the commit message on the command line, you will have your editor invoked (just like CVS) so that you can enter it. Otherwise you can pass the message directly with the -m option, or pass a file containing the message using the -F option.

vi foo.c
svn ci -m "Fix" foo.c

You can leave out the filename on the checkin command, and svn will do the same as CVS and commit all changes.

Creating a branch or tag

Branches and tags are internally the same to Subversion. Basically a lightweight copy method. So, it's as easy as:

# svn up
At revision XXX
# svn copy trunk branches/mybranch
# svn propset branch-point XXX branches/mybranch
# svn commit -m "Branched for 'mybranch'"

The main difference between tags and branches is how we use them. Branches are for concurrent lines of development (e.g. Adding large pieces of funtionality), while tags are just meant to alias a certain point in the tree.

Currently Subversion does not have direct support for keeping a branch in sync with it's branch point (IOW, automated merging of changes to trunk into your branch). This will be added soon enough, and we will use it when it does come around. In order to merge changes from trunk into your branch:

# svn up
At revision XXX
# svn propget branch-point branches/mybranch
YYY
# svn merge trunk@YYY trunk@XXX branches/mybranch
# svn propset branch-point XXX branches/mybranch
# svn commit -m "Merge changes from trunk to 'mybranch'"

Adding or deleting files and directories

Unlike CVS, Subversion does not force directories to be created in the repo, when they are added locally in the working copy. Also unlike CVS, it is possible to delete a directory from the repository, but again this does not occur till commit. To add a file or directory, do:

svn add foo.c
svn add --recursive newdir/
svn commit -m "Added new files"

To delete, it's pretty much the same:

svn delete foo.c
svn delete newdir/
svn commit -m "Remove these files and directories"

For text files it may be desirable to have keyword substitution. This is enabled by setting the svn:keywords property of the file to a list of keywords such as "LastChangedDate Author" or (my favorite) "Id". After setting the property, it is necessary to do a commit.

svn propset svn:keywords "Id" *.[ch]
svn commit -m "added svn:keywords property"

Copying or moving files and directories

One of the best features of Subversion, as opposed to CVS, is the ability to copy and move files and directories, while retaining full history. Let's say you want to rename a file:

svn move foo.c foo-newname.c
svn commit -m "Rename this file"

Same occurs for directories. This can be done completely server-side as well. For example, to rename a branch:

svn move svn+ssh://svn.brouhaha.com/project/branches/old-branch \
svn+ssh://svn.brouhaha.com/project/branches/new-branch

This doesn't need a commit, as the operation occurs in one operation.

Diff'ing

One of the features of SVN is the it keeps a local, unmodified copy of the files from the repository. This means that diff'ing local changes does not require contacting the server. Quite simple:

svn diff > ../temp.diff

Would get a complete diff of your changes against the unmodifed copies.

Read the manpage

There's a lot of functionality I haven't covered here.


Acknowledgements

This web page is derived from the Linux1394 project Subversion page by permission of Ben Collins and the Linux1394 Project.


Misc. other Subversion-related information


Last updated February 10, 2008
$Id: index.html,v 1.39 2008/02/11 02:51:06 eric Exp eric $

Copyright 2003, 2004, 2005, 2006, 2008 Eric Smith

eric@brouhaha.com

hacker emblem
Best Viewed With Any Browser Valid HTML 4.01! Valid CSS!

check now

check now