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

Jesse Glick jesse.glick at sun.com
Fri Feb 22 15:12:25 CST 2008


Thomas Arendsen Hein wrote:
>> +            if repo.dirstate._dirignore(abs):
>> +                repo.ui.warn(_('warning: adding ignorable file %s\n') % name)
>> +                if fromcommit:
>> +                    repo.ui.warn(_("(use 'hg remove %s' to delete the file)\n")
>> +                                 % name)
>> +                else:
>> +                    repo.ui.warn(_("(use 'hg revert %s' to unadd the file)\n")
>> +                                 % name)
> 
> ... this is too much output.
> 
> I'd say just say something like 'adding (ignored) %s' (unless -q)

I was trying to be consistent with the existing two-line-per-file 
warning about adding files > 10 Mb in localrepo.py, from which I copied 
this warning. (But modified to say 'remove' if run from ci -A, since 
revert would be too late by then. Really backout might be the better 
option if you are comfortable with it.)

> instead of the usual 'adding %s' (only shown with -v).

(In fact this is also shown without -v if you add a pattern that matches 
some files, including just a dir name.)

> Or maybe a final message/warning "%d ignored files have been added"?

With a suggestion on how to reverse the problem? That would work as 
well. Would still need the 'fromcommit' parameter. Any other opinions / 
preferences?



More information about the Mercurial-devel mailing list