mercurial/match.py
changeset 21112 03782d2fc776
parent 21111 9d28fd795215
child 21113 00cae8a2b04e
equal deleted inserted replaced
21111:9d28fd795215 21112:03782d2fc776
   226                     'listfile', 'listfile0', 'set'):
   226                     'listfile', 'listfile0', 'set'):
   227             return kind, pat
   227             return kind, pat
   228     return default, pattern
   228     return default, pattern
   229 
   229 
   230 def _globre(pat):
   230 def _globre(pat):
   231     '''Convert an extended glob string to a regexp string.'''
   231     r'''Convert an extended glob string to a regexp string.
       
   232 
       
   233     >>> print _globre(r'?')
       
   234     .
       
   235     >>> print _globre(r'*')
       
   236     [^/]*
       
   237     >>> print _globre(r'**')
       
   238     .*
       
   239     >>> print _globre(r'[a*?!^][^b][!c]')
       
   240     [a*?!^][\^b][^c]
       
   241     >>> print _globre(r'{a,b}')
       
   242     (?:a|b)
       
   243     >>> print _globre(r'.\*\?')
       
   244     \.\*\?
       
   245     '''
   232     i, n = 0, len(pat)
   246     i, n = 0, len(pat)
   233     res = ''
   247     res = ''
   234     group = 0
   248     group = 0
   235     escape = re.escape
   249     escape = re.escape
   236     def peek():
   250     def peek():