diff mercurial/revset.py @ 26537:832feae7c986

revset: do not fall through to revspec for literal: branch (issue4838) If "literal:" is specified, it must not be a revset expression. It should error out with a better message.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 07 Oct 2015 23:00:29 +0900
parents 7d132557e44a
children 5c9ec1cc671a
line wrap: on
line diff
--- a/mercurial/revset.py	Wed Oct 07 21:08:14 2015 +0100
+++ b/mercurial/revset.py	Wed Oct 07 23:00:29 2015 +0900
@@ -734,9 +734,12 @@
         kind, pattern, matcher = util.stringmatcher(b)
         if kind == 'literal':
             # note: falls through to the revspec case if no branch with
-            # this name exists
+            # this name exists and pattern kind is not specified explicitly
             if pattern in repo.branchmap():
                 return subset.filter(lambda r: matcher(getbi(r)[0]))
+            if b.startswith('literal:'):
+                raise error.RepoLookupError(_("branch '%s' does not exist")
+                                            % pattern)
         else:
             return subset.filter(lambda r: matcher(getbi(r)[0]))