Mercurial > public > mercurial-scm > hg
comparison mercurial/patch.py @ 36229:6ea0b78ddcac
py3: use util.forcebytestr instead of str for converting errors to bytes
Differential Revision: https://phab.mercurial-scm.org/D2269
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 14 Feb 2018 17:43:33 +0530 |
parents | eb91ffdaaece |
children | 2831d918e1b4 |
comparison
equal
deleted
inserted
replaced
36228:ddeb7653b31c | 36229:6ea0b78ddcac |
---|---|
1457 l = ord(l) - ord('a') + 27 | 1457 l = ord(l) - ord('a') + 27 |
1458 try: | 1458 try: |
1459 dec.append(util.b85decode(line[1:])[:l]) | 1459 dec.append(util.b85decode(line[1:])[:l]) |
1460 except ValueError as e: | 1460 except ValueError as e: |
1461 raise PatchError(_('could not decode "%s" binary patch: %s') | 1461 raise PatchError(_('could not decode "%s" binary patch: %s') |
1462 % (self._fname, str(e))) | 1462 % (self._fname, util.forcebytestr(e))) |
1463 line = getline(lr, self.hunk) | 1463 line = getline(lr, self.hunk) |
1464 text = zlib.decompress(''.join(dec)) | 1464 text = zlib.decompress(''.join(dec)) |
1465 if len(text) != size: | 1465 if len(text) != size: |
1466 raise PatchError(_('"%s" length is %d bytes, should be %d') | 1466 raise PatchError(_('"%s" length is %d bytes, should be %d') |
1467 % (self._fname, len(text), size)) | 1467 % (self._fname, len(text), size)) |