Patchwork [7,of,8] py3: use bytestr() to coerce position carried by ParseError to string

login
register
mail settings
Submitter Yuya Nishihara
Date March 1, 2018, 2:17 p.m.
Message ID <ebde1b7aba4b59b41736.1519913834@mimosa>
Download mbox | patch
Permalink /patch/28554/
State Accepted
Headers show

Comments

Yuya Nishihara - March 1, 2018, 2:17 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1519911934 18000
#      Thu Mar 01 08:45:34 2018 -0500
# Node ID ebde1b7aba4b59b417369b550989dfd7c7e449c2
# Parent  5644cfd9717dd1417505a3ee0e0ae492f0da799f
py3: use bytestr() to coerce position carried by ParseError to string

The position value is either int or byte string.

Patch

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -132,7 +132,7 @@  def _formatparse(write, inst):
         similar = _getsimilar(inst.symbols, inst.function)
     if len(inst.args) > 1:
         write(_("hg: parse error at %s: %s\n") %
-                         (inst.args[1], inst.args[0]))
+              (pycompat.bytestr(inst.args[1]), inst.args[0]))
         if (inst.args[0][0] == ' '):
             write(_("unexpected leading whitespace\n"))
     else: