##// 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 65 self._anypats = bool(include or exclude)
66 66 self._ctx = ctx
67 67 self._always = False
68 self._pathrestricted = bool(include or exclude or patterns)
68 69
69 70 matchfns = []
70 71 if include:
@@ -128,6 +129,12 b' class match(object):'
128 129 '''Convert repo path back to path that is relative to cwd of matcher.'''
129 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 138 def files(self):
132 139 '''Explicitly listed files or patterns or roots:
133 140 if no patterns or .always(): empty list,
@@ -191,6 +198,7 b' class narrowmatcher(match):'
191 198 self._path = path
192 199 self._matcher = matcher
193 200 self._always = matcher._always
201 self._pathrestricted = matcher._pathrestricted
194 202
195 203 self._files = [f[len(path) + 1:] for f in matcher._files
196 204 if f.startswith(path + "/")]
General Comments 0
You need to be logged in to leave comments. Login now