match: remove head and tail args from _globre
authorMatt Mackall <mpm@selenic.com>
Sun, 24 May 2009 02:56:14 -0500
changeset 8582 a4c199e12b5a
parent 8581 101d305c1d0b
child 8583 19d1b2aec562
match: remove head and tail args from _globre
mercurial/match.py
--- a/mercurial/match.py	Sun May 24 02:56:14 2009 -0500
+++ b/mercurial/match.py	Sun May 24 02:56:14 2009 -0500
@@ -120,7 +120,7 @@
             return pat, val
     return default, pat
 
-def _globre(pat, head, tail):
+def _globre(pat):
     "convert a glob pattern into a regexp"
     i, n = 0, len(pat)
     res = ''
@@ -170,7 +170,7 @@
                 res += re.escape(c)
         else:
             res += re.escape(c)
-    return head + res + tail
+    return res
 
 def _regex(kind, name, tail):
     '''convert a pattern into a regular expression'''
@@ -181,14 +181,14 @@
     elif kind == 'path':
         return '^' + re.escape(name) + '(?:/|$)'
     elif kind == 'relglob':
-        return _globre(name, '(?:|.*/)', tail)
+        return '(?:|.*/)' + _globre(name) + tail
     elif kind == 'relpath':
         return re.escape(name) + '(?:/|$)'
     elif kind == 'relre':
         if name.startswith('^'):
             return name
         return '.*' + name
-    return _globre(name, '', tail)
+    return _globre(name) + tail
 
 def _buildmatch(pats, tail):
     """build a matching function from a set of patterns"""