Glob patterns and .hgignore

Martin Geisler mg at lazybytes.net
Thu Dec 15 14:19:30 UTC 2011


Scott Palmer <swpalmer at gmail.com> writes:

> On 2011-12-15, at 3:55 AM, Martin Geisler wrote:
>
>> Hi everybody,
>> 
>> Yesterday, a guy asked how he could add files matching various
>> patterns and I proposed putting the patterns in a file and use
>> 
>>  hg add listfile:patterns.txt
>> 
>> See http://unix.stackexchange.com/a/26817/13300 for details. However,
>> it turns out that the patterns respect the .hgignore file.
>> 
>> I expected that
>> 
>>  hg add "glob:*.jpg"
>> 
>> would add x.jpg, even if ignored. On the other hand, I would not
>> expect
>> 
>>  hg add -I "glob:*.jpg"
>> 
>> to add it
>
> I'm confused already. wouldn't the explicit -I on the command line
> override the .hgingnore file? I think it could be the opposite of what
> you wrote above.

Testing this, it seems that neither override the .hgignore. I guess part
of my confusion (don't know about yours...) is that the -I flag seems
redundant when you can mention files directly.

>> -- that seems like the useful distinction between a direct
>> filename and the -I flag.
>
> But a pattern *.jpg is not really a direct filename is it?

No, not the the code :) But I was thinking of it like this

  hg add <direct filenames> -I <not so direct filenames>

In reality, .hgignore will overrule anything that isn't a full path to a
file.


-- 
Martin Geisler

Mercurial links: http://mercurial.ch/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20111215/8ec1c78e/attachment.asc>


More information about the Mercurial mailing list