Mercurial > hg-stable
changeset 33358:38b6122df5c7
match: combine regex code for path: and relpath:
The regexes for path: and relpath: patterns are the same (since the
paths have already been normalized at the point we create the
regexes).
I don't think the "if pat == '.'" will have any effect relpath:
because relpath: patterns will have the root directory already
normalized to '' by pathutil.canonpath() (unlike path:, for which the
root gets normalized to '.' by util.normpath()).
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Sun, 09 Jul 2017 23:01:11 -0700 |
parents | a21819f439fe |
children | 583aa1e3658b |
files | mercurial/match.py |
diffstat | 1 files changed, 1 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/match.py Sun Jul 09 22:53:02 2017 -0700 +++ b/mercurial/match.py Sun Jul 09 23:01:11 2017 -0700 @@ -794,7 +794,7 @@ return '' if kind == 're': return pat - if kind == 'path': + if kind in ('path', 'relpath'): if pat == '.': return '' return util.re.escape(pat) + '(?:/|$)' @@ -808,8 +808,6 @@ return escaped + '[^/]+$' if kind == 'relglob': return '(?:|.*/)' + _globre(pat) + globsuffix - if kind == 'relpath': - return util.re.escape(pat) + '(?:/|$)' if kind == 'relre': if pat.startswith('^'): return pat