Patchwork D2292: scmutil: bytes-ify IOErrors before wrapping them in abort message

login
register
mail settings
Submitter phabricator
Date Feb. 17, 2018, 6:41 a.m.
Message ID <differential-rev-PHID-DREV-7xio2uipig4kfxznhani-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/28010/
State Superseded
Headers show

Comments

phabricator - Feb. 17, 2018, 6:41 a.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2292

AFFECTED FILES
  mercurial/scmutil.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel
phabricator - Feb. 17, 2018, 9:39 a.m.
pulkit added a comment.


  It's recommended using `util.forcebytestr()` to convert error messages to bytes. https://phab.mercurial-scm.org/D2269#inline-5791

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2292

To: durin42, #hg-reviewers
Cc: pulkit, mercurial-devel

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -215,7 +215,7 @@ 
             ui.warn(_("(is your Python install correct?)\n"))
     except IOError as inst:
         if util.safehasattr(inst, "code"):
-            ui.warn(_("abort: %s\n") % inst)
+            ui.warn(_("abort: %s\n") % pycompat.bytestr(inst))
         elif util.safehasattr(inst, "reason"):
             try: # usually it is in the form (errno, strerror)
                 reason = inst.reason.args[1]