SVN File Status Flags

More SVN stuff I can never completely remember.  As seen from running svn update, svn switch, or svn merge. “G” always throws me. See $ svn status help for details.

U filename = item (U)pdated to repository version
G filename = item’s local changes mer(G)ed with repository
C filename = item’s local changes (C)onflicted with repository
D filename = item (D)eleted from working copy
A filename = item (A)dded to working copy
~ filename = item (S)ubstitution; for example local file update obstructed by substitution of a symlink with the same name in the repository (I think of this as a sideways/backwards “S”)

Also note that a real “S” flag means that something has gone horribly wrong with a switch and that the operation was not fully completed. Hopefully you’ll never see this.

Subversion Reversion

Or “Please Please Just Make the Crazy Things Go Away”

Reversion becomes essential when you start working with bargain software consultants abroad. Though a bit unintuitive, Subversion makes it pretty easy to do.

svn merge -r head:56 SomeClass.java

This will revert from the working revision HEAD to revision 56. Now simply:

svn commit -m "What the #%&* were you thinking?!"

to push the previous version back to HEAD.

Reversion in Subversion is actually a kind of merge. More details in the Subversion Book.

Clean copies from Subversion

This blog is turning into an elaborate mnemonic device.  This time, some more Subversion stuff I can never remember how to do.

To get a clean checkout (sans the .svn directories) of a trunk, branch, or tag from your repository, use the following:

$ svn export svn://server.com/repo/branch/name

Simple. Use the -r parameter to indicate a specific revision.

Run svnserve, run!

More notes to self.

Fancy shmancy init scripts aside, this is the fastest way to get a Subversion server up and running:

/usr/bin/svnserve --daemon --root /var/svn

root is the directory housing one’s repositories; looks something like this:

/var/svn/
conf/
project1/
project2/
repos/

Make sure the svn port 3690 is open.

Subversion Project Startup Cheat Sheet

This is one of those things I have to do once every so often and that I can never freaking remember how to do.

  1. Create a repository on the server. AFAIK can’t be done over the network; must be done on the machine hosting the repository.

    # svnadmin create /path/to/repositoryname

  2. Import your files (often from a remote machine).

    $ svn import /tmp/project svn://url.com/repositoryname -m "initial freaking import"

  3. Check them out again to your desired directory.

    $ svn checkout svn://url.com/repositoryname

That’s it! See the Quick Start in the online book if you need to mess around with branches and tags and the like.