##// END OF EJS Templates
match: remove head and tail args from _globre
Matt Mackall -
r8582:a4c199e1 default
parent child Browse files
Show More
@@ -120,7 +120,7 b' def _patsplit(pat, default):'
120 120 return pat, val
121 121 return default, pat
122 122
123 def _globre(pat, head, tail):
123 def _globre(pat):
124 124 "convert a glob pattern into a regexp"
125 125 i, n = 0, len(pat)
126 126 res = ''
@@ -170,7 +170,7 b' def _globre(pat, head, tail):'
170 170 res += re.escape(c)
171 171 else:
172 172 res += re.escape(c)
173 return head + res + tail
173 return res
174 174
175 175 def _regex(kind, name, tail):
176 176 '''convert a pattern into a regular expression'''
@@ -181,14 +181,14 b' def _regex(kind, name, tail):'
181 181 elif kind == 'path':
182 182 return '^' + re.escape(name) + '(?:/|$)'
183 183 elif kind == 'relglob':
184 return _globre(name, '(?:|.*/)', tail)
184 return '(?:|.*/)' + _globre(name) + tail
185 185 elif kind == 'relpath':
186 186 return re.escape(name) + '(?:/|$)'
187 187 elif kind == 'relre':
188 188 if name.startswith('^'):
189 189 return name
190 190 return '.*' + name
191 return _globre(name, '', tail)
191 return _globre(name) + tail
192 192
193 193 def _buildmatch(pats, tail):
194 194 """build a matching function from a set of patterns"""
General Comments 0
You need to be logged in to leave comments. Login now