o ]LbK@sddlmZddlmZddlmZmZmZm Z m Z m Z ddl mZm Z GdddeZdd Zd d ZdddZddZ dddZdddZddZddZd S))absolute_import)getattr)contextdagop extensionshgwebpatchutil)rrevmapc@s>eZdZdZddZddZddZejdd Z d d Z d S) _lazyfctxz strs fastannotates mainbranchsdefault)ruiconfig)r%rrr _getmasterBrr6TNc Cst|}t|||G}z|j||ddd\}}Wn/tyJ||jj d|j z|j||ddd\}}WntyGwYnwWdn1sUwY|r^|s`Jt |j||S)zlike the vanilla fctx.annotate, but do it via fastannotate, and make the output format compatible with the vanilla fctx.annotate. may raise Exception, and always return line numbers. T)mastershowpath showliness*fastannotate: %s: rebuilding broken cache N) r6rfctxannotatecontextannotaterev Exceptionrebuildrr4debugrr3)r%followdiffoptsr7acr+r,rrr _doannotateGs0     rCcCstj|dddd}t||dS)NTannotate) untrustedsection whitespace)rA)rdifffeatureoptsrC)origr%r4rArrr_hgwebannotatecs rJFc Csl|r ||||||dSzt|||WSty5}z|jjd||||||dWYd}~Sd}~ww)N)skiprevsrAs7fastannotate: falling back to the vanilla annotate: %r )r@rKrA)rCr=rr4r?)rIrr@ linenumberrKrAexrrr _fctxannotatejs rNcCsLt|||}t|j}Wdn1swY||||||dS)N)rKrA prefetchskip)rr:r revmappath)rIrr@rKrArBskipsetrrr_remotefctxannotate{s  rRcCttjdtdSNrD)r wrapfunctionrwebutilrJrrrrreplacehgwebannotaterWcCrSrT)rrU hgcontext basefilectxrNrrrrreplacefctxannotaterXr[)TN)FFNN)FNN) __future__rmercurial.pycompatr mercurialrrYrrrrr r objectr r3r6rCrJrNrRrWr[rrrrs