# HG changeset patch # User Matt Mackall # Date 1243151774 18000 # Node ID c7bab7fede4c3ad757f4a81a7a5ae7f934dad1e6 # Parent ec4ed21db4b2dd7995d0ddd8a3b950d0887872aa match: simplify _matcher - get rid of special case - simplify anypats logic - fold inckinds and exckinds diff -r ec4ed21db4b2 -r c7bab7fede4c 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 @@ -222,22 +222,18 @@ - a bool indicating if any patterns were passed in """ - # a common case: no patterns at all - if not names and not inc and not exc: - return [], lambda f: True, False - - pats = _normalizepats(names, dflt_pat, root, cwd) - roots = _roots(pats) - anypats = _anypats(pats) + roots = [] + anypats = bool(inc or exc) if names: + pats = _normalizepats(names, dflt_pat, root, cwd) + roots = _roots(pats) + anypats = anypats or _anypats(pats) patmatch = _matchfn(pats, '$') if inc: - inckinds = _normalizepats(inc, 'glob', root, cwd) - incmatch = _matchfn(inckinds, '(?:/|$)') + incmatch = _matchfn(_normalizepats(inc, 'glob', root, cwd), '(?:/|$)') if exc: - exckinds = _normalizepats(exc, 'glob', root, cwd) - excmatch = _matchfn(exckinds, '(?:/|$)') + excmatch = _matchfn(_normalizepats(exc, 'glob', root, cwd), '(?:/|$)') if names: if inc: @@ -262,4 +258,4 @@ else: m = lambda f: True - return (roots, m, (inc or exc or anypats) and True) + return (roots, m, anypats)