changeset 36562:247e9bf4ecdc

py3: use util.forcebytestr() to convert IOErrors to bytes Differential Revision: https://phab.mercurial-scm.org/D2536
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 02 Mar 2018 07:14:59 +0530
parents 23d1096b4b37
children 9d71bd25554b
files hgext/largefiles/remotestore.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/remotestore.py	Thu Mar 01 18:20:49 2018 -0500
+++ b/hgext/largefiles/remotestore.py	Fri Mar 02 07:14:59 2018 +0530
@@ -52,7 +52,7 @@
         except IOError as e:
             raise error.Abort(
                 _('remotestore: could not open file %s: %s')
-                % (filename, str(e)))
+                % (filename, util.forcebytestr(e)))
 
     def _getfile(self, tmpfile, filename, hash):
         try:
@@ -60,7 +60,8 @@
         except urlerr.httperror as e:
             # 401s get converted to error.Aborts; everything else is fine being
             # turned into a StoreError
-            raise basestore.StoreError(filename, hash, self.url, str(e))
+            raise basestore.StoreError(filename, hash, self.url,
+                                       util.forcebytestr(e))
         except urlerr.urlerror as e:
             # This usually indicates a connection problem, so don't
             # keep trying with the other files... they will probably
@@ -68,7 +69,8 @@
             raise error.Abort('%s: %s' %
                              (util.hidepassword(self.url), e.reason))
         except IOError as e:
-            raise basestore.StoreError(filename, hash, self.url, str(e))
+            raise basestore.StoreError(filename, hash, self.url,
+                                       util.forcebytestr(e))
 
         return lfutil.copyandhash(chunks, tmpfile)