[PATCH 1 of 1] Add inverting pattern syntax to .hgignore (.hginclude alternative)

Mitch Frazier mitch at fmr.name
Thu Nov 3 15:41:08 UTC 2005


Benoit Boissinot wrote:
> i like this way of doing it a lot better.
>> diff -r dfe07637675a -r 7304165b0a7e mercurial/dirstate.py
>> --- a/mercurial/dirstate.py	Wed Nov  2 19:58:24 2005 -0600
>> +++ b/mercurial/dirstate.py	Wed Nov  2 20:01:59 2005 -0600
>> @@ -43,11 +43,15 @@
>> [snip]
>>                      continue
>>                  pat = syntax + line
>>                  for s in syntaxes.keys():
>> -                    if line.startswith(s):
>> -                        pat = line
>> -                        break
>> -                pats.append(pat)
>> +                    if line.startswith('!'):
>> +                        notflag = True
>> +                        t = line[1:].strip()
>> +                        if t.startswith(s):
>> +                            pat = t
>> +                            break
>> +                    else:
>> +                        if line.startswith(s):
>> +                            pat = line
>> +                            break
>> +
>> +                if gnotflag or notflag:
>> +                    notpats.append(pat)
>> +                else:
>> +                    pats.append(pat)
> This will not work with "!invalippat:something".

The current method passes things such as:

  invalidpat:something

thru as:

  syntax:invalidpat:something

the above method passes things such as:

  !invalidpat:something

thru as:

  syntax:!invalidpat:something

Which seems to be consistent.  It does however incorrectly put it in
'notpats' rather than in 'pats'.

Not sure if passing it thru as "syntax:!invalidpat:something" is what
you're saying doesn't work or if putting it in 'notpats' is the problem.



More information about the Mercurial mailing list