##// END OF EJS Templates
hgweb: add option to convert encoding of graphdata()...
Yuya Nishihara -
r28211:44646588 default
parent child Browse files
Show More
@@ -1135,7 +1135,7 b' def graph(web, req, tmpl):'
1135 max([edge[1] for edge in edges] or [0]))
1135 max([edge[1] for edge in edges] or [0]))
1136 return cols
1136 return cols
1137
1137
1138 def graphdata(usetuples):
1138 def graphdata(usetuples, encodestr):
1139 data = []
1139 data = []
1140
1140
1141 row = 0
1141 row = 0
@@ -1143,11 +1143,11 b' def graph(web, req, tmpl):'
1143 if type != graphmod.CHANGESET:
1143 if type != graphmod.CHANGESET:
1144 continue
1144 continue
1145 node = str(ctx)
1145 node = str(ctx)
1146 age = templatefilters.age(ctx.date())
1146 age = encodestr(templatefilters.age(ctx.date()))
1147 desc = templatefilters.firstline(ctx.description())
1147 desc = templatefilters.firstline(encodestr(ctx.description()))
1148 desc = cgi.escape(templatefilters.nonempty(desc))
1148 desc = cgi.escape(templatefilters.nonempty(desc))
1149 user = cgi.escape(templatefilters.person(ctx.user()))
1149 user = cgi.escape(templatefilters.person(encodestr(ctx.user())))
1150 branch = cgi.escape(ctx.branch())
1150 branch = cgi.escape(encodestr(ctx.branch()))
1151 try:
1151 try:
1152 branchnode = web.repo.branchtip(branch)
1152 branchnode = web.repo.branchtip(branch)
1153 except error.RepoLookupError:
1153 except error.RepoLookupError:
@@ -1156,8 +1156,9 b' def graph(web, req, tmpl):'
1156
1156
1157 if usetuples:
1157 if usetuples:
1158 data.append((node, vtx, edges, desc, user, age, branch,
1158 data.append((node, vtx, edges, desc, user, age, branch,
1159 [cgi.escape(x) for x in ctx.tags()],
1159 [cgi.escape(encodestr(x)) for x in ctx.tags()],
1160 [cgi.escape(x) for x in ctx.bookmarks()]))
1160 [cgi.escape(encodestr(x))
1161 for x in ctx.bookmarks()]))
1161 else:
1162 else:
1162 edgedata = [{'col': edge[0], 'nextcol': edge[1],
1163 edgedata = [{'col': edge[0], 'nextcol': edge[1],
1163 'color': (edge[2] - 1) % 6 + 1,
1164 'color': (edge[2] - 1) % 6 + 1,
@@ -1195,8 +1196,8 b' def graph(web, req, tmpl):'
1195 canvaswidth=(cols + 1) * bg_height,
1196 canvaswidth=(cols + 1) * bg_height,
1196 truecanvasheight=rows * bg_height,
1197 truecanvasheight=rows * bg_height,
1197 canvasheight=canvasheight, bg_height=bg_height,
1198 canvasheight=canvasheight, bg_height=bg_height,
1198 jsdata=lambda **x: graphdata(True),
1199 jsdata=lambda **x: graphdata(True, str),
1199 nodes=lambda **x: graphdata(False),
1200 nodes=lambda **x: graphdata(False, str),
1200 node=ctx.hex(), changenav=changenav)
1201 node=ctx.hex(), changenav=changenav)
1201
1202
1202 def _getdoc(e):
1203 def _getdoc(e):
General Comments 0
You need to be logged in to leave comments. Login now