Show More
@@ -52,6 +52,20 b' def ignorepats(lines):' | |||
|
52 | 52 | |
|
53 | 53 | return patterns, warnings |
|
54 | 54 | |
|
55 | def readignorefile(filepath, warn, skipwarning=False): | |
|
56 | try: | |
|
57 | pats = [] | |
|
58 | fp = open(filepath) | |
|
59 | pats, warnings = ignorepats(fp) | |
|
60 | fp.close() | |
|
61 | for warning in warnings: | |
|
62 | warn("%s: %s\n" % (filepath, warning)) | |
|
63 | except IOError, inst: | |
|
64 | if not skipwarning: | |
|
65 | warn(_("skipping unreadable ignore file '%s': %s\n") % | |
|
66 | (filepath, inst.strerror)) | |
|
67 | return pats | |
|
68 | ||
|
55 | 69 | def readpats(root, files, warn): |
|
56 | 70 | '''return a dict mapping ignore-file-name to list-of-patterns''' |
|
57 | 71 | |
@@ -59,17 +73,9 b' def readpats(root, files, warn):' | |||
|
59 | 73 | for f in files: |
|
60 | 74 | if f in pats: |
|
61 | 75 | continue |
|
62 | try: | |
|
63 | pats[f] = [] | |
|
64 | fp = open(f) | |
|
65 | pats[f], warnings = ignorepats(fp) | |
|
66 | fp.close() | |
|
67 | for warning in warnings: | |
|
68 | warn("%s: %s\n" % (f, warning)) | |
|
69 | except IOError, inst: | |
|
70 | if f != files[0]: | |
|
71 | warn(_("skipping unreadable ignore file '%s': %s\n") % | |
|
72 | (f, inst.strerror)) | |
|
76 | skipwarning = f == files[0] | |
|
77 | pats[f] = readignorefile(f, warn, skipwarning=skipwarning) | |
|
78 | ||
|
73 | 79 | return [(f, pats[f]) for f in files if f in pats] |
|
74 | 80 | |
|
75 | 81 | def ignore(root, files, warn): |
General Comments 0
You need to be logged in to leave comments.
Login now