##// END OF EJS Templates
match: introduce uipath() to properly style a file path...
Matt Harbison -
r23480:88d2d77e default
parent child Browse files
Show More
@@ -65,6 +65,7 b' class match(object):'
65 self._anypats = bool(include or exclude)
65 self._anypats = bool(include or exclude)
66 self._ctx = ctx
66 self._ctx = ctx
67 self._always = False
67 self._always = False
68 self._pathrestricted = bool(include or exclude or patterns)
68
69
69 matchfns = []
70 matchfns = []
70 if include:
71 if include:
@@ -128,6 +129,12 b' class match(object):'
128 '''Convert repo path back to path that is relative to cwd of matcher.'''
129 '''Convert repo path back to path that is relative to cwd of matcher.'''
129 return util.pathto(self._root, self._cwd, f)
130 return util.pathto(self._root, self._cwd, f)
130
131
132 def uipath(self, f):
133 '''Convert repo path to a display path. If patterns or -I/-X were used
134 to create this matcher, the display path will be relative to cwd.
135 Otherwise it is relative to the root of the repo.'''
136 return (self._pathrestricted and self.rel(f)) or f
137
131 def files(self):
138 def files(self):
132 '''Explicitly listed files or patterns or roots:
139 '''Explicitly listed files or patterns or roots:
133 if no patterns or .always(): empty list,
140 if no patterns or .always(): empty list,
@@ -191,6 +198,7 b' class narrowmatcher(match):'
191 self._path = path
198 self._path = path
192 self._matcher = matcher
199 self._matcher = matcher
193 self._always = matcher._always
200 self._always = matcher._always
201 self._pathrestricted = matcher._pathrestricted
194
202
195 self._files = [f[len(path) + 1:] for f in matcher._files
203 self._files = [f[len(path) + 1:] for f in matcher._files
196 if f.startswith(path + "/")]
204 if f.startswith(path + "/")]
General Comments 0
You need to be logged in to leave comments. Login now