Mercurial > hg-stable
changeset 8569:4fadac101818
util: privatize globre
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 24 May 2009 02:56:14 -0500 |
parents | 4fa1618bf495 |
children | 7fe2012b3bd0 |
files | mercurial/util.py |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/util.py Sun May 24 02:56:14 2009 -0500 +++ b/mercurial/util.py Sun May 24 02:56:14 2009 -0500 @@ -214,7 +214,7 @@ if pat.startswith(prefix + ':'): return pat.split(':', 1) return default, pat -def globre(pat, head='^', tail='$'): +def _globre(pat, head='^', tail='$'): "convert a glob pattern into a regexp" i, n = 0, len(pat) res = '' @@ -389,14 +389,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 matchfn(pats, tail): """build a matching function from a set of patterns"""