# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 2018-03-04 17:03:59 # Node ID 390d16ea7c7693606dc4b2a2e941d4ff84bc4339 # Parent 59802fa590dbc29e364afd3f87d4987c3219fb5f py3: use pycompat.bytestr instead of str Differential Revision: https://phab.mercurial-scm.org/D2648 diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -362,7 +362,7 @@ def dorecord(ui, repo, commitfunc, cmdsu 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 @@ def tryimportone(ui, repo, hunk, parents 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 @@ def _performrevert(repo, parents, ctx, a 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]: diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1197,7 +1197,7 @@ def bundle(ui, repo, fname, dest=None, * 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")) diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -1811,7 +1811,7 @@ def debugpushkey(ui, repopath, namespace 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()): diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -1123,7 +1123,7 @@ class svnsubrepo(abstractsubrepo): 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 diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -1043,7 +1043,7 @@ def unbundle(repo, proto, heads): 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)