MarkEmptyDirs - A tool for adding empty directories to a Mercurial repository

Johann Duscher johann.duscher at web.de
Mon Aug 10 05:18:56 CDT 2009


Hi,

I don't want to start a discussion why, why not, when, and when not 
versioning empty directories makes sense. There are situations, however, 
where creating the missing directories by some magic is not practicable 
and people will face the problem of managing placeholder files which are 
placed into empty directories. These placeholder files will make sure 
that, upon checkout, the directory tree is entirely reconstructed. This 
solution is also suggested in the Mercurial FAQ.

The problem with using placeholder files is that you need to create 
them, and delete them, if they are not necessary anymore (because there 
were added sub-directories or files). With big source trees managing 
these placeholder files can be cumbersome and error prone.

I have been confronted with such a situation several times now. This is 
why I decided to write an open source tool which can manage the 
creation/deletion of such placeholder files automatically. It creates 
placeholder files in all empty "leaf" directories. If later on new files 
or directories are put into such directories, the placeholder files are 
not necessary anymore and, thus, are removed automatically.

If you would find such a tool helpful, too, please feel free to download 
it here: http://freshmeat.net/projects/markemptydirs

If you need an overview of typical use cases where this tool can ease 
your work just have a look at: 
http://code.google.com/p/markemptydirs/wiki/UseCases

Any ideas or bug reports are highly appreciated :)

Best regards,
Jonny Dee


More information about the Mercurial mailing list