##// END OF EJS Templates
Permit glob patterns to use nested curly braces.
Jesse Glick -
r5949:48d01b1e default
parent child Browse files
Show More
@@ -262,7 +262,7 b" def globre(pat, head='^', tail='$'):"
262 "convert a glob pattern into a regexp"
262 "convert a glob pattern into a regexp"
263 i, n = 0, len(pat)
263 i, n = 0, len(pat)
264 res = ''
264 res = ''
265 group = False
265 group = 0
266 def peek(): return i < n and pat[i]
266 def peek(): return i < n and pat[i]
267 while i < n:
267 while i < n:
268 c = pat[i]
268 c = pat[i]
@@ -292,11 +292,11 b" def globre(pat, head='^', tail='$'):"
292 stuff = '\\' + stuff
292 stuff = '\\' + stuff
293 res = '%s[%s]' % (res, stuff)
293 res = '%s[%s]' % (res, stuff)
294 elif c == '{':
294 elif c == '{':
295 group = True
295 group += 1
296 res += '(?:'
296 res += '(?:'
297 elif c == '}' and group:
297 elif c == '}' and group:
298 res += ')'
298 res += ')'
299 group = False
299 group -= 1
300 elif c == ',' and group:
300 elif c == ',' and group:
301 res += '|'
301 res += '|'
302 elif c == '\\':
302 elif c == '\\':
@@ -58,6 +58,7 b' debugwalk .hg'
58 debugwalk ../.hg
58 debugwalk ../.hg
59 chdir ..
59 chdir ..
60 debugwalk -Ibeans
60 debugwalk -Ibeans
61 debugwalk -I '{*,{b,m}*/*}k'
61 debugwalk 'glob:mammals/../beans/b*'
62 debugwalk 'glob:mammals/../beans/b*'
62 debugwalk '-X*/Procyonidae' mammals
63 debugwalk '-X*/Procyonidae' mammals
63 debugwalk path:mammals
64 debugwalk path:mammals
@@ -174,6 +174,11 b' f beans/navy beans/navy'
174 f beans/pinto beans/pinto
174 f beans/pinto beans/pinto
175 f beans/turtle beans/turtle
175 f beans/turtle beans/turtle
176
176
177 hg debugwalk -I {*,{b,m}*/*}k
178 f beans/black beans/black
179 f fenugreek fenugreek
180 f mammals/skunk mammals/skunk
181
177 hg debugwalk glob:mammals/../beans/b*
182 hg debugwalk glob:mammals/../beans/b*
178 f beans/black beans/black
183 f beans/black beans/black
179 f beans/borlotti beans/borlotti
184 f beans/borlotti beans/borlotti
General Comments 0
You need to be logged in to leave comments. Login now