Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/util.py @ 1610:84e9b3484ff6
if hgignore contains errors, print message that is not confusing.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Mon, 02 Jan 2006 15:48:16 -0800 |
parents | c50bddfbc812 |
children | 301d5cd4abc6 |
comparison
equal
deleted
inserted
replaced
1609:c50bddfbc812 | 1610:84e9b3484ff6 |
---|---|
189 elif name == root: | 189 elif name == root: |
190 return '' | 190 return '' |
191 else: | 191 else: |
192 raise Abort('%s not under root' % myname) | 192 raise Abort('%s not under root' % myname) |
193 | 193 |
194 def matcher(canonroot, cwd='', names=['.'], inc=[], exc=[], head=''): | 194 def matcher(canonroot, cwd='', names=['.'], inc=[], exc=[], head='', src=None): |
195 return _matcher(canonroot, cwd, names, inc, exc, head, 'glob') | 195 return _matcher(canonroot, cwd, names, inc, exc, head, 'glob', src) |
196 | 196 |
197 def cmdmatcher(canonroot, cwd='', names=['.'], inc=[], exc=[], head=''): | 197 def cmdmatcher(canonroot, cwd='', names=['.'], inc=[], exc=[], head='', src=None): |
198 if os.name == 'nt': | 198 if os.name == 'nt': |
199 dflt_pat = 'glob' | 199 dflt_pat = 'glob' |
200 else: | 200 else: |
201 dflt_pat = 'relpath' | 201 dflt_pat = 'relpath' |
202 return _matcher(canonroot, cwd, names, inc, exc, head, dflt_pat) | 202 return _matcher(canonroot, cwd, names, inc, exc, head, dflt_pat, src) |
203 | 203 |
204 def _matcher(canonroot, cwd, names, inc, exc, head, dflt_pat): | 204 def _matcher(canonroot, cwd, names, inc, exc, head, dflt_pat, src): |
205 """build a function to match a set of file patterns | 205 """build a function to match a set of file patterns |
206 | 206 |
207 arguments: | 207 arguments: |
208 canonroot - the canonical root of the tree you're matching against | 208 canonroot - the canonical root of the tree you're matching against |
209 cwd - the current working directory, if relevant | 209 cwd - the current working directory, if relevant |
260 for k, p in pats: | 260 for k, p in pats: |
261 try: | 261 try: |
262 pat = '(?:%s)' % regex(k, p, tail) | 262 pat = '(?:%s)' % regex(k, p, tail) |
263 matches.append(re.compile(pat).match) | 263 matches.append(re.compile(pat).match) |
264 except re.error: | 264 except re.error: |
265 raise Abort("invalid pattern: %s:%s" % (k, p)) | 265 if src: raise Abort("%s: invalid pattern: %s:%s" % (src, k, p)) |
266 else: raise Abort("invalid pattern: %s:%s" % (k, p)) | |
266 | 267 |
267 def buildfn(text): | 268 def buildfn(text): |
268 for m in matches: | 269 for m in matches: |
269 r = m(text) | 270 r = m(text) |
270 if r: | 271 if r: |