##// END OF EJS Templates
match: move entire uipath() implementation to basematcher...
Martin von Zweigbergk -
r32496:ca77a243 default
parent child Browse files
Show More
@@ -209,11 +209,12 b' def _donormalize(patterns, default, root'
209
209
210 class basematcher(object):
210 class basematcher(object):
211
211
212 def __init__(self, root, cwd, badfn=None):
212 def __init__(self, root, cwd, badfn=None, relativeuipath=True):
213 self._root = root
213 self._root = root
214 self._cwd = cwd
214 self._cwd = cwd
215 if badfn is not None:
215 if badfn is not None:
216 self.bad = badfn
216 self.bad = badfn
217 self._relativeuipath = relativeuipath
217
218
218 def __call__(self, fn):
219 def __call__(self, fn):
219 return self.matchfn(fn)
220 return self.matchfn(fn)
@@ -248,7 +249,7 b' class basematcher(object):'
248 '''Convert repo path to a display path. If patterns or -I/-X were used
249 '''Convert repo path to a display path. If patterns or -I/-X were used
249 to create this matcher, the display path will be relative to cwd.
250 to create this matcher, the display path will be relative to cwd.
250 Otherwise it is relative to the root of the repo.'''
251 Otherwise it is relative to the root of the repo.'''
251 return self.rel(f)
252 return (self._relativeuipath and self.rel(f)) or self.abs(f)
252
253
253 @propertycache
254 @propertycache
254 def _files(self):
255 def _files(self):
@@ -307,14 +308,14 b' class matcher(basematcher):'
307 def __init__(self, root, cwd, normalize, patterns, include=None,
308 def __init__(self, root, cwd, normalize, patterns, include=None,
308 default='glob', exact=False, auditor=None, ctx=None,
309 default='glob', exact=False, auditor=None, ctx=None,
309 listsubrepos=False, warn=None, badfn=None):
310 listsubrepos=False, warn=None, badfn=None):
310 super(matcher, self).__init__(root, cwd, badfn)
311 super(matcher, self).__init__(root, cwd, badfn,
312 relativeuipath=bool(include or patterns))
311 if include is None:
313 if include is None:
312 include = []
314 include = []
313
315
314 self._anypats = bool(include)
316 self._anypats = bool(include)
315 self._anyincludepats = False
317 self._anyincludepats = False
316 self._always = False
318 self._always = False
317 self._pathrestricted = bool(include or patterns)
318 self.patternspat = None
319 self.patternspat = None
319 self.includepat = None
320 self.includepat = None
320
321
@@ -362,9 +363,6 b' class matcher(basematcher):'
362
363
363 self.matchfn = m
364 self.matchfn = m
364
365
365 def uipath(self, f):
366 return (self._pathrestricted and self.rel(f)) or self.abs(f)
367
368 @propertycache
366 @propertycache
369 def _dirs(self):
367 def _dirs(self):
370 return set(util.dirs(self._fileset)) | {'.'}
368 return set(util.dirs(self._fileset)) | {'.'}
General Comments 0
You need to be logged in to leave comments. Login now