Subversion

In March 2011 I began experimenting with Subversion 1.6.16, commonly known as svn. The last time I looked at Subversion was back in 2009, but I decided then I was better off using FreeBSD’s CVS, at least for my purposes.

Subversion is an improvement over older revision control systems. The ability to version directory hierarchies is nowhere to be found in, say CVS. No more meat ball surgery to perform on the repository when files and directories change names or location.

However, I have found a couple of shortcomings in Subversion.

First, there’s currently no way of defining your own keywords, specify how such keywords are to be formatted, and have these keywords expanded with the stock Subversion client. This feature has been requested since 2004. For more details, see Subversion issue #890.

Second, when you check out files from a Subversion repository, the files are stored twice. Once in their native location, possibly with the keywords expanded, and a second time in the .svn/text-base directory with the keywords contracted.

Imagine a source code hierarchy of 300 megabytes. Due to the duplication of files, a checkout genererates a working directory hierarchy in excess of 600 megabytes. Yikes. Be sure to store your working directories on file systems with compression and/or data deduplication turned on, you might save yourself a disk block or two.

My first objection can be corrected by using FreeBSD’s tailored version of Subversion. If you, like myself, run FreeBSD, you might already have installed the port devel/subversion-freebsd. This enables me to have the property svn:keywords set to, say, Ximalas=%H, where appropriate. Whenever code is shared among different projects, it makes sense to have a unique keyword for each project. Thus, it’s easy to see which version a particular file is based on with regard to the other projects. The FreeBSD patch set for Subversion is available from http://people.freebsd.org/~peter/svn_keyword.diff. You might also want to look at http://people.freebsd.org/~peter/svn_notes.txt.

My second objection will probably never be fixed, it’s by design.

I’m eager to see what will become of the future version 1.7 of Subversion, but I’m prepared to be slightly disappointed, again.

So far only a couple of toy programs are stored in separate repositories at svn://svn.ximalas.info/. Do what you want with these programs.

Check out:

svn://svn.ximalas.info/check-dmesg
I.e. svn co svn://svn.ximalas.info/check-dmesg

svn://svn.ximalas.info/sleep-setproctitle
I.e. svn co svn://svn.ximalas.info/sleep-setproctitle

svn://svn.ximalas.info/cpu-freq
I.e. svn co svn://svn.ximalas.info/cpu-freq

Make sure to use a patched Subversion client if you want the $Ximalas$ keyword expanded.

I have set enable-auto-props = yes in my ~/.subversion/config file. Below is the contents of the [auto-props] section in my ~/.subversion/config file. Blank lines and comments are permitted.

# Borrowed from FreeBSD:
*.c     = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/plain
*.h     = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/plain
*.s     = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/plain
*.S     = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/plain
*.cc    = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/plain
*.cpp   = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/plain
*.cxx   = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/plain
*.in    = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/plain
*.sh    = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/plain; svn:executable
*.pl    = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/plain; svn:executable
*.pm    = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/plain
*.py    = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/plain
*.rb    = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/plain
*.awk   = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/plain
*.sed   = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/plain
*.txt   = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/plain
*.conf  = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/plain
Makefile* = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/plain
*.1     = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/plain
*.2     = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/plain
*.3     = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/plain
*.4     = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/plain
*.5     = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/plain
*.6     = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/plain
*.7     = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/plain
*.8     = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/plain
*.9     = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/plain

*.css   = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/css
*.html  = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/html
*.xhtml = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/html+xml
*.xml   = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/xml
*.xsd   = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/xml
*.xsl   = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/xml
*.xslt  = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/xml
*.xul   = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/xul
*.sgml   = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/sgml
*.docbook = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/sgml

*.pdf   = svn:mime-type=application/pdf
*.ps    = svn:mime-type=application/postscript
*.eps   = svn:mime-type=application/postscript
*.exe   = svn:mime-type=application/octet-stream
*.bin   = svn:mime-type=application/octet-stream

*.jpg   = svn:mime-type=image/jpeg
*.jpeg  = svn:mime-type=image/jpeg
*.gif   = svn:mime-type=image/gif
*.png   = svn:mime-type=image/png
*.tiff  = svn:mime-type=image/tiff

# Trond's own auto-props:
GNUmakefile* = svn:eol-style=native; svn:keywords=Ximalas=%H; svn:mime-type=text/plain
*.tex   = svn:eol-style=native; svn:keywords=Author Date HeadURL Header Id Revision Ximalas=%H; svn:mime-type=text/plain

*.odc   = svn:mime-type=application/vnd.oasis.opendocument.chart
*.otc   = svn:mime-type=application/vnd.oasis.opendocument.chart-template
*.odb   = svn:mime-type=application/vnd.oasis.opendocument.database
*.odf   = svn:mime-type=application/vnd.oasis.opendocument.formula
*.otf   = svn:mime-type=application/vnd.oasis.opendocument.formula-template
*.odg   = svn:mime-type=application/vnd.oasis.opendocument.graphics
*.otg   = svn:mime-type=application/vnd.oasis.opendocument.graphics-template
*.odi   = svn:mime-type=application/vnd.oasis.opendocument.image
*.oti   = svn:mime-type=application/vnd.oasis.opendocument.image-template
*.odp   = svn:mime-type=application/vnd.oasis.opendocument.presentation
*.otp   = svn:mime-type=application/vnd.oasis.opendocument.presentation-template
*.ods   = svn:mime-type=application/vnd.oasis.opendocument.spreadsheet
*.ots   = svn:mime-type=application/vnd.oasis.opendocument.spreadsheet-template
*.odt   = svn:mime-type=application/vnd.oasis.opendocument.text
*.odm   = svn:mime-type=application/vnd.oasis.opendocument.text-master
*.ott   = svn:mime-type=application/vnd.oasis.opendocument.text-template
*.oth   = svn:mime-type=application/vnd.oasis.opendocument.text-web

*.doc   = svn:mime-type=application/msword
*.ppt   = svn:mime-type=application/vnd.ms-powerpoint
*.xls   = svn:mime-type=application/vnd.ms-excel

*.docx  = svn:mime-type=application/vnd.openxmlformats-officedocument.wordprocessingml.document
*.dotx  = svn:mime-type=application/vnd.openxmlformats-officedocument.wordprocessingml.template
*.pptx  = svn:mime-type=application/vnd.openxmlformats-officedocument.presentationml.presentation
*.potx  = svn:mime-type=application/vnd.openxmlformats-officedocument.presentationml.template
*.xlsx  = svn:mime-type=application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

Leave a Reply

Your email address will not be published. Required fields are marked *

Yet another technical oriented blog, more or less