diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -804,11 +804,19 @@ definitions overriding user aliases, set ``localalias`` to ``{name: definitionstring}``. ''' + + if not specs: + return revset.emptymatcher(self) + if not all(specs): + raise error.ParseError(_("empty query")) + if user: - m = revset.matchany(self.ui, specs, repo=self, + tree = revset.buildtree(specs, self) + m = revset.matchany(self.ui, tree, repo=self, localalias=localalias) else: - m = revset.matchany(None, specs, localalias=localalias) + tree = revset.buildtree(specs) + m = revset.matchany(None, tree, localalias=localalias) return m(self) def url(self): diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -2163,26 +2163,25 @@ def match(ui, spec, repo=None): """Create a matcher for a single revision spec""" - return matchany(ui, [spec], repo=repo) + + if not specs: + return emptymatcher + if not all(specs): + raise error.ParseError(_("empty query")) + + tree = buildtree([spec], repo) + return matchany(ui, tree, repo=repo) def emptymatcher(repo, subset=None): """ Matcher for empty specs """ return baseset() -def matchany(ui, specs, repo=None, localalias=None): - """Create a matcher that will include any revisions matching one of the - given specs +def matchany(ui, tree, repo=None, localalias=None): + """Create a matcher for the tree If localalias is not None, it is a dict {name: definitionstring}. It takes precedence over [revsetalias] config section. """ - if not specs: - return emptymatcher - if not all(specs): - raise error.ParseError(_("empty query")) - - tree = buildtree(specs, repo) - aliases = [] warn = None if ui: