# HG changeset patch # User mpm@selenic.com # Date 1124051016 28800 # Node ID fe30f5434b5152e14638c1039d8c8b48113d2ecf # Parent 01215ad0428341bf0b5806b199c54fe158d9affd Fix bug with empty inc and exc This fixes an exception that showed up when importing patches diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -92,7 +92,7 @@ def canonpath(repo, cwd, myname): return '' else: raise Abort('%s not under repository root' % myname) - + def matcher(repo, cwd, names, inc, exc, head = ''): def patkind(name): for prefix in 're:', 'glob:', 'path:', 'relpath:': @@ -141,11 +141,15 @@ def matcher(repo, cwd, names, inc, exc, elif kind == 'relpath': files.append((kind, name)) roots.append(name) - + patmatch = matchfn(pats, '$') or always filematch = matchfn(files, '(?:/|$)') or always - incmatch = matchfn(map(patkind, inc), '(?:/|$)') or always - excmatch = matchfn(map(patkind, exc), '(?:/|$)') or (lambda fn: False) + incmatch = always + if inc: + incmatch = matchfn(map(patkind, inc), '(?:/|$)') + excmatch = lambda fn: False + if exc: + excmatch = matchfn(map(patkind, exc), '(?:/|$)') return roots, lambda fn: (incmatch(fn) and not excmatch(fn) and (fn.endswith('/') or