Mercurial > public > mercurial-scm > hg
diff hgext/remotenames.py @ 40069:fd4d59cf2ebb
remotenames: abort if literal revset pattern matches nothing
This is the convention of the other namespace revsets such as tag(). Let's
make the remote variants do the same.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 05 Oct 2018 21:43:57 +0900 |
parents | b313f2c3b8c6 |
children | 3018749a71bb |
line wrap: on
line diff
--- a/hgext/remotenames.py Fri Oct 05 21:39:41 2018 +0900 +++ b/hgext/remotenames.py Fri Oct 05 21:43:57 2018 +0900 @@ -33,6 +33,7 @@ ) from mercurial import ( bookmarks, + error, extensions, logexchange, namespaces, @@ -355,6 +356,7 @@ kind, pattern, matcher = stringutil.stringmatcher( revsetlang.getstring(args[0], _('argument must be a string'))) else: + kind = pattern = None matcher = util.always nodes = set() @@ -366,6 +368,9 @@ if not matcher(name): continue nodes.update(ns.nodes(repo, name)) + if kind == 'literal' and not nodes: + raise error.RepoLookupError(_("remote name '%s' does not exist") + % pattern) revs = (cl.rev(n) for n in nodes if cl.hasnode(n)) return subset & smartset.baseset(revs)