[PATCH] match: added matchessubrepo method to matcher

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Aug 10 08:52:50 EDT 2016



On 08/10/2016 02:40 PM, Yuya Nishihara wrote:
> On Tue, 09 Aug 2016 09:51:57 +0000, Hannes Oldenburg wrote:
>> # HG changeset patch
>> # User Hannes Oldenburg <hannes.christian.oldenburg at gmail.com>
>> # Date 1470733371 0
>> #      Tue Aug 09 09:02:51 2016 +0000
>> # Node ID 83d4910236336c3a72cff356f9f002d0e0710efc
>> # Parent  12c72545f8627845c56b070a27eff88adefd7c16
>> match: added matchessubrepo method to matcher
>
>> +++ b/mercurial/match.py	Tue Aug 09 09:02:51 2016 +0000
>> @@ -320,6 +320,10 @@
>>              kindpats.append((kind, pat, ''))
>>          return kindpats
>>
>> +    def matchessubrepo(self, subpath):
>> +        return (self.exact(subpath)
>> +                or any(f.startswith(subpath + '/') for f in self.files()))
>
> This function isn't restricted to subrepos. Maybe it could be called by
> more generic name such as m.anysubtreeof(f).

matchessubpath ?

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list