Mercurial > hg
comparison mercurial/dirstate.py @ 34022:d5b2beca16c0
python3: wrap all uses of <exception>.strerror with strtolocal
Our string literals are bytes, and we mostly want to %-format a
strerror into a one of those literals, so this fixes a ton of issues.
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Tue, 22 Aug 2017 20:03:07 -0400 |
parents | 5cb0a8fe096e |
children | 1246acdad653 |
comparison
equal
deleted
inserted
replaced
34021:31a2eb0f74e5 | 34022:d5b2beca16c0 |
---|---|
980 if nf in alldirs: | 980 if nf in alldirs: |
981 if matchedir: | 981 if matchedir: |
982 matchedir(nf) | 982 matchedir(nf) |
983 notfoundadd(nf) | 983 notfoundadd(nf) |
984 else: | 984 else: |
985 badfn(ff, inst.strerror) | 985 badfn(ff, encoding.strtolocal(inst.strerror)) |
986 | 986 |
987 # Case insensitive filesystems cannot rely on lstat() failing to detect | 987 # Case insensitive filesystems cannot rely on lstat() failing to detect |
988 # a case-only rename. Prune the stat object for any file that does not | 988 # a case-only rename. Prune the stat object for any file that does not |
989 # match the case in the filesystem, if there are multiple files that | 989 # match the case in the filesystem, if there are multiple files that |
990 # normalize to the same path. | 990 # normalize to the same path. |
1086 skip = '.hg' | 1086 skip = '.hg' |
1087 try: | 1087 try: |
1088 entries = listdir(join(nd), stat=True, skip=skip) | 1088 entries = listdir(join(nd), stat=True, skip=skip) |
1089 except OSError as inst: | 1089 except OSError as inst: |
1090 if inst.errno in (errno.EACCES, errno.ENOENT): | 1090 if inst.errno in (errno.EACCES, errno.ENOENT): |
1091 match.bad(self.pathto(nd), inst.strerror) | 1091 match.bad(self.pathto(nd), |
1092 encoding.strtolocal(inst.strerror)) | |
1092 continue | 1093 continue |
1093 raise | 1094 raise |
1094 for f, kind, st in entries: | 1095 for f, kind, st in entries: |
1095 if normalizefile: | 1096 if normalizefile: |
1096 # even though f might be a directory, we're only | 1097 # even though f might be a directory, we're only |