6hzSSKJr SSKrSSKrSSKrSSKJr SSKJrJ r J r SSK J r J rJrJrJrJrJr SSKJrJr SSKJ rJr \R8S 5rSS jrS rS r \R8"\RB5r"SSjr#Sr$Sr%\%"\RL5r'"SS5r(\("5r&"SS5r)Sr*"SS5r+\RX\&S 4Sj5r-SSjr.g)) annotationsN)_)binhexshort)errorlineloglockmdiffpycompatscmutilutil)hashutil stringutil)rrevmapc$URU5$N)file)repopaths nSUR;dM[ UR UR55UlM@ U$s snf)N_filelog) _changeidparentsr__dict__r_repor)ffollowplps r_parentsr%/s| KK B  4Avvx16683a 4QZZ'!!''16684AJ I5s %BBcUR5nURS5nU(aURS5(dUS- n[U5Vs/sHo0U4PM snU4$s snf)N r)datacountendswithrange)fctxtext linecountis r _decorater0Fs[ 99;D 5!I DMM%((Q %i 0 1 01AY 0 14 88 1s A#cLUHuup4pVnUS:XdMUSX4USXV&M U$)N=r)parentchildblocksa1a2b1b2ts r_pairr<Qs<%! 9$Qi.E!HRO & LrFcrU(a$[U[5(dUb [X5nOXnUc7UR5cXRnU$UR X%R5S9nU$XRnUS:XaUR 5nOUR 5nXuR5:waXvlXUlU$)a(repo, str, str) -> fctx get the filectx object from repo, rev, path, in an efficient way. if resolverev is True, "rev" is a revision specified by the revset language, otherwise "rev" is a nodeid, or a revision number that can be consumed by repo.__getitem__. if adjustctx is not None, the returned fctx will point to a changeset that introduces the change (last modified the file). if adjustctx is 'linkrev', trust the linkrev and do not adjust it. this is noticeably faster for big repos but is incorrect for some cases. )changeidlinkrev) isinstanceint _revsinglerevfilectxlinkrevintrorevr _changectx)rrCr resolverev adjustctxctxr,rFs r resolvefctxrK_s*S#..3?#i 779 9D K<<wwy<9D Ky  "||~H}}H wwy %N"nDO KrcURSS5RSS5RSS5RSS5$) Ns.hg/s.hg.hg/s.l/s.l.hg/s.m/s.m.hg/s.lock/s .lock.hg/)replacers r encodedirrOs9 Wj)  #  # L ) rc^[R"[U4Sj[RR 555n[ [R"U5R55SS$)Nc3h># UH'nU[T[R"U554v M) g7fr)getattrr sysstr).0kdiffoptss r hashdiffopts..s- ,(//!"45 6,s/2) rpprintsortedr rVdefaultsrrsha1digest)rV diffoptstrs` r hashdiffoptsr`sX"" ^^,,  J x}}Z(//1 22A 66rcr\rSrSr%SrSSSS.rS\S'S\S 'S\S 'S r\RSS j5r S r g) annotateoptszlike mercurial.mdiff.diffopts, but is for annotate followrename: follow renames, like "hg annotate -f" followmerge: follow p2 of a merge changeset, otherwise p2 is ignored NT)rV followrename followmergezmdiff.diffoptsrVboolrdrec URR5H up#[XURX#55 M" gr)r\itemssetattrget)selfoptsrUvs r__init__annotateopts.__init__s-MM'')DA DTXXa^ ,*rc2SnUR(dUS- nUR(dUS- nURbR[UR[R5(de[ UR5nU[ :waUSU-- nU=(d S$)z?represent opts in a short string, suitable for a directory namersr0sm0isdefault)rdrerVr@r r`_defaultdiffopthash)rkresult diffopthashs rshortstrannotateopts.shortstrs  eOF eOF == $dmmU^^<< <<&t}}5K11$,,##rr3)returnbytes) __name__ __module__ __qualname____firstlineno____doc__r\__annotations__rnr propertycacheru__static_attributes__r3rrrbrbsLH -  $ $rrbc\rSrSrSrSr\S5r\S5rSr \ r Sr \S5r SS jr SS jrS rSS jrSrSrSrSSjrSr\SSj5rSSjrSr\R6S5r\R6S5rSSjrSrg )_annotatecontextzsdo not use this class directly as it does not use lock to protect writes. use "with annotatecontext(...)" instead. cXlURUlX lXPlX0lX@lSUlSUl0Ulgr) ruirrl linelogpath revmappath_linelog_revmap _node2path)rkrrrrrls rrn_annotatecontext.__init__s< ''  &$  rc URc[RRUR5(a^[ URS5n[ RRUR55UlSSS5 UR$[ R"5UlUR$![ Ra [ R"5UlNjf=f!,(df  UR$=f)Nrb) rosrexistsropen linelogmodr fromdataread LineLogErrorrkr!s rr _annotatecontext.linelogs == ww~~d..//$**D1Q=(2(:(:(C(CAFFH(M 2}}!+ 2 2 4 }} &22=(2(:(:(< =21}}s*C42C.C1.C40C11C44 D c~URc%[R"UR5UlUR$r)r revmapmodrrrks rr_annotatecontext.revmaps, << $++DOO dll112! 77'' S%7( b Ay EBD=!ELLO IIKF -L= =QQq 1INI&DG ""$! r7a!$"2"23Q"@AF6:6,-FFH)]e` q) )A*4B)<) bool, fctx or node. return (True, f) if we can annotate without updating the linelog, pass f to annotatedirectly. return (False, f) if we need extra calculation. f is the fctx resolved from rev. TN)(cgrr3)xs r6_annotatecontext.canannotatedirectly..strr?)rIrH) r@rArxrrjrrr _perfhackr)rkrCrsr!hshrIs rr$_annotatecontext.canannotatedirectlys #s###&**3s8^DSICC#3t{{#B 9&*nn $I!!#t!LA++%Fdnn%%cTd%Kyrc URUSSS9nX@R;Ga-U/nSnUSnURU5nU(dO=USUR;aUSR5nOUR US5 M[[ R "5n U RUR 5 U RU R5 [R"5n U RUR5 [U5HAnUR5n [URXk55n URXX|5 U nMC OUR n URn U R5n UR!5nU R#U5nU VVs/sH!unnUU::dMU R%U5U4PM# nnnU(aUR'UU 5nU(aUR)UX5nUU4nU$s snnf)z(rev : str) -> [(node : str, linenum : int, path : str)] the result has the same format with annotate, but include all (including deleted) lines up to rev. call this after calling annotate(rev, ...) for better performance and accuracy. Trrrr)rrrr(rrr copyfromrrrreversedrr _doappendrev getalllinesrrr_addpathtoresult _resolvelines)rkrCrrrchainar!r#r rbr6linesrrrrrs linecontentss rannotatealllines!_annotatecontext.annotateallliness##CDD#I ++ %IEA"I%%a(a5DKK'1 A RU#!((*G   T\\ *   W^^ ,%%'F OODKK (e_FFHd..q45!!'1= %llG[[F##%llns#5:IUTQa5j(6>>!$a(UI **66:F --ffFLl+F Js  H.HcUVs/sHoBRUS5PM nnS/[U5-n[R"[5n[ [U55H nXuUXS4R U5 M" U(Ga3Sn UR5H;uupn URU 5[R-(aM1XSSn O U c0n UR5Huupn X;aXSSn URR(a)URRS[U 5X4-5 UR!XR#U 55n[$R&"UR)55nUX'U H nXUUU'M M [+SU55(deU$URRS[U 5-5 UR-W 5 UR!XR#U 55nUR.n[$R&"UR)55n[U5[U5:wa[0R2"S5e[5U5H'unnUUnUU;dMUUHnUUU'M UU M) U(aGM3U$s snf![a Us$f=f)a@(annotateresult) -> [line]. designed for annotatealllines. this is probably the most inefficient code in the whole fastannotate directory. but we have made a decision that the linelog does not store line contents. so getting them requires random accesses to the revlog data, since they can be many, it can be very slow. rNrs6fastannotate: reading %s line #%d to resolve lines %r c3(# UHoSLv M g7frr3)rTrs rrW1_annotatecontext._resolvelines..fs9&QD=&ss+fastannotate: annotate %s to resolve lines sunexpected annotated lines)rr collections defaultdictrr+rrhrev2flagrsidebranchflag StopIterationrrrrrrev2pathr splitnewlinesr(allrrfaerrorCorruptedFileErrorr)rkrrr rrevsrskey2idxsr/rrC_linenumidxsrevlineslinenumr,ridx annotatedlinerUs rr_annotatecontext._resolvelines;s/==nqt$n=#n--**40s6{#A 1g~034 5 < {,4NN,<(NSD*,!W5a877,, GGMM!9#(:w"=!> $00ooc6JK % 3 3DIIK @(- #&.mG&<s  $-=9&99999  GGMM?%*L    S !$$S//#*>?D..I'' 4E5zS^+001NOO$U+4aL='{&*s  +  ,Whb o>!   sKA KK KKcn[U[5(aUnOUR5nURR U5nU(d"[ R "S[U5-5eURRU5[R-S:wa"[ R "S[U5-5eURRU5 URRVVs/sH"upgURRU5U4PM$ nnnURXX#5$s snnf)zlike annotate, but when we know that f is in linelog. f can be either a 20-char str (node) or a fctx. this is for perf - in the best case, the user provides a node and we don't need to read the filelog or construct any filecontext. s%s is not in revmaprs%s is not in revmap mainbranch)r@rxrrrrrrrrr r rrrr) rkr!rrrrrrrss rr!_annotatecontext.annotatedirectly|s a  C&&(C ##C(,,-Cc#h-NO O KK  ')*B*B Bq H,,1CH<  e$48LL4O4O 4ODAT[[  #Q '4O  ))&XII s3)D1cU(aURU5nU(a[U[5(aFURR U5nUR X RR U55nOUn[R"UR55n[U5[U5:wa[R"5eX4nU$)z^add the missing path or line contents, they can be expensive. f could be either node or fctx. ) rr@rxrrrr r r r(rrr)rkrsr!rrrr,rs rr&_annotatecontext._refineannotateresults **62F !U## ++A.((KK,@,@,GH'' 4E5zS[(0022_F rcTURURURXU5 gr)rr r)rkr,r6rs rr_annotatecontext._appendrevs $,, T:NrcX[R"XURR5$r)r allblocksrlrV)rkrrs rr_annotatecontext._diffblockssqTYY%7%788rc ^U4Sjn/n0nUbJUHDuuppn U S:wdMUXJU V Vs/sHup[U [5(aMU PM snn - nMF [U5nX&;aURU5 UH n U"U 5X}'M TR UR 5UR 5S9nXU'[U5Hquuppn U S:XaMUcURXXU 5 M)XJU VVs/sH$unn[U[5(aUOUUU4PM& nnnURXU U5 Ms gs snn fs snnf)z'append a revision to linelog and revmapc>[U[5(a[R"S5eUR 5nTR U5nUcTR USUR5S9nU$)z (fctx) -> intsf should not be an intT) sidebranchr)r@rArProgrammingErrorrrrr)r!rrCrs rgetllrev/_annotatecontext._doappendrev..getllrevsa!S!!,,-FGG&&(C..%C{mmCDqvvxmHJrNr2rN) r@rArremoverrrr replacelinesreplacelines_vec)r rr,r6rr'siderevs siderevmapr7r8r9r:opr!rrrbliness ` rr_annotatecontext._doappendrevs`   !(.$ ":$."$5!$5DA)!S1$5!H)/x=   OOD !A$QKJM diik < 4$,V$4 RRbTz!$$U;!+b 1 11&a--a:a=1E 1((B?%5!*sD> D> 8+Ec |^^Tc TRmUU4SjnUVVs/sHupEXEU"U54PM snn$s snnf)z6(revmap, [(node, linenum)]) -> [(node, linenum, path)]c>TRRU5nUc/TRTRU55nUTRU'U$r)rrjr r)nodeidrrrks r_getpath3_annotatecontext._addpathtoresult.._getpathsF??&&v.D|v~~f'=>*.'Kr)r)rkrrr4nrs` ` rr!_annotatecontext._addpathtoresults; >[[F 1??x{#???s8cUcSnOEURRUR55nU(d[R"5eUR R U:wa[R"5eg)z:check if fctx is the master's head last time, raise if notNr)rrrrCannotReuseErrorr r)rkr,rs rr%_annotatecontext._checklastmasterheads^ <EKK'' 4E..00 <<  % '**, , (rcp^^URRmURRmUU4SjnU$)z-> (fctx) -> [fctx]c4>[UTS9nT(dUSSnU$)N)r"r)r%)r!r#rerds rr-_annotatecontext._parentfunc..parentss"!L1BVIr)rlrdre)rkrrerds @@rr_annotatecontext._parentfuncs/yy-- ii++   rc:URRSS5$)N fastannotatesperfhack)r configboolrs rr_annotatecontext._perfhacksww!!/;??rc V[URX=(d UR40UD6$r)rKrr)rkrCrkwdss rr_annotatecontext._resolvefctxs!499c,=DIIG$GGr) rrrrrlrrrrT)NFF)FFr) ryrzr{r|r}rnpropertyr rr__del__rrrrrrrrrrr staticmethodrrrrrrrrrr3rrrrs    !G: ==!F@PD.6p?BJ.$O9/@/@b @ -    @@HrrcfUHn[R"U5 M g![a M,f=f)zsilent, best-effort unlinkN)runlinkOSError)pathsrs rrr s1  KK    s " 00cZ\rSrSrSr\4Sjr\S5r\S5r Sr \S5r Sr g ) pathhelperiz9helper for getting paths for lockfile, linelog and revmapc[RRSUR[ U55UlXlg)Nr@)rrjoinrurO_vfspathr )rkrrrls rrnpathhelper.__init__s, T]]IdO   rc[RRURRR UR 55$r)rrdirnamer vfsrQrRrs rrUpathhelper.dirnames,wwtzz~~224==ABBrcfURRRURS-5$)Ns.lr rVrQrRrs rrpathhelper.linelogpath#$zz~~""4==5#899rcr[R"URRURS-5$)Ns.lock)lockmodr r rVrRrs rr pathhelper.lock's$||DJJNNDMMH,DEErcfURRRURS-5$)Ns.mrYrs rrpathhelper.revmappath*r[r)r rRN) ryrzr{r|r} defaultoptsrnrGrUrr rrr3rrrOrOsQC(3CC::F::rrOc## [XU5n[R"UR5 URnUR nSnUR 5 [XXeU5nU(aUR5 Uv SSS5 UbUR5 gg!,(df  N#=f![a3 UbUR5 URRSU-5 ef=f!UbUR5 ff=f7f)acontext needed to perform (fast) annotate on a file an annotatecontext of a single file consists of two structures: the linelog and the revmap. this function takes care of locking. only 1 process is allowed to write that file's linelog and revmap at a time. when something goes wrong, this function will assume the linelog and the revmap are in a bad state, and remove them from disk. use this function in the following way: with annotatecontext(...) as actx: actx. .... Ns+fastannotate: %s: cache broken and deleted ) rOrmakedirsrUrrr rr Exceptionrrr)rrrlrhelperrractxs rannotatecontextrg/s D )FMM&..!""J$$K D  [[]#D ND J    JJL ]    LLN  ELM    JJL sNAD  B1)B B1 D  B.*B1-C1.B11=C..C11DD cURnURnURRSSS5(aSn[ X!S9n[ XEXc5$)z\like annotatecontext but get the context from a fctx. convenient when used in fctx.annotate r@s forcefollowT)rVrd)r _pathrrArbrg)r,r"rVrrraoptss rfctxannotatecontextrkTsK ::D ::D ww/>4@@ ( @E 4u 66rrF)FN)TNF)/ __future__rr contextlibrmercurial.i18nrmercurial.noderrr mercurialrr rr r]r r r rmercurial.utilsrrrrr lrucachefuncrr%r0r< revsinglerBrKrOr`rarrrbrrrOcontextmanagerrgrkr3rrrvs#    .9  w00 1 )Z7#5#4#45"$"$Jn HHD::4 %0%!!H 7r