Serving Static Repositories Using Mercurial
Monday, 20 August 2007
I have been playing with Mercurial for a little web project. It works fine locally, but when I tried to publish a static copy on my web host, it started playing up.
I was unable to clone the remote repository using:
hg clone static-http://www.redmountainsw.com/phpar/ new_local_dirname
I kept getting this message:
requesting all changes
adding changesets
transaction abort!
rollback completed
abort: integrity check failed on data/install.php.d:0!
For a while I thought the problem had to do with line-endings, as the development was done on a Windows box, and the repository was uploaded to a Unix shared host. This turned out not to be the case after all.
Inspecting the http result with curl,
curl -i http://www.redmountainsw.com/phpar/.hg/data/install.php.i
it turns out that Apache’s php handler was processing the contents of the php file.
Resolution
Create a .htaccess file in the .hg directory like this:
php_flag engine off
Now everything works!