mercurial/match.py
changeset 33358 38b6122df5c7
parent 33357 a21819f439fe
child 33378 adf95bfb423a
equal deleted inserted replaced
33357:a21819f439fe 33358:38b6122df5c7
   792     globsuffix is appended to the regexp of globs.'''
   792     globsuffix is appended to the regexp of globs.'''
   793     if not pat:
   793     if not pat:
   794         return ''
   794         return ''
   795     if kind == 're':
   795     if kind == 're':
   796         return pat
   796         return pat
   797     if kind == 'path':
   797     if kind in ('path', 'relpath'):
   798         if pat == '.':
   798         if pat == '.':
   799             return ''
   799             return ''
   800         return util.re.escape(pat) + '(?:/|$)'
   800         return util.re.escape(pat) + '(?:/|$)'
   801     if kind == 'rootfilesin':
   801     if kind == 'rootfilesin':
   802         if pat == '.':
   802         if pat == '.':
   806             escaped = util.re.escape(pat) + '/'
   806             escaped = util.re.escape(pat) + '/'
   807         # Anything after the pattern must be a non-directory.
   807         # Anything after the pattern must be a non-directory.
   808         return escaped + '[^/]+$'
   808         return escaped + '[^/]+$'
   809     if kind == 'relglob':
   809     if kind == 'relglob':
   810         return '(?:|.*/)' + _globre(pat) + globsuffix
   810         return '(?:|.*/)' + _globre(pat) + globsuffix
   811     if kind == 'relpath':
       
   812         return util.re.escape(pat) + '(?:/|$)'
       
   813     if kind == 'relre':
   811     if kind == 'relre':
   814         if pat.startswith('^'):
   812         if pat.startswith('^'):
   815             return pat
   813             return pat
   816         return '.*' + pat
   814         return '.*' + pat
   817     return _globre(pat) + globsuffix
   815     return _globre(pat) + globsuffix