Mercurial > hg-stable
changeset 8579:aff7f83c365b
match: optimize _patsplit
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 24 May 2009 02:56:14 -0500 |
parents | 8388ef8d21cd |
children | f648c096f6d0 |
files | mercurial/match.py |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/match.py Sun May 24 02:56:14 2009 -0500 +++ b/mercurial/match.py Sun May 24 02:56:14 2009 -0500 @@ -59,8 +59,10 @@ def _patsplit(pat, default): """Split a string into an optional pattern kind prefix and the actual pattern.""" - for prefix in 're', 'glob', 'path', 'relglob', 'relpath', 'relre': - if pat.startswith(prefix + ':'): return pat.split(':', 1) + if ':' in pat: + pat, val = pat.split(':', 1) + if pat in ('re', 'glob', 'path', 'relglob', 'relpath', 'relre'): + return pat, val return default, pat def _globre(pat, head, tail):