changeset 36742:390d16ea7c76

py3: use pycompat.bytestr instead of str Differential Revision: https://phab.mercurial-scm.org/D2648
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 04 Mar 2018 22:33:59 +0530
parents 59802fa590db
children 3fdba7fb264d
files mercurial/cmdutil.py mercurial/commands.py mercurial/debugcommands.py mercurial/subrepo.py mercurial/wireproto.py
diffstat 5 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Sun Mar 04 07:40:21 2018 -0800
+++ b/mercurial/cmdutil.py	Sun Mar 04 22:33:59 2018 +0530
@@ -362,7 +362,7 @@
                     ui.debug(fp.getvalue())
                     patch.internalpatch(ui, repo, fp, 1, eolmode=None)
                 except error.PatchError as err:
-                    raise error.Abort(str(err))
+                    raise error.Abort(pycompat.bytestr(err))
             del fp
 
             # 4. We prepared working directory according to filtered
@@ -1432,7 +1432,7 @@
                             files=files, eolmode=None, similarity=sim / 100.0)
             except error.PatchError as e:
                 if not partial:
-                    raise error.Abort(str(e))
+                    raise error.Abort(pycompat.bytestr(e))
                 if partial:
                     rejects = True
 
@@ -3043,7 +3043,7 @@
             try:
                 patch.internalpatch(repo.ui, repo, fp, 1, eolmode=None)
             except error.PatchError as err:
-                raise error.Abort(str(err))
+                raise error.Abort(pycompat.bytestr(err))
         del fp
     else:
         for f in actions['revert'][0]:
--- a/mercurial/commands.py	Sun Mar 04 07:40:21 2018 -0800
+++ b/mercurial/commands.py	Sun Mar 04 22:33:59 2018 +0530
@@ -1197,7 +1197,7 @@
         bcompression, cgversion, params = exchange.parsebundlespec(
                 repo, bundletype, strict=False)
     except error.UnsupportedBundleSpecification as e:
-        raise error.Abort(str(e),
+        raise error.Abort(pycompat.bytestr(e),
                           hint=_("see 'hg help bundlespec' for supported "
                                  "values for --type"))
 
--- a/mercurial/debugcommands.py	Sun Mar 04 07:40:21 2018 -0800
+++ b/mercurial/debugcommands.py	Sun Mar 04 22:33:59 2018 +0530
@@ -1811,7 +1811,7 @@
     if keyinfo:
         key, old, new = keyinfo
         r = target.pushkey(namespace, key, old, new)
-        ui.status(str(r) + '\n')
+        ui.status(pycompat.bytestr(r) + '\n')
         return not r
     else:
         for k, v in sorted(target.listkeys(namespace).iteritems()):
--- a/mercurial/subrepo.py	Sun Mar 04 07:40:21 2018 -0800
+++ b/mercurial/subrepo.py	Sun Mar 04 22:33:59 2018 +0530
@@ -1123,7 +1123,7 @@
         doc = xml.dom.minidom.parseString(output)
         paths = []
         for e in doc.getElementsByTagName('entry'):
-            kind = str(e.getAttribute('kind'))
+            kind = pycompat.bytestr(e.getAttribute('kind'))
             if kind != 'file':
                 continue
             name = ''.join(c.data for c
--- a/mercurial/wireproto.py	Sun Mar 04 07:40:21 2018 -0800
+++ b/mercurial/wireproto.py	Sun Mar 04 22:33:59 2018 +0530
@@ -1043,7 +1043,7 @@
                         util.stderr.write("(%s)\n" % exc.hint)
                     return pushres(0, output.getvalue() if output else '')
                 except error.PushRaced:
-                    return pusherr(str(exc),
+                    return pusherr(pycompat.bytestr(exc),
                                    output.getvalue() if output else '')
 
             bundler = bundle2.bundle20(repo.ui)