Mercurial > hg
changeset 25164:1e86bb282c71
ignore: move bad file handling out of readignorefile
In preparation for moving readignorefile to match.py to make it more generally
usable, let's move the bad ignore file handling up to the ignore specific logic.
author | Durham Goode <durham@fb.com> |
---|---|
date | Sat, 16 May 2015 15:37:59 -0700 |
parents | 3139900f31b1 |
children | 581e2066d802 |
files | mercurial/ignore.py |
diffstat | 1 files changed, 10 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/ignore.py Sat May 16 15:24:43 2015 -0700 +++ b/mercurial/ignore.py Sat May 16 15:37:59 2015 -0700 @@ -56,16 +56,11 @@ return patterns, warnings def readignorefile(filepath, warn): - try: - pats = [] - fp = open(filepath) - pats, warnings = ignorepats(fp) - fp.close() - for warning in warnings: - warn("%s: %s\n" % (filepath, warning)) - except IOError, inst: - warn(_("skipping unreadable ignore file '%s': %s\n") % - (filepath, inst.strerror)) + fp = open(filepath) + pats, warnings = ignorepats(fp) + fp.close() + for warning in warnings: + warn("%s: %s\n" % (filepath, warning)) return pats def readpats(root, files, warn): @@ -75,7 +70,11 @@ for f in files: if f in pats: continue - pats[f] = readignorefile(f, warn) + try: + pats[f] = readignorefile(f, warn) + except IOError, inst: + warn(_("skipping unreadable ignore file '%s': %s\n") % + (f, inst.strerror)) return [(f, pats[f]) for f in files if f in pats]