Issue521

Title hg add doesn't handle empty directory
Priority bug Status chatting
Superseder Nosy List ThomasAH, keramida, markdashabout, martinoconnor, proppy
Assigned To Topics

Created on 2007-03-21.23:37:37 by proppy, last changed 2008-06-27.08:04:20 by keramida.

Messages
msg6431 (view) Author: keramida Date: 2008-06-27.08:04:19
I have personally fixed *two* build systems, one based on CVS and
another based on Perforce, to remove the need for "magic" empty
directories.  The fix was easy: "Just add appropriate dependencies in
the makefiles of the build infrastructure, so that the required
directories are created as an explicit dependency that is part of the
build process.

I don't think it makes sense to make huge repository format and other
related changes to track empty directories.  If they are build-time
requirements, then they should be built as build-time objects.  "Oops, I
broke our build because it doesn't have full dependencies" doesn't sound
very convincing; at least not to me.
msg6426 (view) Author: martinoconnor Date: 2008-06-26.20:06:06
Is it possible to have a hook script checked in to your repository that
mercurial could be configured to run on checkout? This could then go about
creating all the empty directories not handled in the repository.
msg6418 (view) Author: markdashabout Date: 2008-06-26.14:41:23
Come on guys, 

I understand that this is a decision but have you any idea how much time this
wastes? Under CVS, a new programmer joins the company. Every time without fail
this is what happens: 

I checked in my extremely urgent cannot wait and very complex changes, last week
the build system has gone wrong because they are not in the build. 

Mutterings from me as I go and check view CVS to find out what has happened. 

You need to create dummyFile in the directory

What needs to be in it? 

It doesnt matter. Just put your name if you like. 

Why do I have to put anything if it doent matter? 

Then they do it again, and the file Dummyfile , that they created gets into the
build. (Our build system removes dummyFile but not Dummyfile) 

We go through the whole charade again, before they get it right. 

Bottom line is doing things this way can never save time. Programmers are human
and do not rememmber this type of thing. 

Its a pain I live with in CVS, but has been voiced as a reason for not adopting
mercurial because we are so fed up with it!  Dropping CVS and taking up
something else is a hard decision but nobody expects non-versioning of empty
directories. Not in anything we would adopt anyway, 

Wont you re-consider?
msg2932 (view) Author: ThomasAH Date: 2007-03-23.15:04:50
See "I tried to check in an empty directory and it failed!" in the FAQ
msg2925 (view) Author: keramida Date: 2007-03-22.00:44:55
Mercurial doesn't keep directories in its "manifest", as far as I
know.  This may be a bit tricky to change.

Why would you want to keep an empty directory under SCM control,
though?  Perhaps there is some way to do what you want already,
albeit slightly differently? :-)
msg2922 (view) Author: proppy Date: 2007-03-21.23:40:49
uname -a
Darwin johan-euphrosines-computer.local 8.9.1 Darwin Kernel Version 8.9.1: Thu
Feb 22 20:55:00 PST 2007; root:xnu-792.18.15~1/RELEASE_I386 i386 i386
msg2921 (view) Author: proppy Date: 2007-03-21.23:39:38
hg --version
Mercurial Distributed SCM (version 0.9.3)

Copyright (C) 2005, 2006 Matt Mackall <mpm@selenic.com>
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
msg2920 (view) Author: proppy Date: 2007-03-21.23:37:37
mkdir test_empty_directory
cd test_empty_directory
hg init
mkdir i_am_empty
hg add #(does nothing)
hg status #(nothing added)
hg commit -m "empty" #(nothing changed)
History
Date User Action Args
2008-06-27 08:04:20keramidasetnosy: ThomasAH, keramida, proppy, martinoconnor, markdashabout
messages: + msg6431
2008-06-26 20:06:08martinoconnorsetnosy: + martinoconnor
messages: + msg6426
2008-06-26 14:41:25markdashaboutsetstatus: resolved -> chatting
nosy: + markdashabout
messages: + msg6418
2007-03-23 15:04:51ThomasAHsetstatus: chatting -> resolved
nosy: + ThomasAH, keramida
messages: + msg2932
2007-03-22 00:44:55keramidasetmessages: + msg2925
2007-03-21 23:40:49proppysetmessages: + msg2922
2007-03-21 23:39:39proppysetstatus: unread -> chatting
messages: + msg2921
2007-03-21 23:37:37proppycreate