Mercurial ignore empty directory

This is one thing that I should really remember. Mercurial will just ignore empty directory so beware of doing something like this:-

$ mkdir myproject
$ cd myproject
$ hg init
$ vi index.php
(editing ....)
$ hg add index.php
$ hg commit
(commit message ...)
$ hg branch exp
marked working directory as branch exp
$ mkdir modules
$ hg add modules
$ hg commit
(commit message)
$ cd modules
$ vi exp.php
(editing ...)
$ hg add exp.php
$ hg up -C default
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg status
abort: No such file or directory
$ cd ..
$ ls
index.php
### wtf !!, this is not on the screen.

My expectation was only exp.php would be gone when I switch ‘cleanly’ to the default branch. In fact, the commit that I did when adding modules directory does record anything though it was logged and the revision increased.

Btw, this blog post illustrated the use of Mercurial better than the official docs.