Show More
@@ -427,7 +427,7 b' def _matcher(canonroot, cwd, names, inc,' | |||||
427 | if c in _globchars: return True |
|
427 | if c in _globchars: return True | |
428 | return False |
|
428 | return False | |
429 |
|
429 | |||
430 | def regex(kind, name): |
|
430 | def regex(kind, name, tail): | |
431 | '''convert a pattern into a regular expression''' |
|
431 | '''convert a pattern into a regular expression''' | |
432 | if not name: |
|
432 | if not name: | |
433 | return '' |
|
433 | return '' | |
@@ -443,16 +443,16 b' def _matcher(canonroot, cwd, names, inc,' | |||||
443 | if name.startswith('^'): |
|
443 | if name.startswith('^'): | |
444 | return name |
|
444 | return name | |
445 | return '.*' + name |
|
445 | return '.*' + name | |
446 |
return globre(name, '', |
|
446 | return globre(name, '', tail) | |
447 |
|
447 | |||
448 | def matchfn(pats): |
|
448 | def matchfn(pats, tail): | |
449 | """build a matching function from a set of patterns""" |
|
449 | """build a matching function from a set of patterns""" | |
450 | if not pats: |
|
450 | if not pats: | |
451 | return |
|
451 | return | |
452 | matches = [] |
|
452 | matches = [] | |
453 | for k, p in pats: |
|
453 | for k, p in pats: | |
454 | try: |
|
454 | try: | |
455 | pat = '(?:%s)' % regex(k, p) |
|
455 | pat = '(?:%s)' % regex(k, p, tail) | |
456 | matches.append(re.compile(pat).match) |
|
456 | matches.append(re.compile(pat).match) | |
457 | except re.error: |
|
457 | except re.error: | |
458 | if src: raise Abort("%s: invalid pattern (%s): %s" % (src, k, p)) |
|
458 | if src: raise Abort("%s: invalid pattern (%s): %s" % (src, k, p)) | |
@@ -500,15 +500,15 b' def _matcher(canonroot, cwd, names, inc,' | |||||
500 |
|
500 | |||
501 | roots, pats, anypats = normalizepats(names, dflt_pat) |
|
501 | roots, pats, anypats = normalizepats(names, dflt_pat) | |
502 |
|
502 | |||
503 | patmatch = matchfn(pats) or always |
|
503 | patmatch = matchfn(pats, '$') or always | |
504 | incmatch = always |
|
504 | incmatch = always | |
505 | if inc: |
|
505 | if inc: | |
506 | dummy, inckinds, dummy = normalizepats(inc, 'glob') |
|
506 | dummy, inckinds, dummy = normalizepats(inc, 'glob') | |
507 | incmatch = matchfn(inckinds) |
|
507 | incmatch = matchfn(inckinds, '(?:/|$)') | |
508 | excmatch = lambda fn: False |
|
508 | excmatch = lambda fn: False | |
509 | if exc: |
|
509 | if exc: | |
510 | dummy, exckinds, dummy = normalizepats(exc, 'glob') |
|
510 | dummy, exckinds, dummy = normalizepats(exc, 'glob') | |
511 | excmatch = matchfn(exckinds) |
|
511 | excmatch = matchfn(exckinds, '(?:/|$)') | |
512 |
|
512 | |||
513 | if not names and inc and not exc: |
|
513 | if not names and inc and not exc: | |
514 | # common case: hgignore patterns |
|
514 | # common case: hgignore patterns |
@@ -72,6 +72,7 b' debugwalk beans/.hg' | |||||
72 | #debugwalk `pwd`/beans |
|
72 | #debugwalk `pwd`/beans | |
73 | #debugwalk `pwd`/.. |
|
73 | #debugwalk `pwd`/.. | |
74 | debugwalk glob:\* |
|
74 | debugwalk glob:\* | |
|
75 | debugwalk 'glob:**e' | |||
75 | debugwalk 're:.*[kb]$' |
|
76 | debugwalk 're:.*[kb]$' | |
76 | debugwalk path:beans/black |
|
77 | debugwalk path:beans/black | |
77 | debugwalk path:beans//black |
|
78 | debugwalk path:beans//black |
@@ -210,20 +210,14 b' hg debugwalk beans/.hg' | |||||
210 | beans/.hg: No such file or directory |
|
210 | beans/.hg: No such file or directory | |
211 |
|
211 | |||
212 | hg debugwalk glob:* |
|
212 | hg debugwalk glob:* | |
213 | f beans/black beans/black |
|
213 | f fennel fennel | |
214 | f beans/borlotti beans/borlotti |
|
214 | f fenugreek fenugreek | |
215 | f beans/kidney beans/kidney |
|
215 | f fiddlehead fiddlehead | |
216 | f beans/navy beans/navy |
|
216 | f glob:glob glob:glob | |
217 | f beans/pinto beans/pinto |
|
217 | ||
|
218 | hg debugwalk glob:**e | |||
218 | f beans/turtle beans/turtle |
|
219 | f beans/turtle beans/turtle | |
219 | f fennel fennel |
|
|||
220 | f fenugreek fenugreek |
|
|||
221 | f fiddlehead fiddlehead |
|
|||
222 | f glob:glob glob:glob |
|
|||
223 | f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle |
|
220 | f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle | |
224 | f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi |
|
|||
225 | f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon |
|
|||
226 | f mammals/skunk mammals/skunk |
|
|||
227 |
|
221 | |||
228 | hg debugwalk re:.*[kb]$ |
|
222 | hg debugwalk re:.*[kb]$ | |
229 | f beans/black beans/black |
|
223 | f beans/black beans/black |
General Comments 0
You need to be logged in to leave comments.
Login now