E-Scribe News : a programmer’s blog

About Me

PBX My name is Paul Bissex, and e-scribe.com is my consulting business. I build web applications using as much open source software as possible. From September to June I teach web design and other important non-photographic professional skills to photographers. In the '90s I wrote technology commentary and reviews for magazines, newspapers, and web publications, including Wired, Salon.com, FamilyPC, the late lamented Web Review, and the Chicago Tribune. Feel free to email me.

Book Project

I'm co-authoring a book, "Python Web Development with Django", with Jeff Forcier and Wesley Chun. It will be published by Prentice Hall in July 2008, but is available for pre-ordering on Amazon now.

Colophon

This site is built on a fresh trunk checkout of Django, running on Python 2.5.1, served by Apache and mod_python. The database is SQLite. The operating system is FreeBSD, on a VPS hosted at Johncompanies.com. Comment-spam protection by Akismet. Vintage topo imagery from the Maptech archive.

Pile o'Tags

Stuff I Use

Akismet, del.icio.us, Django, dpaste.com, Emacs, FreeBSD, Freenode, jQuery, LaunchBar, MacPorts, Markdown, Mercurial, OS X, Postfix, Python, SQLite, Subversion, TextMate, Trac, Ubuntu Linux, wmii

A Django site.
(Finally!)

Copyright 2008
by Paul Bissex
and E-Scribe New Media

In-place import using Subversion

Thanks to the helpful folks on the #svn IRC channel I learned that it is possible to turn a directory into a svn checkout in-place, i.e. without having to replace the directory itself with a fresh checkout after you svn import. This is very handy for things like /etc files and other stuff that you'd rather not be shuffling around unnecessarily.

The key nugget of info is here in the svn FAQ.

I used this on a production website which formerly used a simple test/live setup: changes in the test copy were pushed to the live copy via rsync. I wanted this upgrade to work with that model; I didn't want all the timestamps on the test copy to change, as they would with a svn import + checkout.

The sequence of commands I used (edited for clarity) was:

svn mkdir file:///svn/sites/foo -m "Foo repo directory creation"
cd /www/test
svn co file:///svn/sites/foo .
svn add * 
svn ci -m "Initial import"

After that, I ran my rsync script (which I updated with --exclude .svn). It did touch each directory in the target site, because strictly speaking they had changed (they all now had that .svn subdirectory that rsync was otherwise ignoring). But it worked perfectly, and now the site's under version control, which always brings huge piece of mind.

Update: You can also use svn add . --force in the fourth line above if you have certain files or directories that you're ignoring via the svn:ignore property.

Tuesday, March 27th, 2007
+ +

Post a comment

Comments use Markdown syntax. Your comment will not appear until approved, which may take a few hours or more. Spammers will be torpedoed.


(Will not be shared)

(Optional)