changeset 34809:3a65012be661

webcommands: replace str(ctx) etc with pycompat.bytestr(ctx) etc hgweb can now serve the graph view in Python 3. Differential Revision: https://phab.mercurial-scm.org/D1138
author Augie Fackler <augie@google.com>
date Mon, 16 Oct 2017 22:51:58 -0400
parents e87e62b7fc0b
children 44bd29168d14
files mercurial/hgweb/webcommands.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Mon Oct 16 22:50:39 2017 -0400
+++ b/mercurial/hgweb/webcommands.py	Mon Oct 16 22:51:58 2017 -0400
@@ -31,6 +31,7 @@
     encoding,
     error,
     graphmod,
+    pycompat,
     revset,
     revsetlang,
     scmutil,
@@ -1247,7 +1248,7 @@
         for (id, type, ctx, vtx, edges) in tree:
             if type != graphmod.CHANGESET:
                 continue
-            node = str(ctx)
+            node = pycompat.bytestr(ctx)
             age = encodestr(templatefilters.age(ctx.date()))
             desc = templatefilters.firstline(encodestr(ctx.description()))
             desc = url.escape(templatefilters.nonempty(desc))
@@ -1303,7 +1304,7 @@
                 canvasheight=canvasheight, bg_height=bg_height,
                 # {jsdata} will be passed to |json, so it must be in utf-8
                 jsdata=lambda **x: graphdata(True, encoding.fromlocal),
-                nodes=lambda **x: graphdata(False, str),
+                nodes=lambda **x: graphdata(False, pycompat.bytestr),
                 node=ctx.hex(), changenav=changenav)
 
 def _getdoc(e):