Mercurial > hg-stable
changeset 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 |
files | mercurial/dirstate.py mercurial/util.py |
diffstat | 2 files changed, 11 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dirstate.py Mon Jan 02 15:25:33 2006 -0800 +++ b/mercurial/dirstate.py Mon Jan 02 15:48:16 2006 -0800 @@ -68,7 +68,8 @@ try: syntax = syntaxes[s] except KeyError: - self.ui.warn(_("ignoring invalid syntax '%s'\n") % s) + self.ui.warn(_(".hgignore: ignoring invalid " + "syntax '%s'\n") % s) continue pat = syntax + line for s in syntaxes.values(): @@ -88,7 +89,8 @@ ignore = self.hgignore() if ignore: files, self.ignorefunc, anypats = util.matcher(self.root, - inc=ignore) + inc=ignore, + src='.hgignore') else: self.ignorefunc = util.never return self.ignorefunc(fn)
--- a/mercurial/util.py Mon Jan 02 15:25:33 2006 -0800 +++ b/mercurial/util.py Mon Jan 02 15:48:16 2006 -0800 @@ -191,17 +191,17 @@ else: raise Abort('%s not under root' % myname) -def matcher(canonroot, cwd='', names=['.'], inc=[], exc=[], head=''): - return _matcher(canonroot, cwd, names, inc, exc, head, 'glob') +def matcher(canonroot, cwd='', names=['.'], inc=[], exc=[], head='', src=None): + return _matcher(canonroot, cwd, names, inc, exc, head, 'glob', src) -def cmdmatcher(canonroot, cwd='', names=['.'], inc=[], exc=[], head=''): +def cmdmatcher(canonroot, cwd='', names=['.'], inc=[], exc=[], head='', src=None): if os.name == 'nt': dflt_pat = 'glob' else: dflt_pat = 'relpath' - return _matcher(canonroot, cwd, names, inc, exc, head, dflt_pat) + return _matcher(canonroot, cwd, names, inc, exc, head, dflt_pat, src) -def _matcher(canonroot, cwd, names, inc, exc, head, dflt_pat): +def _matcher(canonroot, cwd, names, inc, exc, head, dflt_pat, src): """build a function to match a set of file patterns arguments: @@ -262,7 +262,8 @@ pat = '(?:%s)' % regex(k, p, tail) matches.append(re.compile(pat).match) except re.error: - raise Abort("invalid pattern: %s:%s" % (k, p)) + if src: raise Abort("%s: invalid pattern: %s:%s" % (src, k, p)) + else: raise Abort("invalid pattern: %s:%s" % (k, p)) def buildfn(text): for m in matches: