changeset 8582:a4c199e12b5a

match: remove head and tail args from _globre
author Matt Mackall <mpm@selenic.com>
date Sun, 24 May 2009 02:56:14 -0500
parents 101d305c1d0b
children 19d1b2aec562
files mercurial/match.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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"""