# HG changeset patch # User Yuya Nishihara # Date 2015-02-02 13:21:07 # Node ID fafd9a1284cf83bd398cf754a2f09ab30e029c0e # Parent b08af8f0ac016968f5ea3479dd73ad49c628884b 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(). diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2885,7 +2885,7 @@ def debugrevspec(ui, repo, expr, **opts) 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]')) diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py +++ b/mercurial/hgweb/webcommands.py @@ -237,7 +237,7 @@ def _search(web, req, tmpl): 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:' diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -482,7 +482,7 @@ class localrepository(object): '''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): ''' diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -2448,7 +2448,9 @@ def match(ui, spec, repo=None): 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: diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -672,11 +672,11 @@ def revrange(repo, revs): # 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 diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -393,7 +393,7 @@ def revset(context, mapping, args): 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:]])