Mercurial は空ディレクトリを管理対象に含めることができない

[~]% mkdir example && cd example

[example]% hg init

[example]% touch a.txt && mkdir b

[example]% ls -F
a.txt  b/

[example]% hg status
? a.txt

[example]% hg addremove
adding a.txt

[example]% hg status -A
A a.txt

[example]% hg ci -m "Initial import"

ディレクトリ b はスッパリと無視されています。

いざ clone してみても,

[example]% cd ..

[~]% hg clone example working
1 files updated, 0 files merged, 0 files removed, 0 files unresolved

[~]% cd working

[working]% ls -F
a.txt

[example]% hg status -A
C a.txt

このとおり,a.txt しかインポートされていません。

これは,Mercurial が「ファイル」のみを管理対象としていることに起因します。

I tried to check in an empty directory and it failed!

Mercurial doesn't track directories, it only tracks files. Which works for just about everything, except directories with no files in them. As empty directories aren't terribly useful and it makes the system much simpler, we don't intend to fix this any time soon. A couple workarounds:

  • add a file, like "this-dir-intentionally-left-blank"
  • create the directory with your Makefiles or other build processes
FAQ - Mercurial

「we don't intend to fix this any time soon.」グムーーー!