mercurial/hgweb/webcommands.py
changeset 38137 3e6253438bf9
parent 38136 e4a43d261715
child 38138 8e9ce73ceb15
equal deleted inserted replaced
38136:e4a43d261715 38137:3e6253438bf9
   941                 parentscache[rev].append(entry)
   941                 parentscache[rev].append(entry)
   942 
   942 
   943         for p in parentscache[rev]:
   943         for p in parentscache[rev]:
   944             yield p
   944             yield p
   945 
   945 
   946     def annotate(**map):
   946     def annotate(context):
   947         if fctx.isbinary():
   947         if fctx.isbinary():
   948             mt = (mimetypes.guess_type(fctx.path())[0]
   948             mt = (mimetypes.guess_type(fctx.path())[0]
   949                   or 'application/octet-stream')
   949                   or 'application/octet-stream')
   950             lines = [dagop.annotateline(fctx=fctx.filectx(fctx.filerev()),
   950             lines = [dagop.annotateline(fctx=fctx.filectx(fctx.filerev()),
   951                                         lineno=1, text='(binary:%s)' % mt)]
   951                                         lineno=1, text='(binary:%s)' % mt)]
   984     diffopts = {k: getattr(diffopts, k) for k in diffopts.defaults}
   984     diffopts = {k: getattr(diffopts, k) for k in diffopts.defaults}
   985 
   985 
   986     return web.sendtemplate(
   986     return web.sendtemplate(
   987         'fileannotate',
   987         'fileannotate',
   988         file=f,
   988         file=f,
   989         annotate=annotate,
   989         annotate=templateutil.mappinggenerator(annotate),
   990         path=webutil.up(f),
   990         path=webutil.up(f),
   991         symrev=webutil.symrevorshortnode(web.req, fctx),
   991         symrev=webutil.symrevorshortnode(web.req, fctx),
   992         rename=webutil.renamelink(fctx),
   992         rename=webutil.renamelink(fctx),
   993         permissions=fctx.manifest().flags(f),
   993         permissions=fctx.manifest().flags(f),
   994         ishead=int(ishead),
   994         ishead=int(ishead),