Phillip Pearson - Second p0st

tech notes and web hackery from the guy that brought you bzero, python community server, the blogging ecosystem, the new zealand coffee review and the internet topic exchange

2006-6-14

What is absolutely required in a .svn directory for 'svn update' to work

.svn directories contain lots of files, but it seems that you only need a relatively small subset for everything to work. Here it is:

.svn/format -- required for svn to work at all. A two byte file, with contents "4\n". .svn/tmp -- required for 'svn update'. An empty directory. .svn/text-base -- required for most things to work. Contains a pristine copy of each file in the working dir, with ".svn-base" appended to the filename.

It seems that 'svn status' actually compares each file in the working dir against its equivalent in .svn/text-base to determine whether it has been modified (it doesn't use the checksums in .svn/entries). If you remove .svn/text-base, 'svn status' says everything in the working dir is modified, and 'svn update' appears to work but doesn't seem to do anything (although I haven't tested it much).

.svn/entries -- required for svn to work at all. An XML file containing details of each file in the directory. The minimum required fields seem to be:

- for the directory, <entry committed-rev="1" name="" url="http://server/path/to/this/directory/in/repository" kind="dir" revision="1"/>

- for each file, <entry committed-rev="1" name="filename" kind="file" />

It looks like dir-wcprops, prop-base, props and wcprops aren't required. 'svn update' recreates dir-wcprops if you delete it.

If a file in the directory has a different revision to the directory itself, its <entry> element gets a 'revision' attribute. Otherwise all files have the revision specified in the directory's <entry> element's 'revision' attribute.