mercurial/hgweb/webcommands.py
changeset 30081 dd0ff715a82c
parent 29572 d86b54d9bb0c
child 30298 4ed8bb8a153f
equal deleted inserted replaced
30080:33e8a5a00007 30081:dd0ff715a82c
    29 from .. import (
    29 from .. import (
    30     archival,
    30     archival,
    31     encoding,
    31     encoding,
    32     error,
    32     error,
    33     graphmod,
    33     graphmod,
    34     patch,
       
    35     revset,
    34     revset,
    36     scmutil,
    35     scmutil,
    37     templatefilters,
    36     templatefilters,
    38     templater,
    37     templater,
    39     util,
    38     util,
   859     The ``fileannotate`` template is rendered.
   858     The ``fileannotate`` template is rendered.
   860     """
   859     """
   861     fctx = webutil.filectx(web.repo, req)
   860     fctx = webutil.filectx(web.repo, req)
   862     f = fctx.path()
   861     f = fctx.path()
   863     parity = paritygen(web.stripecount)
   862     parity = paritygen(web.stripecount)
   864     diffopts = patch.difffeatureopts(web.repo.ui, untrusted=True,
       
   865                                      section='annotate', whitespace=True)
       
   866 
   863 
   867     def parents(f):
   864     def parents(f):
   868         for p in f.parents():
   865         for p in f.parents():
   869             yield {
   866             yield {
   870                 "node": p.hex(),
   867                 "node": p.hex(),
   875         if util.binary(fctx.data()):
   872         if util.binary(fctx.data()):
   876             mt = (mimetypes.guess_type(fctx.path())[0]
   873             mt = (mimetypes.guess_type(fctx.path())[0]
   877                   or 'application/octet-stream')
   874                   or 'application/octet-stream')
   878             lines = [((fctx.filectx(fctx.filerev()), 1), '(binary:%s)' % mt)]
   875             lines = [((fctx.filectx(fctx.filerev()), 1), '(binary:%s)' % mt)]
   879         else:
   876         else:
   880             lines = fctx.annotate(follow=True, linenumber=True,
   877             lines = webutil.annotate(fctx, web.repo.ui)
   881                                   diffopts=diffopts)
   878 
   882         previousrev = None
   879         previousrev = None
   883         blockparitygen = paritygen(1)
   880         blockparitygen = paritygen(1)
   884         for lineno, ((f, targetline), l) in enumerate(lines):
   881         for lineno, ((f, targetline), l) in enumerate(lines):
   885             rev = f.rev()
   882             rev = f.rev()
   886             if rev != previousrev:
   883             if rev != previousrev: