Mercurial > hg-stable
changeset 4197:492d0d5b6976
remove unused "head" hack from util._matcher
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Sat, 10 Mar 2007 23:00:59 -0300 |
parents | 1c69c73d85d9 |
children | 9e3121017fb2 |
files | mercurial/cmdutil.py mercurial/util.py |
diffstat | 2 files changed, 15 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Sat Mar 10 23:00:58 2007 -0300 +++ b/mercurial/cmdutil.py Sat Mar 10 23:00:59 2007 -0300 @@ -127,16 +127,16 @@ pathname), mode) -def matchpats(repo, pats=[], opts={}, head='', globbed=False, default=None): +def matchpats(repo, pats=[], opts={}, globbed=False, default=None): cwd = repo.getcwd() return util.cmdmatcher(repo.root, cwd, pats or [], opts.get('include'), - opts.get('exclude'), head, globbed=globbed, + opts.get('exclude'), globbed=globbed, default=default) -def walk(repo, pats=[], opts={}, node=None, head='', badmatch=None, - globbed=False, default=None): - files, matchfn, anypats = matchpats(repo, pats, opts, head, - globbed=globbed, default=default) +def walk(repo, pats=[], opts={}, node=None, badmatch=None, globbed=False, + default=None): + files, matchfn, anypats = matchpats(repo, pats, opts, globbed=globbed, + default=default) exact = dict.fromkeys(files) for src, fn in repo.walk(node=node, files=files, match=matchfn, badmatch=badmatch):
--- a/mercurial/util.py Sat Mar 10 23:00:58 2007 -0300 +++ b/mercurial/util.py Sat Mar 10 23:00:59 2007 -0300 @@ -378,17 +378,17 @@ raise Abort('%s not under root' % myname) -def matcher(canonroot, cwd='', names=[], inc=[], exc=[], head='', src=None): - return _matcher(canonroot, cwd, names, inc, exc, head, 'glob', src) +def matcher(canonroot, cwd='', names=[], inc=[], exc=[], src=None): + return _matcher(canonroot, cwd, names, inc, exc, 'glob', src) -def cmdmatcher(canonroot, cwd='', names=[], inc=[], exc=[], head='', - src=None, globbed=False, default=None): +def cmdmatcher(canonroot, cwd='', names=[], inc=[], exc=[], src=None, + globbed=False, default=None): default = default or 'relpath' if default == 'relpath' and not globbed: names = expand_glob(names) - return _matcher(canonroot, cwd, names, inc, exc, head, default, src) + return _matcher(canonroot, cwd, names, inc, exc, default, src) -def _matcher(canonroot, cwd, names, inc, exc, head, dflt_pat, src): +def _matcher(canonroot, cwd, names, inc, exc, dflt_pat, src): """build a function to match a set of file patterns arguments: @@ -397,7 +397,6 @@ names - patterns to find inc - patterns to include exc - patterns to exclude - head - a regex to prepend to patterns to control whether a match is rooted dflt_pat - if a pattern in names has no explicit type, assume this one src - where these patterns came from (e.g. .hgignore) @@ -417,9 +416,6 @@ includes the initial part of glob: patterns that has no glob characters - a bool match(filename) function - a bool indicating if any patterns were passed in - - todo: - make head regex a rooted bool """ def contains_glob(name): @@ -436,14 +432,14 @@ elif kind == 'path': return '^' + re.escape(name) + '(?:/|$)' elif kind == 'relglob': - return head + globre(name, '(?:|.*/)', '(?:/|$)') + return globre(name, '(?:|.*/)', '(?:/|$)') elif kind == 'relpath': - return head + re.escape(name) + '(?:/|$)' + return re.escape(name) + '(?:/|$)' elif kind == 'relre': if name.startswith('^'): return name return '.*' + name - return head + globre(name, '', tail) + return globre(name, '', tail) def matchfn(pats, tail): """build a matching function from a set of patterns"""