Patchwork D1138: webcommands: replace str(ctx) etc with pycompat.bytestr(ctx) etc

login
register
mail settings
Submitter phabricator
Date Oct. 17, 2017, 2:56 a.m.
Message ID <differential-rev-PHID-DREV-yjjepp2mqrldciug3meg-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/25075/
State Superseded
Headers show

Comments

phabricator - Oct. 17, 2017, 2:56 a.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  hgweb can now serve the graph view in Python 3.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/hgweb/webcommands.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel
phabricator - Oct. 17, 2017, 10:41 a.m.
pulkit added a comment.


  yayay <https://phab.mercurial-scm.org/macro/meme/?macro=yayay>

REPOSITORY
  rHG Mercurial

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

To: durin42, #hg-reviewers
Cc: pulkit, mercurial-devel
phabricator - Oct. 17, 2017, 12:39 p.m.
ryanmce accepted this revision.
ryanmce added a comment.
This revision is now accepted and ready to land.


  queued

REPOSITORY
  rHG Mercurial

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

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

Patch

diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -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):