##// END OF EJS Templates
On error parsing hgignore file, print the correct filename.
mcmillen@cs.cmu.edu -
r2005:bc47af2d default
parent child Browse files
Show More
@@ -65,9 +65,10 class dirstate(object):
65 repoignore = self.wjoin('.hgignore')
65 repoignore = self.wjoin('.hgignore')
66 files = [repoignore]
66 files = [repoignore]
67 files.extend(self.ui.hgignorefiles())
67 files.extend(self.ui.hgignorefiles())
68 pats = []
68 pats = {}
69 for f in files:
69 for f in files:
70 try:
70 try:
71 pats[f] = []
71 fp = open(f)
72 fp = open(f)
72 syntax = 'relre:'
73 syntax = 'relre:'
73 for line in parselines(fp):
74 for line in parselines(fp):
@@ -84,7 +85,7 class dirstate(object):
84 if line.startswith(s):
85 if line.startswith(s):
85 pat = line
86 pat = line
86 break
87 break
87 pats.append(pat)
88 pats[f].append(pat)
88 except IOError:
89 except IOError:
89 if f != repoignore:
90 if f != repoignore:
90 self.ui.warn(_("ignore file %s not found\n") % f)
91 self.ui.warn(_("ignore file %s not found\n") % f)
@@ -99,13 +100,16 class dirstate(object):
99 if not self.ignorefunc:
100 if not self.ignorefunc:
100 ignore = self.hgignore()
101 ignore = self.hgignore()
101 if ignore:
102 if ignore:
102 # FIXME: if there are errors in patterns, matcher will
103 try:
103 # print out an error containing src ('.hgignore');
104 allpats = []
104 # really, we want the original source file to be
105 [allpats.extend(patlist) for patlist in ignore.values()]
105 # printed instead.
106 files, self.ignorefunc, anypats = (
106 files, self.ignorefunc, anypats = util.matcher(self.root,
107 util.matcher(self.root, inc=allpats, src='.hgignore'))
107 inc=ignore,
108 except util.Abort:
108 src='.hgignore')
109 # Re-raise an exception where the src is the right file
110 for f, patlist in ignore.items():
111 files, self.ignorefunc, anypats = (
112 util.matcher(self.root, inc=patlist, src=f))
109 else:
113 else:
110 self.ignorefunc = util.never
114 self.ignorefunc = util.never
111 return self.ignorefunc(fn)
115 return self.ignorefunc(fn)
General Comments 0
You need to be logged in to leave comments. Login now