changeset 38578:2d487b9cac07

match: explode if unsupported pattern passed down to _regex() builder
author Yuya Nishihara <yuya@tcha.org>
date Sun, 10 Jun 2018 15:47:58 +0900
parents 76838305b9dd
children ec0cee4c1fff
files mercurial/match.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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.