mercurial/hgweb/webcommands.py
changeset 29522 9c37df347485
parent 29471 c4fc33c477da
child 29538 df7d8ea90695
equal deleted inserted replaced
29521:83147ff53112 29522:9c37df347485
   862     f = fctx.path()
   862     f = fctx.path()
   863     parity = paritygen(web.stripecount)
   863     parity = paritygen(web.stripecount)
   864     diffopts = patch.difffeatureopts(web.repo.ui, untrusted=True,
   864     diffopts = patch.difffeatureopts(web.repo.ui, untrusted=True,
   865                                      section='annotate', whitespace=True)
   865                                      section='annotate', whitespace=True)
   866 
   866 
       
   867     def parents(f):
       
   868         for p in f.parents():
       
   869             yield {
       
   870                 "node": p.hex(),
       
   871                 "rev": p.rev(),
       
   872             }
       
   873 
   867     def annotate(**map):
   874     def annotate(**map):
   868         if util.binary(fctx.data()):
   875         if util.binary(fctx.data()):
   869             mt = (mimetypes.guess_type(fctx.path())[0]
   876             mt = (mimetypes.guess_type(fctx.path())[0]
   870                   or 'application/octet-stream')
   877                   or 'application/octet-stream')
   871             lines = enumerate([((fctx.filectx(fctx.filerev()), 1),
   878             lines = enumerate([((fctx.filectx(fctx.filerev()), 1),
   880             previousrev = rev
   887             previousrev = rev
   881             yield {"parity": next(parity),
   888             yield {"parity": next(parity),
   882                    "node": f.hex(),
   889                    "node": f.hex(),
   883                    "rev": rev,
   890                    "rev": rev,
   884                    "author": f.user(),
   891                    "author": f.user(),
       
   892                    "parents": parents(f),
   885                    "desc": f.description(),
   893                    "desc": f.description(),
   886                    "extra": f.extra(),
   894                    "extra": f.extra(),
   887                    "file": f.path(),
   895                    "file": f.path(),
   888                    "blockhead": blockhead,
   896                    "blockhead": blockhead,
   889                    "targetline": targetline,
   897                    "targetline": targetline,