mercurial/hgweb/webcommands.py
changeset 39784 be0f32ca2671
parent 39419 6268fed317d0
child 39793 536f22d6c2c5
equal deleted inserted replaced
39783:76f92d208f7a 39784:be0f32ca2671
   141 
   141 
   142 def _filerevision(web, fctx):
   142 def _filerevision(web, fctx):
   143     f = fctx.path()
   143     f = fctx.path()
   144     text = fctx.data()
   144     text = fctx.data()
   145     parity = paritygen(web.stripecount)
   145     parity = paritygen(web.stripecount)
   146     ishead = fctx.filerev() in fctx.filelog().headrevs()
   146     ishead = fctx.filenode() in fctx.filelog().heads()
   147 
   147 
   148     if stringutil.binary(text):
   148     if stringutil.binary(text):
   149         mt = mimetypes.guess_type(f)[0] or 'application/octet-stream'
   149         mt = mimetypes.guess_type(f)[0] or 'application/octet-stream'
   150         text = '(binary:%s)' % mt
   150         text = '(binary:%s)' % mt
   151 
   151 
   920     The ``fileannotate`` template is rendered.
   920     The ``fileannotate`` template is rendered.
   921     """
   921     """
   922     fctx = webutil.filectx(web.repo, web.req)
   922     fctx = webutil.filectx(web.repo, web.req)
   923     f = fctx.path()
   923     f = fctx.path()
   924     parity = paritygen(web.stripecount)
   924     parity = paritygen(web.stripecount)
   925     ishead = fctx.filerev() in fctx.filelog().headrevs()
   925     ishead = fctx.filenode() in fctx.filelog().heads()
   926 
   926 
   927     # parents() is called once per line and several lines likely belong to
   927     # parents() is called once per line and several lines likely belong to
   928     # same revision. So it is worth caching.
   928     # same revision. So it is worth caching.
   929     # TODO there are still redundant operations within basefilectx.parents()
   929     # TODO there are still redundant operations within basefilectx.parents()
   930     # and from the fctx.annotate() call itself that could be cached.
   930     # and from the fctx.annotate() call itself that could be cached.