#695143 mercurial removes directory when removing the last contained file.

Package:
mercurial
Source:
mercurial
Description:
easy-to-use, scalable distributed version control system
Submitter:
g1
Date:
2012-12-04 22:54:05 UTC
Severity:
normal
#695143#5
Date:
2012-12-04 15:44:41 UTC
From:
To:
If I "hg remove" the last file in a directory, mercurial removes
the directory on commit (see below).

Perhaps it's an upstream bug.

Perhaps it's a feature documented in the Definitive Guide, but I
won't buy the book just to check this, and the online version at
http://hgbook.red-bean.com/read/ is barely usable.

Script started on Tue Dec  4 16:21:35 2012
| $ hg init
| $ mkdir d
| $ echo a > d/a
| $ hg add d/a
| $ hg commit -m file_created
| $ ls -s d
| total 4
| 4 a
| $ hg manifest -v
| 644   d/a
| $ hg rm d/a
| $ hg commit -m file_removed
| $ ls -s d
| ls: cannot access d: No such file or directory
Script done on Tue Dec  4 16:23:16 2012

#695143#10
Date:
2012-12-04 22:51:46 UTC
From:
To:
tags 695143 + upstream wontfix
thanks

Mercurial tracks files.  It has no way of representing an empty
directory so it deletes it when you remove all the files in it.  If
you want to have an empty directory in your repository, add an empty
.dummy file in it.  For more info see "Mercurial tracks files, not
directories" in the Definitive Guide:

http://hgbook.red-bean.com/read/mercurial-in-daily-use.html

Cheers,
Javi