[PATCH] Warn in case user tries to add files which would otherwise be ignored

Jesse Glick jesse.glick at sun.com
Fri Feb 22 16:45:24 CST 2008


Alexis S. L. Carvalho wrote:
>> if a novice user runs 'hg add module/*' then generated-file is
>> added with no warning!
> 
> FWIW this shouldn't happen anymore after b41f0d6a74fc.

I did notice a change since 0.9.5, though I didn't track it back to this 
revision. Good to know. Which behavior is correct in this case is hard 
to judge, I guess - if the user said 'hg add module/build' presumably 
they meant it, whereas if 'hg add module/*' then presumably not; but 
Mercurial only gets the expanded argument list.

> (But "hg add module/build/*" will still add things).

Right, which can be observed in the test.

> Instead of changing the addremove and add commands, it's probably
> better to change the add method in localrepo.py.

Really? There might be other places where this is called that would 
legitimately want to add files mechanically with no warning. At least I 
did not feel comfortable pushing the warning that low, when other such 
UI messaging normally seems to be done by the command. Also it would be 
hard to include the suggestion about how to reverse the operation if the 
warning were printed in localrepo.add; note that this problem already 
exists for the 10Mb warning:

$ hg ci -A -m derby
adding derby-10.2.2.0.zip
derby-10.2.2.0.zip: files over 10MB may cause memory and performance 
problems
(use 'hg revert derby-10.2.2.0.zip' to unadd the file)
$ hg stat
$ hg revert derby-10.2.2.0.zip
no changes needed to derby-10.2.2.0.zip
$ # help!

> And we would probably want to rename dirstate._dirignore to 
> dirstate.ignore (but not in the same revision), since it won't really
> be private anymore...

Yes, I wasn't sure about that but it makes sense. I looked for an 
existing public method that would do what I wanted without overhead but 
did not find anything.



More information about the Mercurial-devel mailing list