match: explode if unsupported pattern passed down to _regex() builder
authorYuya Nishihara <yuya@tcha.org>
Sun, 10 Jun 2018 15:47:58 +0900
changeset 38578 2d487b9cac07
parent 38577 76838305b9dd
child 38579 ec0cee4c1fff
match: explode if unsupported pattern passed down to _regex() builder
mercurial/match.py
--- a/mercurial/match.py	Sat Jun 09 21:13:24 2018 +0900
+++ b/mercurial/match.py	Sun Jun 10 15:47:58 2018 +0900
@@ -819,7 +819,9 @@
         if pat.startswith('^'):
             return pat
         return '.*' + pat
-    return _globre(pat) + globsuffix
+    if kind == 'glob':
+        return _globre(pat) + globsuffix
+    raise error.ProgrammingError('not a regex pattern: %s:%s' % (kind, pat))
 
 def _buildmatch(ctx, kindpats, globsuffix, listsubrepos, root):
     '''Return regexp string and a matcher function for kindpats.