Show More
@@ -52,6 +52,24 b' def ignorepats(lines):' | |||||
52 |
|
52 | |||
53 | return patterns, warnings |
|
53 | return patterns, warnings | |
54 |
|
54 | |||
|
55 | def readpats(root, files, warn): | |||
|
56 | '''return a dict mapping ignore-file-name to list-of-patterns''' | |||
|
57 | ||||
|
58 | pats = {} | |||
|
59 | for f in files: | |||
|
60 | try: | |||
|
61 | pats[f] = [] | |||
|
62 | fp = open(f) | |||
|
63 | pats[f], warnings = ignorepats(fp) | |||
|
64 | fp.close() | |||
|
65 | for warning in warnings: | |||
|
66 | warn("%s: %s\n" % (f, warning)) | |||
|
67 | except IOError, inst: | |||
|
68 | if f != files[0]: | |||
|
69 | warn(_("skipping unreadable ignore file '%s': %s\n") % | |||
|
70 | (f, inst.strerror)) | |||
|
71 | return pats | |||
|
72 | ||||
55 | def ignore(root, files, warn): |
|
73 | def ignore(root, files, warn): | |
56 | '''return matcher covering patterns in 'files'. |
|
74 | '''return matcher covering patterns in 'files'. | |
57 |
|
75 | |||
@@ -72,19 +90,7 b' def ignore(root, files, warn):' | |||||
72 | glob:pattern # non-rooted glob |
|
90 | glob:pattern # non-rooted glob | |
73 | pattern # pattern of the current default type''' |
|
91 | pattern # pattern of the current default type''' | |
74 |
|
92 | |||
75 | pats = {} |
|
93 | pats = readpats(root, files, warn) | |
76 | for f in files: |
|
|||
77 | try: |
|
|||
78 | pats[f] = [] |
|
|||
79 | fp = open(f) |
|
|||
80 | pats[f], warnings = ignorepats(fp) |
|
|||
81 | fp.close() |
|
|||
82 | for warning in warnings: |
|
|||
83 | warn("%s: %s\n" % (f, warning)) |
|
|||
84 | except IOError, inst: |
|
|||
85 | if f != files[0]: |
|
|||
86 | warn(_("skipping unreadable ignore file '%s': %s\n") % |
|
|||
87 | (f, inst.strerror)) |
|
|||
88 |
|
94 | |||
89 | allpats = [] |
|
95 | allpats = [] | |
90 | for patlist in pats.values(): |
|
96 | for patlist in pats.values(): |
General Comments 0
You need to be logged in to leave comments.
Login now