##// END OF EJS Templates
if hgignore contains errors, print message that is not confusing.
Vadim Gelfer -
r1610:84e9b348 default
parent child Browse files
Show More
@@ -68,7 +68,8 b' class dirstate(object):'
68 try:
68 try:
69 syntax = syntaxes[s]
69 syntax = syntaxes[s]
70 except KeyError:
70 except KeyError:
71 self.ui.warn(_("ignoring invalid syntax '%s'\n") % s)
71 self.ui.warn(_(".hgignore: ignoring invalid "
72 "syntax '%s'\n") % s)
72 continue
73 continue
73 pat = syntax + line
74 pat = syntax + line
74 for s in syntaxes.values():
75 for s in syntaxes.values():
@@ -88,7 +89,8 b' class dirstate(object):'
88 ignore = self.hgignore()
89 ignore = self.hgignore()
89 if ignore:
90 if ignore:
90 files, self.ignorefunc, anypats = util.matcher(self.root,
91 files, self.ignorefunc, anypats = util.matcher(self.root,
91 inc=ignore)
92 inc=ignore,
93 src='.hgignore')
92 else:
94 else:
93 self.ignorefunc = util.never
95 self.ignorefunc = util.never
94 return self.ignorefunc(fn)
96 return self.ignorefunc(fn)
@@ -191,17 +191,17 b' def canonpath(root, cwd, myname):'
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:
@@ -262,7 +262,8 b' def _matcher(canonroot, cwd, names, inc,'
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:
General Comments 0
You need to be logged in to leave comments. Login now