# HG changeset patch # User Vadim Gelfer # Date 1136245696 28800 # Node ID 84e9b3484ff6ea7d25cbaa1f26cc40afdbc258fd # Parent c50bddfbc812f541b17fae79cf6501e492efe5c3 if hgignore contains errors, print message that is not confusing. diff -r c50bddfbc812 -r 84e9b3484ff6 mercurial/dirstate.py --- 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) diff -r c50bddfbc812 -r 84e9b3484ff6 mercurial/util.py --- 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: