Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/util.py @ 897:fe30f5434b51
Fix bug with empty inc and exc
This fixes an exception that showed up when importing patches
author | mpm@selenic.com |
---|---|
date | Sun, 14 Aug 2005 12:23:36 -0800 |
parents | 01215ad04283 |
children | 302f83b85054 |
comparison
equal
deleted
inserted
replaced
896:01215ad04283 | 897:fe30f5434b51 |
---|---|
90 return pconvert(name[len(rootsep):]) | 90 return pconvert(name[len(rootsep):]) |
91 elif name == repo.root: | 91 elif name == repo.root: |
92 return '' | 92 return '' |
93 else: | 93 else: |
94 raise Abort('%s not under repository root' % myname) | 94 raise Abort('%s not under repository root' % myname) |
95 | 95 |
96 def matcher(repo, cwd, names, inc, exc, head = ''): | 96 def matcher(repo, cwd, names, inc, exc, head = ''): |
97 def patkind(name): | 97 def patkind(name): |
98 for prefix in 're:', 'glob:', 'path:', 'relpath:': | 98 for prefix in 're:', 'glob:', 'path:', 'relpath:': |
99 if name.startswith(prefix): return name.split(':', 1) | 99 if name.startswith(prefix): return name.split(':', 1) |
100 for c in name: | 100 for c in name: |
139 root = globprefix(name) | 139 root = globprefix(name) |
140 if root: roots.append(root) | 140 if root: roots.append(root) |
141 elif kind == 'relpath': | 141 elif kind == 'relpath': |
142 files.append((kind, name)) | 142 files.append((kind, name)) |
143 roots.append(name) | 143 roots.append(name) |
144 | 144 |
145 patmatch = matchfn(pats, '$') or always | 145 patmatch = matchfn(pats, '$') or always |
146 filematch = matchfn(files, '(?:/|$)') or always | 146 filematch = matchfn(files, '(?:/|$)') or always |
147 incmatch = matchfn(map(patkind, inc), '(?:/|$)') or always | 147 incmatch = always |
148 excmatch = matchfn(map(patkind, exc), '(?:/|$)') or (lambda fn: False) | 148 if inc: |
149 incmatch = matchfn(map(patkind, inc), '(?:/|$)') | |
150 excmatch = lambda fn: False | |
151 if exc: | |
152 excmatch = matchfn(map(patkind, exc), '(?:/|$)') | |
149 | 153 |
150 return roots, lambda fn: (incmatch(fn) and not excmatch(fn) and | 154 return roots, lambda fn: (incmatch(fn) and not excmatch(fn) and |
151 (fn.endswith('/') or | 155 (fn.endswith('/') or |
152 (not pats and not files) or | 156 (not pats and not files) or |
153 (pats and patmatch(fn)) or | 157 (pats and patmatch(fn)) or |