# HG changeset patch # User Matt Mackall # Date 1414010847 18000 # Node ID f2aeff8a87b66657605b8abcdb92675516c95b10 # Parent 4eaea93b3e5bb4ea76b19266de7661227572f870 revset: avoid recalculating filesets This fixes a regression in 8dabcc889e33 that moved matcher building into a callback, thus causing it be rebuilt for each revision matched against. diff -r 4eaea93b3e5b -r f2aeff8a87b6 mercurial/revset.py --- a/mercurial/revset.py Mon Oct 20 22:08:08 2014 +0900 +++ b/mercurial/revset.py Wed Oct 22 15:47:27 2014 -0500 @@ -899,7 +899,6 @@ # i18n: "_matchfiles" is a keyword l = getargs(x, 1, -1, _("_matchfiles requires at least one argument")) pats, inc, exc = [], [], [] - hasset = False rev, default = None, None for arg in l: # i18n: "_matchfiles" is a keyword @@ -926,21 +925,14 @@ else: # i18n: "_matchfiles" is a keyword raise error.ParseError(_('invalid _matchfiles prefix: %s') % prefix) - if not hasset and matchmod.patkind(value) == 'set': - hasset = True if not default: default = 'glob' + m = matchmod.match(repo.root, repo.getcwd(), pats, include=inc, + exclude=exc, ctx=repo[rev], default=default) + def matches(x): - m = None - c = repo[x] - if not m or (hasset and rev is None): - ctx = c - if rev is not None: - ctx = repo[rev or None] - m = matchmod.match(repo.root, repo.getcwd(), pats, include=inc, - exclude=exc, ctx=ctx, default=default) - for f in c.files(): + for f in repo[x].files(): if m(f): return True return False