Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/subrepo.py @ 34040: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 | db83a1df03fe |
children | 6d21737c35bf |
comparison
equal
deleted
inserted
replaced
34039:31a2eb0f74e5 | 34040:d5b2beca16c0 |
---|---|
1344 out, err = self._gitnodir(['--version']) | 1344 out, err = self._gitnodir(['--version']) |
1345 except OSError as e: | 1345 except OSError as e: |
1346 genericerror = _("error executing git for subrepo '%s': %s") | 1346 genericerror = _("error executing git for subrepo '%s': %s") |
1347 notfoundhint = _("check git is installed and in your PATH") | 1347 notfoundhint = _("check git is installed and in your PATH") |
1348 if e.errno != errno.ENOENT: | 1348 if e.errno != errno.ENOENT: |
1349 raise error.Abort(genericerror % (self._path, e.strerror)) | 1349 raise error.Abort(genericerror % ( |
1350 self._path, encoding.strtolocal(e.strerror))) | |
1350 elif pycompat.osname == 'nt': | 1351 elif pycompat.osname == 'nt': |
1351 try: | 1352 try: |
1352 self._gitexecutable = 'git.cmd' | 1353 self._gitexecutable = 'git.cmd' |
1353 out, err = self._gitnodir(['--version']) | 1354 out, err = self._gitnodir(['--version']) |
1354 except OSError as e2: | 1355 except OSError as e2: |
1356 raise error.Abort(_("couldn't find 'git' or 'git.cmd'" | 1357 raise error.Abort(_("couldn't find 'git' or 'git.cmd'" |
1357 " for subrepo '%s'") % self._path, | 1358 " for subrepo '%s'") % self._path, |
1358 hint=notfoundhint) | 1359 hint=notfoundhint) |
1359 else: | 1360 else: |
1360 raise error.Abort(genericerror % (self._path, | 1361 raise error.Abort(genericerror % (self._path, |
1361 e2.strerror)) | 1362 encoding.strtolocal(e2.strerror))) |
1362 else: | 1363 else: |
1363 raise error.Abort(_("couldn't find git for subrepo '%s'") | 1364 raise error.Abort(_("couldn't find git for subrepo '%s'") |
1364 % self._path, hint=notfoundhint) | 1365 % self._path, hint=notfoundhint) |
1365 versionstatus = self._checkversion(out) | 1366 versionstatus = self._checkversion(out) |
1366 if versionstatus == 'unknown': | 1367 if versionstatus == 'unknown': |