problems with empty directories and "hg clean"

Ondrej Certik ondrej at
Tue Mar 25 12:00:54 CDT 2008

Hi all,

I use hg to version my /etc directory on the server. There needs to be
some empty directories in there, otherwise some services stop working.

I use "hg st" to report all changes. And I use "hg clean" to clean up
some mess, that isn't versioned and thus I don't need it. However, "hg
clean" deletes all empty directories.

Consider this simple example that illustrates the problem:

$ cd /tmp/
$ mkdir test
$ cd test
$ ls
$ hg init
$ hg st
$ mkdir pokus
$ hg st
$ ll
total 4
drwxr-xr-x 2 ondra ondra 4096 2008-03-25 17:54 pokus
$ hg clean
$ ll
total 0

I am not even reporting this as a bug, as I think it's just a feature.
But how would you suggest me to improve my usage of Mercurial, so that
I don't accidentaly delete empty directories? I find it inconsistent,
that "hg st" doesn't report them, but "hg clean" does delete them.


More information about the Mercurial mailing list