changeset 23061:f2aeff8a87b6 stable

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.
author Matt Mackall <mpm@selenic.com>
date Wed, 22 Oct 2014 15:47:27 -0500
parents 4eaea93b3e5b
children ba89f7b542c9
files mercurial/revset.py
diffstat 1 files changed, 4 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- 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