changeset 24114:fafd9a1284cf

revset: make match function initiate query from full set by default This change is intended to avoid exposing the implementation detail to callers. I'm going to extend fullreposet to support "null" revision, so these mfunc calls will have to use fullreposet() instead of spanset().
author Yuya Nishihara <yuya@tcha.org>
date Mon, 02 Feb 2015 22:21:07 +0900
parents b08af8f0ac01
children ff24af40728b
files mercurial/commands.py mercurial/hgweb/webcommands.py mercurial/localrepo.py mercurial/revset.py mercurial/scmutil.py mercurial/templater.py
diffstat 6 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Wed Oct 01 20:26:33 2014 -0400
+++ b/mercurial/commands.py	Mon Feb 02 22:21:07 2015 +0900
@@ -2885,7 +2885,7 @@
             weight, optimizedtree = revset.optimize(newtree, True)
             ui.note("* optimized:\n", revset.prettyformat(optimizedtree), "\n")
     func = revset.match(ui, expr)
-    for c in func(repo, revset.spanset(repo)):
+    for c in func(repo):
         ui.write("%s\n" % c)
 
 @command('debugsetparents', [], _('REV1 [REV2]'))
--- a/mercurial/hgweb/webcommands.py	Wed Oct 01 20:26:33 2014 -0400
+++ b/mercurial/hgweb/webcommands.py	Mon Feb 02 22:21:07 2015 +0900
@@ -237,7 +237,7 @@
 
         mfunc = revset.match(web.repo.ui, revdef)
         try:
-            revs = mfunc(web.repo, revset.spanset(web.repo))
+            revs = mfunc(web.repo)
             return MODE_REVSET, revs
             # ParseError: wrongly placed tokens, wrongs arguments, etc
             # RepoLookupError: no such revision, e.g. in 'revision:'
--- a/mercurial/localrepo.py	Wed Oct 01 20:26:33 2014 -0400
+++ b/mercurial/localrepo.py	Mon Feb 02 22:21:07 2015 +0900
@@ -482,7 +482,7 @@
         '''Return a list of revisions matching the given revset'''
         expr = revset.formatspec(expr, *args)
         m = revset.match(None, expr)
-        return m(self, revset.spanset(self))
+        return m(self)
 
     def set(self, expr, *args):
         '''
--- a/mercurial/revset.py	Wed Oct 01 20:26:33 2014 -0400
+++ b/mercurial/revset.py	Mon Feb 02 22:21:07 2015 +0900
@@ -2448,7 +2448,9 @@
         tree = findaliases(ui, tree, showwarning=ui.warn)
     tree = foldconcat(tree)
     weight, tree = optimize(tree, True)
-    def mfunc(repo, subset):
+    def mfunc(repo, subset=None):
+        if subset is None:
+            subset = spanset(repo)
         if util.safehasattr(subset, 'isascending'):
             result = getset(repo, subset, tree)
         else:
--- a/mercurial/scmutil.py	Wed Oct 01 20:26:33 2014 -0400
+++ b/mercurial/scmutil.py	Mon Feb 02 22:21:07 2015 +0900
@@ -672,11 +672,11 @@
         # fall through to new-style queries if old-style fails
         m = revset.match(repo.ui, spec, repo)
         if seen or l:
-            dl = [r for r in m(repo, revset.spanset(repo)) if r not in seen]
+            dl = [r for r in m(repo) if r not in seen]
             l = l + revset.baseset(dl)
             seen.update(dl)
         else:
-            l = m(repo, revset.spanset(repo))
+            l = m(repo)
 
     return l
 
--- a/mercurial/templater.py	Wed Oct 01 20:26:33 2014 -0400
+++ b/mercurial/templater.py	Mon Feb 02 22:21:07 2015 +0900
@@ -393,7 +393,7 @@
 
     def query(expr):
         m = revsetmod.match(repo.ui, expr)
-        return m(repo, revsetmod.spanset(repo))
+        return m(repo)
 
     if len(args) > 1:
         formatargs = list([a[0](context, mapping, a[1]) for a in args[1:]])