diff -r 5e9816decbb7 -r fc3b41570082 mercurial/util.py --- a/mercurial/util.py Sat Sep 17 00:23:58 2005 -0700 +++ b/mercurial/util.py Sat Sep 17 00:27:27 2005 -0700 @@ -122,7 +122,7 @@ else: raise Abort('%s not under root' % myname) -def matcher(canonroot, cwd, names, inc, exc, head=''): +def matcher(canonroot, cwd='', names=['.'], inc=[], exc=[], head=''): """build a function to match a set of file patterns arguments: @@ -134,11 +134,13 @@ head - a regex to prepend to patterns to control whether a match is rooted a pattern is one of: - 're:' - 'glob:' - 'path:' + 'glob:' + 're:' + 'path:' + 'relglob:' 'relpath:' - '' + 'relre:' + '' returns: a 3-tuple containing @@ -151,8 +153,8 @@ """ def patkind(name): - for prefix in 're:', 'glob:', 'path:', 'relpath:': - if name.startswith(prefix): return name.split(':', 1) + for prefix in 're', 'glob', 'path', 'relglob', 'relpath', 'relre': + if name.startswith(prefix + ':'): return name.split(':', 1) for c in name: if c in _globchars: return 'glob', name return 'relpath', name @@ -163,8 +165,14 @@ return name elif kind == 'path': return '^' + re.escape(name) + '(?:/|$)' + elif kind == 'relglob': + return head + globre(name, '(?:|.*/)', tail) elif kind == 'relpath': return head + re.escape(name) + tail + elif kind == 'relre': + if name.startswith('^'): + return name + return '.*' + name return head + globre(name, '', tail) def matchfn(pats, tail):