Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/webcommands.py @ 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 | e178fcaa3933 |
children | 4bc74bc78efd |
comparison
equal
deleted
inserted
replaced
34808:e87e62b7fc0b | 34809:3a65012be661 |
---|---|
29 archival, | 29 archival, |
30 dagop, | 30 dagop, |
31 encoding, | 31 encoding, |
32 error, | 32 error, |
33 graphmod, | 33 graphmod, |
34 pycompat, | |
34 revset, | 35 revset, |
35 revsetlang, | 36 revsetlang, |
36 scmutil, | 37 scmutil, |
37 smartset, | 38 smartset, |
38 templatefilters, | 39 templatefilters, |
1245 | 1246 |
1246 row = 0 | 1247 row = 0 |
1247 for (id, type, ctx, vtx, edges) in tree: | 1248 for (id, type, ctx, vtx, edges) in tree: |
1248 if type != graphmod.CHANGESET: | 1249 if type != graphmod.CHANGESET: |
1249 continue | 1250 continue |
1250 node = str(ctx) | 1251 node = pycompat.bytestr(ctx) |
1251 age = encodestr(templatefilters.age(ctx.date())) | 1252 age = encodestr(templatefilters.age(ctx.date())) |
1252 desc = templatefilters.firstline(encodestr(ctx.description())) | 1253 desc = templatefilters.firstline(encodestr(ctx.description())) |
1253 desc = url.escape(templatefilters.nonempty(desc)) | 1254 desc = url.escape(templatefilters.nonempty(desc)) |
1254 user = url.escape(templatefilters.person(encodestr(ctx.user()))) | 1255 user = url.escape(templatefilters.person(encodestr(ctx.user()))) |
1255 branch = url.escape(encodestr(ctx.branch())) | 1256 branch = url.escape(encodestr(ctx.branch())) |
1301 canvaswidth=(cols + 1) * bg_height, | 1302 canvaswidth=(cols + 1) * bg_height, |
1302 truecanvasheight=rows * bg_height, | 1303 truecanvasheight=rows * bg_height, |
1303 canvasheight=canvasheight, bg_height=bg_height, | 1304 canvasheight=canvasheight, bg_height=bg_height, |
1304 # {jsdata} will be passed to |json, so it must be in utf-8 | 1305 # {jsdata} will be passed to |json, so it must be in utf-8 |
1305 jsdata=lambda **x: graphdata(True, encoding.fromlocal), | 1306 jsdata=lambda **x: graphdata(True, encoding.fromlocal), |
1306 nodes=lambda **x: graphdata(False, str), | 1307 nodes=lambda **x: graphdata(False, pycompat.bytestr), |
1307 node=ctx.hex(), changenav=changenav) | 1308 node=ctx.hex(), changenav=changenav) |
1308 | 1309 |
1309 def _getdoc(e): | 1310 def _getdoc(e): |
1310 doc = e[0].__doc__ | 1311 doc = e[0].__doc__ |
1311 if doc: | 1312 if doc: |