mercurial/hgweb/webcommands.py
changeset 37066 b33b91ca2ec2
parent 37019 c97b936d8bb5
child 37084 f0b6fbea00cf
equal deleted inserted replaced
37065:b235bde38a83 37066:b33b91ca2ec2
   943 
   943 
   944     def annotate(**map):
   944     def annotate(**map):
   945         if fctx.isbinary():
   945         if fctx.isbinary():
   946             mt = (mimetypes.guess_type(fctx.path())[0]
   946             mt = (mimetypes.guess_type(fctx.path())[0]
   947                   or 'application/octet-stream')
   947                   or 'application/octet-stream')
   948             lines = [((fctx.filectx(fctx.filerev()), 1), '(binary:%s)' % mt)]
   948             lines = [dagop.annotateline(fctx=fctx.filectx(fctx.filerev()),
       
   949                                         lineno=1, text='(binary:%s)' % mt)]
   949         else:
   950         else:
   950             lines = webutil.annotate(web.req, fctx, web.repo.ui)
   951             lines = webutil.annotate(web.req, fctx, web.repo.ui)
   951 
   952 
   952         previousrev = None
   953         previousrev = None
   953         blockparitygen = paritygen(1)
   954         blockparitygen = paritygen(1)
   954         for lineno, (aline, l) in enumerate(lines):
   955         for lineno, aline in enumerate(lines):
   955             f = aline.fctx
   956             f = aline.fctx
   956             rev = f.rev()
   957             rev = f.rev()
   957             if rev != previousrev:
   958             if rev != previousrev:
   958                 blockhead = True
   959                 blockhead = True
   959                 blockparity = next(blockparitygen)
   960                 blockparity = next(blockparitygen)
   969                    "extra": f.extra(),
   970                    "extra": f.extra(),
   970                    "file": f.path(),
   971                    "file": f.path(),
   971                    "blockhead": blockhead,
   972                    "blockhead": blockhead,
   972                    "blockparity": blockparity,
   973                    "blockparity": blockparity,
   973                    "targetline": aline.lineno,
   974                    "targetline": aline.lineno,
   974                    "line": l,
   975                    "line": aline.text,
   975                    "lineno": lineno + 1,
   976                    "lineno": lineno + 1,
   976                    "lineid": "l%d" % (lineno + 1),
   977                    "lineid": "l%d" % (lineno + 1),
   977                    "linenumber": "% 6d" % (lineno + 1),
   978                    "linenumber": "% 6d" % (lineno + 1),
   978                    "revdate": f.date()}
   979                    "revdate": f.date()}
   979 
   980