Empty directories in Mercurial
Mercurial does not support empty directories (Section 5.1.2), but you need empty directories if you have Mercurial running ontop of an SVN checkout and you want to move your Mercurial repository to a different machine and still be able to perform svn operations.
Running the following script from the base of your repository will rebuild the empty directories.
#!/bin/bash
# Rebuilds empty directories which are lost by HG but required by SVN
for d in `find . -type d | grep /.svn$`;
do
# -p to make $d/tmp parent directory
`mkdir -p $d/tmp/prop-base`
`mkdir $d/tmp/props`
`mkdir $d/tmp/text-base`
done
An example of how I used this script:
I had a local directory named recsys where I was working on the recommender system for DSpace. It was an SVN checkout of the DSpace trunk and I liked to keep the prototype in sync with trunk to help prevent bitrot. If I pulled recsys from my development machine to my laptop, I lost vital svn directories for performing SVN updates.
Running the above script from the base of the recsys directory re-created the empty SVN directories and let me continue with my work on a different machine.
delliott@localhost:~/Source/recsys$ hg init delliott@localhost:~/Source/recsys$ hg pull http://example.org:8000 pulling from http://example.org:8000 requesting all changes adding changesets adding manifests adding file changes added 9 changesets with 820 changes to 809 files (run 'hg update' to get a working copy) delliott@localhost:~/Source/recsys$ hg update 807 files updated, 0 files merged, 0 files removed, 0 files unresolved delliott@localhost:~/Source/recsys$ svn update svn: Can't open '.svn/tmp/tempfile.tmp': No such file or directory delliott@localhost:~/Source/recsys$ ./create_empty_directories.sh delliott@localhost:~/Source/recsys$ svn update U dspace/config/dspace.cfg Updated to revision 3005.
Caveat: I may have totally misunderstood Mercurial. If you think I have, please let me know how I should have solved this problem.

