##// 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 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 213 self._root = root
214 214 self._cwd = cwd
215 215 if badfn is not None:
216 216 self.bad = badfn
217 self._relativeuipath = relativeuipath
217 218
218 219 def __call__(self, fn):
219 220 return self.matchfn(fn)
@@ -248,7 +249,7 b' class basematcher(object):'
248 249 '''Convert repo path to a display path. If patterns or -I/-X were used
249 250 to create this matcher, the display path will be relative to cwd.
250 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 254 @propertycache
254 255 def _files(self):
@@ -307,14 +308,14 b' class matcher(basematcher):'
307 308 def __init__(self, root, cwd, normalize, patterns, include=None,
308 309 default='glob', exact=False, auditor=None, ctx=None,
309 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 313 if include is None:
312 314 include = []
313 315
314 316 self._anypats = bool(include)
315 317 self._anyincludepats = False
316 318 self._always = False
317 self._pathrestricted = bool(include or patterns)
318 319 self.patternspat = None
319 320 self.includepat = None
320 321
@@ -362,9 +363,6 b' class matcher(basematcher):'
362 363
363 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 366 @propertycache
369 367 def _dirs(self):
370 368 return set(util.dirs(self._fileset)) | {'.'}
General Comments 0
You need to be logged in to leave comments. Login now