[PATCH 3 of 5 V2] dirstate: add a way to get the ignore file/line matching an ignored file
Laurent Charignon
lcharignon at fb.com
Tue Jan 5 16:06:46 UTC 2016
> On Dec 31, 2015, at 8:42 AM, Augie Fackler <raf at durin42.com> wrote:
>
> On Sat, Dec 26, 2015 at 07:41:32PM -0800, Laurent Charignon wrote:
>> # HG changeset patch
>> # User Laurent Charignon <lcharignon at fb.com>
>> # Date 1450902341 28800
>> # Wed Dec 23 12:25:41 2015 -0800
>> # Node ID 674616200041c2bfd72cd93ea4dc4083804db6b6
>> # Parent 6b3004e5fd2b94fbe2397263465ab8d3acf683d1
>> dirstate: add a way to get the ignore file/line matching an ignored file
>
> This patch no longer applies due to your other dirstate patch. I'll
> push patches 1 and 2 and you can rebase and resend 3::5.
Sure, thanks, I sent them again.
>
>>
>> This information will be used to improve debugignore (issue4856).
>>
>> diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
>> --- a/mercurial/dirstate.py
>> +++ b/mercurial/dirstate.py
>> @@ -8,7 +8,7 @@
>> from node import nullid
>> from i18n import _
>> import scmutil, util, osutil, parsers, encoding, pathutil, error
>> -import os, stat, errno
>> +import os, stat, errno, collections
>> import match as matchmod
>>
>> propertycache = util.propertycache
>> @@ -738,6 +738,26 @@
>> files.append(os.path.join(self._rootdir, util.expandpath(path)))
>> return files
>>
>> + def _ignorefileandline(self, f):
>> + files = collections.deque(self._ignorefiles())
>> + visited = set()
>> + while files:
>> + i = files.popleft()
>> + patterns = matchmod.readpatternfile(i, self._ui.warn,
>> + sourceinfo=True)
>> + for pattern, lineno, line in patterns:
>> + kind, p = matchmod._patsplit(pattern, 'glob')
>> + if kind == "subinclude":
>> + if p not in visited:
>> + files.append(p)
>> + continue
>> + m = matchmod.match(self._root, '', [], [pattern],
>> + warn=self._ui.warn)
>> + if m(f):
>> + return (i, lineno, line)
>> + visited.add(i)
>> + return (None, -1, "")
>> +
>> def _walkexplicit(self, match, subrepos):
>> '''Get stat data about the files explicitly specified by match.
>>
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel at selenic.com
>> https://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list