HOWTO: Check out

$ svn co $SVNROOT/misc # creates "misc" in current directory $ svn co $SVNROOT/config .config # checkout config as .config $ svn co $SVNROOT/perl

HOWTO: Import (i.e. create repository)

$ svn import $SVNROOT/misc # when in ~/misc $ svn import $SVNROOT/config # when in ~/.config

Where SVNROOT is:

export SVNROOT="svn+ssh://bund.com.au/home/mjs/subversion"

TIP: Resolving conflicts

See Resolve Conflicts in Version Control with Subversion.

(Once conflicts are resolved, you need to do: svn resolved filename.)

HOWTO: Ignoring files

You need to set the svn:ignore property on the directory containing the file to ignore. The property is newline separated, which makes it difficult to enter multiple files on the command line. Better to use a .ignore file:

$ echo Makefile > .ignore $ svn propset svn:ignore -F .ignore .

(You can't "ignore" files in subdirectories like this.)

To ignore the entire contents of a directory, use

$ svn propset svn:ignore '*' .

HOWTO: Turn on keyword expansion

This gets you $LastChangedDate$:

$ svn propset svn:keywords "LastChangedDate" README

See svn:keywords.

HOWTO: Dump repository

$ svnadmin dump /path/to/repository

(Dumps to stdout.)

HOWTO: Compile Perl bindings

Add $HOME/lib to @ldpaths in Makefile.PL.

HOWTO: Recursively add files

To recursively add all missing files to the repository:

$ svn status | grep '^?' | cut -b 8- | xargs --replace svn add {}

(gxargs if on OS X.)

HOWTO: Recover/restore deleted files

Get a log of things that have happened to the directory that's missing the file to figure out the revision at which it was deleted:

$ svn log -vq .

Copy the deleted file out of the repository:

$ svn cp -r $revision URL .

Note that commits don't update the revision of your working copy, and svn log shows log messages up to the revision of the working copy, so

$ svn commit $ svn log # doesn't display the results of the commit

See Resurrecting Deleted Items.

HOWTO: Find files that have changed between revisions

$ svn diff --summarize \ --old=http://svn.beebo.org/trunk/@940 \ --new=http://svn.beebo.org/trunk/@944

Note that this does not capture the changes made in revision 940; to get those, diff from revision 939.

Files, log message of a particular revision:

$ svn log -v -r 331 .

(Add -q to not list log message.)

HOWTO: Ignore whitespace or line ending style in diff

If subversion >= 1.4, the built-in diff can ignore whitespace:

$ svn diff -x -w dom.js

Before 1.4, you'll need to use an external diff:

$ svn diff --diff-cmd diff -x -uw dom.js

To ignore line ending style:

$ svn diff -x --ignore-eol-style dom.js

HOWTO: diff to an arbitrary revision

TortoiseSVN: show history for file, right click on a revision, select "Compare with working copy".

HOWTO: move multiple files/directories

TortoiseSVN:

Select the files/directories you want to move, then right-click drag them to where you want them to go.

CLI:

To move dir1 and dir2 into quux/dir1 and quux/dir2, try (quux must already exist):

$ for d in dir1 dir2 ; do svn mv $d quux/$d ; done

The more natural "svn mv dir1 dir2 quux" may work in 1.5.

ERROR: svn switch --relocate fails with "403 Forbidden"

You get the following error when trying to switch --relocate:

$ svn switch --relocate FROM TO svn: PROPFIND request failed on '/' svn: PROPFIND of '/': 403 Forbidden (http://versions.beebo.org)

The FROM and TO URL arguments to svn switch --relocate need to be repository root URLs--if either includes "trunk", say, then you've probably done it wrong. (Don't worry if this looks like it will cause you to end up with a URL that doesn't exist, or has never existed: you can sort it out later by using a non-relocating "svn switch".)

This, by the way, is despite the manual describing switch --relocate as being broadly equivalent to doing a search-and-replace on the .svn metadata directories, and asserting that the repository is not contacted.

HOWTO: Set the MIME type (Content-Type)

Use the property svn:mime-type.

HOWTO: Produce svn diff output that's compatible with patch

svn diff output is actually compatible with patch; the problem is that patch by default does not understand the output of svn diff. It needs the -p0 switch to work:

$ svn diff > file.patch
$ svn revert -R .
$ patch -p0 < file.patch

HOWTO: Use a self-signed SSL client certificate.

~/.subversion/servers defines server-specific settings; we need to modify this to indicate that a particular certificate needs to be used with a particular server:

[groups]
bbcdev = *.dev.bbc.co.uk

[bbcdev]
ssl-client-cert-file = /Users/mjs/.subversion/certificate.p12
ssl-client-cert-password = qqqjfa3

(Unfortunately, your password needs to be stored in the clear.)