mercurial/hgweb/webcommands.py
changeset 34695 e178fcaa3933
parent 34654 4182d2065e7a
child 34809 3a65012be661
equal deleted inserted replaced
34694:2976cf87a60a 34695:e178fcaa3933
     5 # This software may be used and distributed according to the terms of the
     5 # This software may be used and distributed according to the terms of the
     6 # GNU General Public License version 2 or any later version.
     6 # GNU General Public License version 2 or any later version.
     7 
     7 
     8 from __future__ import absolute_import
     8 from __future__ import absolute_import
     9 
     9 
    10 import cgi
       
    11 import copy
    10 import copy
    12 import mimetypes
    11 import mimetypes
    13 import os
    12 import os
    14 import re
    13 import re
    15 
    14 
    36     revsetlang,
    35     revsetlang,
    37     scmutil,
    36     scmutil,
    38     smartset,
    37     smartset,
    39     templatefilters,
    38     templatefilters,
    40     templater,
    39     templater,
       
    40     url,
    41     util,
    41     util,
    42 )
    42 )
    43 
    43 
    44 from . import (
    44 from . import (
    45     webutil,
    45     webutil,
  1248             if type != graphmod.CHANGESET:
  1248             if type != graphmod.CHANGESET:
  1249                 continue
  1249                 continue
  1250             node = str(ctx)
  1250             node = str(ctx)
  1251             age = encodestr(templatefilters.age(ctx.date()))
  1251             age = encodestr(templatefilters.age(ctx.date()))
  1252             desc = templatefilters.firstline(encodestr(ctx.description()))
  1252             desc = templatefilters.firstline(encodestr(ctx.description()))
  1253             desc = cgi.escape(templatefilters.nonempty(desc))
  1253             desc = url.escape(templatefilters.nonempty(desc))
  1254             user = cgi.escape(templatefilters.person(encodestr(ctx.user())))
  1254             user = url.escape(templatefilters.person(encodestr(ctx.user())))
  1255             branch = cgi.escape(encodestr(ctx.branch()))
  1255             branch = url.escape(encodestr(ctx.branch()))
  1256             try:
  1256             try:
  1257                 branchnode = web.repo.branchtip(branch)
  1257                 branchnode = web.repo.branchtip(branch)
  1258             except error.RepoLookupError:
  1258             except error.RepoLookupError:
  1259                 branchnode = None
  1259                 branchnode = None
  1260             branch = branch, branchnode == ctx.node()
  1260             branch = branch, branchnode == ctx.node()
  1261 
  1261 
  1262             if usetuples:
  1262             if usetuples:
  1263                 data.append((node, vtx, edges, desc, user, age, branch,
  1263                 data.append((node, vtx, edges, desc, user, age, branch,
  1264                              [cgi.escape(encodestr(x)) for x in ctx.tags()],
  1264                              [url.escape(encodestr(x)) for x in ctx.tags()],
  1265                              [cgi.escape(encodestr(x))
  1265                              [url.escape(encodestr(x))
  1266                               for x in ctx.bookmarks()]))
  1266                               for x in ctx.bookmarks()]))
  1267             else:
  1267             else:
  1268                 edgedata = [{'col': edge[0], 'nextcol': edge[1],
  1268                 edgedata = [{'col': edge[0], 'nextcol': edge[1],
  1269                              'color': (edge[2] - 1) % 6 + 1,
  1269                              'color': (edge[2] - 1) % 6 + 1,
  1270                              'width': edge[3], 'bcolor': edge[4]}
  1270                              'width': edge[3], 'bcolor': edge[4]}