Mercurial > hg
comparison mercurial/match.py @ 32650:783394c0c978
match: simplify nevermatcher
Most of it does the same as its superclass, so it can simply be
removed. It also seems to make more sense for it to use relative
paths, as we do for everything except alwaysmatcher, although
nevermatcher.uipath() will probably never get called anyway, so it
won't matter.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 01 Jun 2017 08:31:21 -0700 |
parents | e6ff007e107e |
children | 3e8eb6d84a5c |
comparison
equal
deleted
inserted
replaced
32649:7a209737f01c | 32650:783394c0c978 |
---|---|
151 else: | 151 else: |
152 m = patternmatcher(root, cwd, kindpats, ctx=ctx, | 152 m = patternmatcher(root, cwd, kindpats, ctx=ctx, |
153 listsubrepos=listsubrepos, badfn=badfn) | 153 listsubrepos=listsubrepos, badfn=badfn) |
154 else: | 154 else: |
155 # It's a little strange that no patterns means to match everything. | 155 # It's a little strange that no patterns means to match everything. |
156 # Consider changing this to match nothing (probably adding a | 156 # Consider changing this to match nothing (probably using nevermatcher). |
157 # "nevermatcher"). | |
158 m = alwaysmatcher(root, cwd, badfn) | 157 m = alwaysmatcher(root, cwd, badfn) |
159 | 158 |
160 if include: | 159 if include: |
161 kindpats = normalize(include, 'glob', root, cwd, auditor, warn) | 160 kindpats = normalize(include, 'glob', root, cwd, auditor, warn) |
162 im = includematcher(root, cwd, kindpats, ctx=ctx, | 161 im = includematcher(root, cwd, kindpats, ctx=ctx, |
343 return '<alwaysmatcher>' | 342 return '<alwaysmatcher>' |
344 | 343 |
345 class nevermatcher(basematcher): | 344 class nevermatcher(basematcher): |
346 '''Matches nothing.''' | 345 '''Matches nothing.''' |
347 | 346 |
348 def __init__(self, root, cwd, badfn=None, relativeuipath=False): | 347 def __init__(self, root, cwd, badfn=None): |
349 super(nevermatcher, self).__init__(root, cwd, badfn, | 348 super(nevermatcher, self).__init__(root, cwd, badfn) |
350 relativeuipath=relativeuipath) | |
351 | |
352 def always(self): | |
353 return False | |
354 | |
355 def matchfn(self, f): | |
356 return False | |
357 | |
358 def visitdir(self, dir): | |
359 return False | |
360 | 349 |
361 def __repr__(self): | 350 def __repr__(self): |
362 return '<nevermatcher>' | 351 return '<nevermatcher>' |
363 | 352 |
364 class patternmatcher(basematcher): | 353 class patternmatcher(basematcher): |