mercurial/hgweb/webcommands.py
changeset 29538 df7d8ea90695
parent 29522 9c37df347485
child 29572 d86b54d9bb0c
equal deleted inserted replaced
29537:5f8b36d5a6ec 29538:df7d8ea90695
   873 
   873 
   874     def annotate(**map):
   874     def annotate(**map):
   875         if util.binary(fctx.data()):
   875         if util.binary(fctx.data()):
   876             mt = (mimetypes.guess_type(fctx.path())[0]
   876             mt = (mimetypes.guess_type(fctx.path())[0]
   877                   or 'application/octet-stream')
   877                   or 'application/octet-stream')
   878             lines = enumerate([((fctx.filectx(fctx.filerev()), 1),
   878             lines = [((fctx.filectx(fctx.filerev()), 1), '(binary:%s)' % mt)]
   879                                 '(binary:%s)' % mt)])
       
   880         else:
   879         else:
   881             lines = enumerate(fctx.annotate(follow=True, linenumber=True,
   880             lines = fctx.annotate(follow=True, linenumber=True,
   882                                             diffopts=diffopts))
   881                                   diffopts=diffopts)
   883         previousrev = None
   882         previousrev = None
   884         for lineno, ((f, targetline), l) in lines:
   883         for lineno, ((f, targetline), l) in enumerate(lines):
   885             rev = f.rev()
   884             rev = f.rev()
   886             blockhead = rev != previousrev or None
   885             blockhead = rev != previousrev or None
   887             previousrev = rev
   886             previousrev = rev
   888             yield {"parity": next(parity),
   887             yield {"parity": next(parity),
   889                    "node": f.hex(),
   888                    "node": f.hex(),