# HG changeset patch # User Matt Mackall # Date 1243151774 18000 # Node ID aff7f83c365b41b24fd6dc6b420cb2936dce812d # Parent 8388ef8d21cdc8445718927c52db0c6a0065cc31 match: optimize _patsplit diff -r 8388ef8d21cd -r aff7f83c365b mercurial/match.py --- 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):