mercurial/match.py
changeset 40776 ce401300f981
parent 40775 4e02f25f31c6
child 40777 3c842749debc
--- a/mercurial/match.py	Thu Nov 22 17:16:05 2018 +0100
+++ b/mercurial/match.py	Thu Nov 22 17:25:49 2018 +0100
@@ -1186,6 +1186,10 @@
 
 MAX_RE_SIZE = 20000
 
+def _joinregexes(regexps):
+    """gather multiple regular expressions into a single one"""
+    return '(?:%s)' % '|'.join(regexps)
+
 def _buildregexmatch(kindpats, globsuffix):
     """Build a match function from a list of kinds and kindpats,
     return regexp string and a matcher function.
@@ -1199,7 +1203,7 @@
     OverflowError
     """
     try:
-        regex = '(?:%s)' % '|'.join([_regex(k, p, globsuffix)
+        regex = _joinregexes([_regex(k, p, globsuffix)
                                      for (k, p, s) in kindpats])
         if len(regex) <= MAX_RE_SIZE:
             return regex, _rematcher(regex)