^cY,ddlZddlZddlZddlZddlmZddlmZmZm Z ddl m Z ddl m Z mZmZmZmZmZm Z mZmZddlmZmZddlmZejd ZejZd Zd Z d Z!Gd dZ"GddZ#dZ$dZ%hdZ&GddZ' ej(Z'n #e)$rYnwxYwej*ej+GddZ,d6dZ-dZ.dZ/dZ0dZ1ej*ej+GddZ2Gdd ej3Z4d!Z5Gd"d#e6Z7ej*ej8Gd$d%Z9ej*ej:Gd&d'Z;ej*ej<Gd(d)Z=ej*ej>Gd*d+Z?ej*ej<Gd,d-Z@ej*ej>Gd.d/ZAGd0d1e2ZBGd2d3eAZCGd4d5e9ZDdS)7N)_)binhexnullrev)getattr) encodingerrormatchmdiffpathutilpolicypycompatrevlogutil) repositoryr) constantsparsersic#K|r|dddkrtdd}|D]}|||krtd|}|d\}}t|}|dd}|tvr|dd}|dz}nd}|d|zkrtd |t ||fVdS) N "Manifest did not end in a newline.#Manifest lines not in sorted order.rInvalid manifest line) ValueError splitlinessplitlen_manifestflagsr)nodelendataprevlfnnlflagss 4/usr/lib/python3/dist-packages/mercurial/manifest.py_parser,/s   @RSS U"">??? D __    qCDD Dwwu~~1 VV"## N " "#2#A !GBBE W  566 6Qrcg}g}|D]C\}}}|||d|t||fzDt|d|S)N%s%s%s r)appendr_checkforbiddenjoin)itfileslinesr'r(fls r+_textr6Jsv E E661b Q  ]aQ_45555E 88E??rc$eZdZdZdZdZeZdS)lazymanifestiterc"d|_||_dSNr)poslmselfr<s r+__init__zlazymanifestiter.__init__Xsrc|SNr>s r+__iter__zlazymanifestiter.__iter__\ rc |j|j\}}n#t$rtwxYw|dkr|xjdz c_|dS|xjdz c_|d|}|||S)Nrrrr)r<_getr; IndexError StopIterationfind)r>r$r;zeroposs r+nextzlazymanifestiter.next_s  TX..ID##     "99 HHMHH7N A ))GS))CK  "%7N__name__ __module__ __qualname__r?rDrL__next__rBrr+r8r8WsB ! ! !HHHrr8c$eZdZdZdZdZeZdS)lazymanifestiterentriesc"||_d|_dSr:)r<r;r=s r+r?z lazymanifestiterentries.__init__osrc|SrArBrCs r+rDz lazymanifestiterentries.__iter__srErcv |j|j\}}n#t$rtwxYw|dkr|xjdz c_|S|d|}|d|}|dks |dks||krt jd||dz |}|tvr ||z dz }n ||z dz }d}|d|jj zkrt jdt||jj |j|dz|}|xjdz c_|||||fS)Nrrrrrrr) r<rGr;rHrIrJr StorageErrorr"_nodelen unhexlify extrainfo)r>r$r;rKnlposr*hlenhashvals r+rLzlazymanifestiterentries.nextvsh  TX..ID##     "99 HHMHHK))GS)) %%% b==ERKK57??$%=>> >UQY&' N " "7?Q&DD7?Q&DE 1tw'' ' '$%=>> > $'#DH-w{D   A S[!7E22rMNrNrBrr+rTrTnsB3334HHHrrTcht||||z}|r|t|dzz }|S)N)rchr)r$extrar;lengthss r+rZrZs@ DsV|# $%%A  S   Hrc||k||kz SrArB)abs r+_cmprhs Ea!e r>rltxceZdZdZ ddZdZdZdZdZd Z d Z d Z d Z d Z dZdZdZdZddZdZdZdZdZdZdS) _lazymanifestaA pure python manifest backed by a byte string. It is supplimented with internal lists as it is modified, until it is compacted back to a pure byte string. ``data`` is the initial manifest data. ``positions`` is a list of offsets, one per manifest entry. Positive values are offsets into ``data``, negative values are offsets into the ``extradata`` list. When an entry is removed, its entry is dropped from ``positions``. The values are encoded such that when walking the list and indexing into ``data`` or ``extradata`` as appropriate, the entries are sorted by filename. ``extradata`` is a list of (key, hash, flags) for entries that were added or modified since the manifest was created or compacted. NFc*||_|N|||_dgt|jz|_||_g|_d|_dS|dd|_|dd|_|dd|_||_||_dS)NrF)rY findlines positionsr!r[r$ extradata hasremovals)r>r#r$rpr[rqrrs r+r?z_lazymanifest.__init__s   !^^D11DNS3t~#6#66DNDIDN$D   &qqq\DN&qqq\DN&qqq\DNDI*D   rc|sgS|d}|dks|dddkrtddg}|d|d}|t|dz kr|dkr||dz||dz|d|dz}||krtd|}|d|dz}|t|dz kr|dk|S)Nrrrrrrr)rJrr!r/)r>r$r;rpr%nextss r+roz_lazymanifest.findliness" Iii "99RSS U**BCC CC (dii((()CIIM!!cRii   S1W % % %q499WcAg#>#>>?Et|| !GHHHD))E37++C CIIM!!cRiirc`|j|}|dkr |j|fS|j| dz dfS)Nrrr)rpr$rq)r>indexr;s r+rGz_lazymanifest._gets=nU# !889c> !~sdQh'++rc|dkr+|j||jd|dzS|j| dz dS)Nrrr)r$rJrq)r>r;s r+_getkeyz_lazymanifest._getkeysI !889S49>>'37#C#CCD D~sdQh'**rcd}t|jdz }||krY||zdz}|j|}||}t||}|dkr|S|dkr|dz }n|dz}||kYdS)Nrrrrr!rprxrhr>keyfirstlastmidpointnextpos candidaters r+bsearchz_lazymanifest.bsearchs4>""Q&tmm *HnX.G W--IS)$$AAvvq55#a""Q&tmm *HnX.G W--IS)$$AAvv $''q55#ar|s r+ __contains__z_lazymanifest.__contains__s||C  B&&rct|tstd||}|dkrt||\}}|dkr|d|dfS|d|}|d|}d|cxkrt|jksnJt|j t|jksJ|dks |dks||krtj d||z dz }||dz |}|tvr|dz}nd }|d|j zkrtj dt||j ||dz|} | |fS) Ns'getitem: manifest keys must be a bytes.rrrrrrrr) isinstancebytes TypeErrorrKeyErrorrGrJr!rpr[r rXr"rYrZ) r>r|needler$r;rKr\r]r*r^s r+ __getitem__z_lazymanifest.__getitem__s#u%% HFGG Gc"" R<<NIIf%% c "99GT!W% %))GS)) %))F1111c$.111111114>""c$.&9&99999 b==ERKK57??$%=>> >w"UQY&' N " " AIDDE 1t}$ $ $$%=>> >D$."8'A+tLLrcp||\}}|st|j|}|jd||j|dzdz|_|jd||j|dzdz|_|dkr3|jd|dz|j|dzdz|_d|_dSdS)NrrrT)rrrpr[r$rr)r>r|rfoundcurs r+ __delitem__z_lazymanifest.__delitem__,s c**  NnV$04>&1*,,3OO04>&1*,,3OO !88 $3$'1DIcAgii4HHDI#D    8rct|tstdt|trt |dkrtd|d}t|trt |dvrtd|d}t|trt |dkrtd|||\}}|rn|j|}|dkr|||df|j| dz <dS|j|||dft |j |j|<dS|j|||df|jd|t |j gz|j|dz|_|j d|dgz|j |dz|_ dS) Ns-setitem: manifest keys must be a byte string.rs1Manifest values must be a tuple of (node, flags).r s-node must be a 20-byte or 32-byte byte stringrs'flags must a 0 or 1 byte string, got %r) rrrtupler!rrprqr/r[)r>r|valuer^r*rrr;s r+ __setitem__z_lazymanifest.__setitem__9s#u%% NLMM M%'' 3u::??D ('5)) NS\\-I-ILMM Ma%'' O3u::>>FNN N c**   .(CQww,/%(+Ctax(((%%sGU1X&>???*-dn*=*=)=v&&& N ! !3q": ; ; ;ww''''().)* N ww'1#-vww0GG NNNrcft|j|j|j|j|j|jSrA)rmrYr$rpr[rqrrrCs r+copyz_lazymanifest.copy\s3 M I N N N      rczt|jdkr |jsdSg}d}d}dgt|jz|_|t|jkr5|j|dkr|j|}|} ||j|<|dz }|t|jks|j|dkrnT|jr,|jd||j|dkrn!||j||z z }|j|}|jd|}|dkr|dz }|||z z }||j||n|t|jkr|j|dkr|j|}|j| dz }|||||j|<d}t|ddkrd }t|d|kr&t|d|dz|j|<|t|dz }|dz }|t|jkr|j|dk|t|jk5d ||_d |_g|_dS) NrTrs rrrrrF) r!rqrrrpr[r$rJr/_packordr1) r>r&ioffsetrlast_cutend_cuttr]s r+_compactz_lazymanifest._compactgs t~  ! # #D,< # F  s4>222#dn%%%%~a A%%nQ' ,(.DN1%FAC////4>!3Dq3H3H( INN9c4>!;LMMdnQ/#55F.+C%,&)..44b==qLG'C-'8G#345555#dn----$.2Ca2G2G.+Ctax0AHHTZZ]]+++(.DN1%D1Q4yy2~~!1Q4yy4'',/!TAX,?,?q)c!B%jj(FFA#dn----$.2Ca2G2GC#dn%%%%^HHQKK  rc|d}t|dvsJ|ddzt|z|dzdzS)Nrrrrrr)r!r)r>dr(s r+rz_lazymanifest._packsI aD1vv!!!!tg~A&1-55rc8||jSrA)rr$rCs r+textz_lazymanifest.texts yrci}|D]5\}}}||vr ||fdf||<||}||f|kr ||f|f||<.|rd||<6|D]\}}}||vr d||ff||<|S)z2Finds changes between the current manifest and m2.NrN) iterentries)r>m2cleandifffne1r*e2s r+rz_lazymanifest.diffs!--// $ $MBE||; 3RV;"$$ "E{BDHH$#DH^^-- 4 4MBE~~&U 3R rc t|SrA)rTrCs r+rz_lazymanifest.iterentriess&t,,,rc t|SrAr8rCs r+iterkeysz_lazymanifest.iterkeys%%%rc t|SrArrCs r+rDz_lazymanifest.__iter__rrc*t|jSrA)r!rprCs r+__len__z_lazymanifest.__len__s4>"""rct|jd}|D]\}}}||r||f||<|Sr)rmrYr)r>filterfncr'r(r5s r+ filtercopyz_lazymanifest.filtercopysW $- - -((**  HAq"x{{ "u!r)NNNFF)rOrPrQ__doc__r?rorGrxrrrrrrrrrrrrrrDrrrBrr+rmrmsd*++++.",,,+++ $('''   4 $ $ $!!!F    999v666 *---&&&&&&###rrmceZdZd dZdZdZdZdZeZdZ dZ d Z d Z d Z d Zd!dZedZdZdZdZdZdZd"dZdZd!dZdZdZdZdZdZdZdZ d S)# manifestdictrc>||_t|||_dSrA)rYrm_lm)r>r#r$s r+r?zmanifestdict.__init__s  $//rc(|j|dSr:rrs r+rzmanifestdict.__getitem__sx}Qrc|j|SrArrs r+rJzmanifestdict.findsx}rc*t|jSrAr!rrCs r+rzmanifestdict.__len__s48}}rc2t|jdkSr:rrCs r+ __nonzero__zmanifestdict.__nonzero__s48}}!!rcD|||f|j|<dSrA)r*r)r>r|nodes r+rzmanifestdict.__setitem__s djjoo- rc|dS||jvSNFrrs r+rzmanifestdict.__contains__s ;5dhrc|j|=dSrArrs r+rzmanifestdict.__delitem__s HSMMMrc4|jSrA)rrDrCs r+rDzmanifestdict.__iter__x  """rc4|jSrA)rrrCs r+rzmanifestdict.iterkeysrrcDt|SrAlistrrCs r+keyszmanifestdict.keysDMMOO$$$rNc|Ytj|d}t|fd||DSfd|DS)7Set of files in this manifest that are not in the otherNcdSrArB)pathmsgs r+z)manifestdict.filesnotin..strch|]}|v| SrBrB).0r'sm2s r+ z*manifestdict.filesnotin.. s@@@!1C<. s///a1B;;;;;r)matchmodbadmatchsetwalk)r>rr rs ` @r+ filesnotinzmanifestdict.filesnotinsw  %e-C-CDDEbggenn%%C@@@@tyy//@@@ @////4////rc*tj|SrAr dirsrCs r+_dirszmanifestdict._dirs }T"""rc|jSrArrCs r+rzmanifestdict.dirs zrc||jvSrAr)r>dirs r+hasdirzmanifestdict.hasdirsdj  rc|}t|dkoB|p.|ot fd|DS)znChecks whether we can correctly and quickly iterate over matcher files instead of over manifest files.dc3 K|]}|vV dSrArB)rrr>s r+ z.manifestdict._filesfastpath..s'&B&BbrTz&B&B&B&B&B&Br)r3r!isexactprefixall)r>r r3s` r+_filesfastpathzmanifestdict._filesfastpathsh 5zzC MMOO D B3&B&B&B&BE&B&B&B#B#B rc#K|rt|D]}|VdSt|}||rt |D] }||vr|V dS|D]*}||vr||||r|V+|dt |D]-}||s| |d.dS)zGenerates matching file names. Equivalent to manifest.matches(match).iterkeys(), but without creating an entirely new manifest. It also reports nonexistent files by marking them bad with match.bad(). Nr) alwaysiterrr3rsortedremovediscardrbadr>r r'fsetrs r+rzmanifestdict.walk s2 <<>> $ZZ   F5;;==!!   u % % Tll  ::HHH F  BTzz BuRyy  S,, $ $B;;r?? $ "d### $ $rcv|r|S||rHt|j}|j}|D]}||vr|||j|<|St|j}|j||_|S)z6generate a new manifest filtered by the match argument)rrrrrYrr3r)r>r mr<rs r+_matcheszmanifestdict._matchesEs <<>> 99;;    u % % T]++ABkkmm ' '88 "2AE"IH  ' '##E**rFc|rA||}||}|||S|j|j|S)zFinds changes between the current manifest and m2. Args: m2: the manifest to which this manifest should be compared. clean: if true, include files unchanged between these manifests with a None value in the returned dictionary. The result is returned as a dict with filename as key and values of the form ((n1,fl1),(n2,fl2)), where n1/n2 is the nodeid in the current/other manifest and fl1/fl2 is the flag in the current/other manifest. Where the file does not exist, the nodeid will be None and the flags will be the empty string. r)r rr)r>rr rm1s r+rzmanifestdict.diffVs\  ,u%%BU##B772U7++ +x}}RVU+++rcZ|tvrtd|||f|j|<dS)NInvalid manifest flag set.)r"rr)r>r|flags r+setflagzmanifestdict.setflagks3 ~ % %9:: :S 4 rcN |j|dS#t$r|cYSwxYwr:rr)r>r|defaults r+getzmanifestdict.getps< 8C=# #   NNN s  $$cL |j|dS#t$rYdSwxYw)Nrrrrs r+r*zmanifestdict.flagsvs: 8C=# #   33 s  ##cjt|j}|j|_|SrA)rrYrr)r>rs r+rzmanifestdict.copy|s'  ' ' rcHd|jDS)Nc3*K|]}|ddVdSNrrBrxs r+rz%manifestdict.items..*66!"1"666666rrrrCs r+itemszmanifestdict.items$66tx33556666rcHd|jDS)Nc3*K|]}|ddVdSrrBrs r+rz)manifestdict.iteritems..rrrrCs r+ iteritemszmanifestdict.iteritemsr rc4|jSrArrCs r+rzmanifestdict.iterentriessx##%%%rc4|jSrA)rrrCs r+rzmanifestdict.textsx}}rchg}d}d}dg}d}tj|}t|}t|tkr|D]\} } t || |\}} | s&|j| \} } d| t| | fz}n'|| krttd| zd}|,||kr&||kr || kr| }|r| ||+| ||d |g|}| }|g}|+| ||d |gt||\}}nZt|}tjtj|tj|}||fS)zGiven a base manifest text as a bytearray and a list of changes relative to that text, compute a delta that can be used by revlog. Nrrr.s!failed to remove %s from manifest)rbufferrr!FASTDELTA_TEXTDIFF_THRESHOLD_msearchrrAssertionErrorrr/r1 _addlistdelta bytearrayrr textdiff)r>basechangesdeltadstartdenddlinestartaddbufr'todeleteendhr5r& deltatext arraytexts r+ fastdeltazmanifestdict.fastdeltasT""w-- w<<6 6 6 '  8%fa77 s  HQKEAr%CFFB7AA||,BCCaGA%&E//demmczz"( Q) fdCHHUOO%DEEE"FDCEE! fdCHHUOO<===#0u#=#= Iyy"$))++..I D!!4;y#9#9I)##rrrAr)!rOrPrQr?rrJrr__bool__rrrrDrrr propertycacherrrrrr rrrr*rrr#rrr;rBrr+rrs0000   """ H... ######%%%0000##]#!!!   #$#$#$J",,,,*(((    777777&&&5$5$5$5$5$rrc fd}|s||fSt |s }||kr||zdz}|}|dkr-|dz |dkr|dz}|dkr|dz |dk||d}t|||kr||dzddz}n|}||k||d}||}||kr||dzd}||dzfS||fS)aEreturn a tuple (start, end) that says where to find s within m. If the string is found m[start:end] are the line containing that string. If start == end the string was not found and they indicate the proper sorted insertion point. m should be a buffer, a memoryview or a byte string. s is a byte stringcn|kr-||dz|kr|dz }|kr||dz|k|S)NrrB)rrlenmrs r+advancez_msearch..advancesQ$hh1QQY<1,, FA$hh1QQY<1,,rrrrrr()r!r) rrdlohirBmidr4r7rrAs ` @r+r)r)sf Bx q66D   r''Bw1naiiAeai%/0E99 QJEaiiAeai%/0E99geU## 59   " "r5))A-BBB r'' '"e  C bfIEEzzgcBh&&C!G}Bxrc|D]@}d|vsd|vr6tjtdtj|zAdS)z'Check filenames for illegal characters.r s)'\n' and '\r' disallowed in filenames: %rN)r rXrrbytestr)r&r's r+r0r0se  A::!$@AA"1%%& $rcd}t}|D])\}}}||||z }|r|t|z }|}*|||dz }dd|D}||fS)Nrrc 3lK|]/\}}}tjd||t||zV0dS)s>lllN)structpackr!)rr4r7contents r+rz _addlistdelta.. sW E3  GUCW66@r)r,r1)addlistrcurrentposition newaddlistr4r7rNr9s r+r+r+sOJ sGgoe344  - )G,, ,J'/**++J#$I j  rcRd|vr |dd\}}|dz|fSd|fS)N/rr)r )r'rsubpaths r+ _splittopdirrUs: qyywwtQ'' WTz7""Av rcdSrArB)rds r+rrs$rcXeZdZd1dZdZdZdZdZdZdZ d Z e Z d Z e jd Zd Zd ZdZdZdZeZdZdZdZdZd2dZdZdZdZdZdZdZ dZ!dZ"d2dZ#e$d Z%d!Z&d"Z'd#Z(d$Z)d%Z*d&Z+d'Z,d3d)Z-d*Z.d+Z/d,Z0d-Z1d.Z2d/Z3d2d0Z4dS)4 treemanifestrc$||_||_|jj|_|jj|_t |_t |_d|_ i|_ i|_ i|_ i|_ |r"d}|||d|_ dSdS)NFc td)Ns4treemanifest constructor only accepts flat manifests)r*)subdirsubms r+ readsubtreez*treemanifest.__init__..readsubtree/s$KrT)_dir nodeconstantsnullid_noder#rY_noop _loadfunc _copyfunc_dirtyr _lazydirs_files_flagsparse)r>r_rrr]s r+r?ztreemanifest.__init__ s *'. *2          JJt[ ) ) )DKKK  rc|j|zSrAr^)r>rs r+_subpathztreemanifest._subpath7sy4rc|j}|j}|jD]N\}\}}}|r+||||||<6||||||<Oi|_dSrA)rrlrfrr)r>selfdirsrTrrr]docopys r+ _loadalllazyztreemanifest._loadalllazy:s:-.2n.B.B.D.D < < *A*k6 <)k''!**d;;@@BB )k''!**d;; rc$|j|}|rs|\}}}|r:|||||j|<n'|||||j|<|j|=dSdSrA)rfrrlrr)r>rvrr]ros r+ _loadlazyztreemanifest._loadlazyDs N  q ! !  "() %D+v D + DMM!,<,visitloadlazyks r+_loadchildrensetlazyz!treemanifest._loadchildrensetlazyNsk 4 F??ew..      4>  A HQX     rcg}|jD]H\}}|j|}|r|d|dkr||I|jD]#\}}||jvr||$|D],}||||-dS)amload items in t1 and t2 if they're needed for diffing. The criteria currently is: - if it's not present in _lazydirs in either t1 or t2, load it in the other (it may already be loaded or it may not exist, doesn't matter) - if it's present in _lazydirs in both, compare the nodeid; if it differs, load it in both rN)rfrrr/rs)r>t1t2 toloadlazyrv1v2s r+ _loaddifflazyztreemanifest._loaddifflazyZs \'')) % %EAr!!!$$B %A"Q%!!!$$$\'')) % %EAr $$!!!$$$  A LLOOO LLOOOO  rc|t|j}||jD]}||z }|SrA)_loadr!rgrprvaluesr)r>sizers r+rztreemanifest.__len__psf 4; ""$$  A AIIKK DD rc,| SrA_isemptyrCs r+rztreemanifest.__nonzero__xs==??""rcB||js7|jr2td|jDrdS||j p/t d|jDS)Nc3@K|]}| VdSrArrrs r+rz(treemanifest._isempty..s-MMA1::<</MMMMMMrFc3>K|]}|VdSrArrs r+rz(treemanifest._isempty..s*$O$OaQZZ\\$O$O$O$O$O$Or)rrgranyrrprrCs r+rztreemanifest._isempty~s ;  J MM9J9J9L9LMMMMM 5 :~O$O$O4:;L;L;N;N$O$O$O!O!OOrcd|jt|jt|jt u|jt|fzS)Ns;)r^rraboolrcrbreidrCs r+__repr__ztreemanifest.__repr__sG K DJT^u,-- 4   rc|jS)z}The directory that this tree manifest represents, including a trailing '/'. Empty string for the repo root directory.rkrCs r+rztreemanifest.dirs yrc"|jrJ|jS)zThis node of this instance. nullid for unsaved instances. Should be updated when the instance is read or written from a revlog. rerarCs r+rztreemanifest.nodes;zrc"||_d|_dSr)rarer>rs r+setnodeztreemanifest.setnodes  rc#K||ttj|j|jD]]\}}||jvr4||||j |dfVB| D]}|V^dSr) rrpr itertoolschainrrrgrlrhrr)r>pr(rs r+rztreemanifest.iterentriess   ODJ,,.. 0A0A0C0C D D    DAqDKmmA&&4;??1c+B+BBBBBBAGGGG   rc#K||ttj|j|jD]H\}}||jvr|||fV(|D] \}}||fV IdSrA) rrprrrrrrgrl)r>rr(r'sns r+rztreemanifest.itemss   ODJ,,.. 0A0A0C0C D D    DAqDKmmA&&)))))WWYY  EArR%KKKK   rc#"K||ttj|j|jD]7}||jvr||V#|j|D]}|V8dSrA)rrprrrrrgrl)r>rr's r+rztreemanifest.iterkeyss    DK@@AA  ADKmmA&&&&&&AAGGGG   rcDt|SrArrCs r+rztreemanifest.keysrrc*|SrA)rrCs r+rDztreemanifest.__iter__s}}rc|dS|t|\}}|r@||||jvrdS|j||S||jvSr)rrUrsrrrgr>r'rrTs r+rztreemanifest.__contains__s{ 95 #A W  $ NN3   $*$$u:c?//88 8 # #rNc |t|\}}|rA||||jvr|S|j|||S|j||SrA)rrUrsrrrg)r>r'rrrTs r+rztreemanifest.gets| #A W  / NN3   $*$$:c?&&w88 8;??1g.. .rc|t|\}}|r5|||j||S|j|SrA)rrUrsrrrgrs r+rztreemanifest.__getitem__s^ #A W  " NN3   :c?..w77 7;q> !rc0|t|\}}|r@||||jvrdS|j||S||jvs ||jvrdS|j|dSr)rrUrsrr*rfrhrrs r+r*ztreemanifest.flagss #A W  + NN3   $*$$s:c?((11 1DN""a4:oos;??1c** *rc |t|\}}|r5|||j||S|j||j|dfSr)rrUrsrrJrgrhrrs r+rJztreemanifest.findss #A W  ; NN3   :c?''00 0;q>4;??1c#:#:: :rcP|t|\}}|r]|||j|||j|r|j|=n|j|=||jvr|j|=d|_dSNT) rrUrsrrrrgrhrers r+rztreemanifest.__delitem__ s #A W  # NN3    JsO ' ' 0 0 0z#'')) $JsO ADKKN rc|J|t|\}}|rp||||jvr0t |j|||j|<|j|||nt|dvsJ||j |<d|_ dS)NrT) rrUrsrrXr_rlrr!rgre)r>r'r(rrTs r+rztreemanifest.__setitem__s}}} #A W   NN3   $*$$".& c(:(:## 3 JsO ' ' 3 3 3 3 q66X%%%%DKN rc|jtur!|jtc}|_||dS|jtur!|jtc}|_||dSdSrA)rcrbrd)r>lfcfs r+rztreemanifest._load/sf > & &!% B BtHHHHH ^5 ( (!% B BtHHHHH) (rc|tvrtd|t|\}}|rp||||jvr0t |j|||j|<|j| ||n ||j |<d|_ dS)z/Set the flags (symlink, executable) for path f.rTN) r"rrrUrsrrXr_rlrrhre)r>r'r*rrTs r+rztreemanifest.setflag7s  & &9:: : #A W  # NN3   $*$$".& c(:(:## 3 JsO # #GU 3 3 3 3"DKN rctjj}j|_j|_jt ur'fd}jt ur ||n||_n j|_|S)NcdjD|_|j}jD]\}}|||<t j|_t j|_dS)Nc(i|]\}\}}}|||dfSTrB)rrr(rrs r+ z8treemanifest.copy.._copyfunc..Ps7(49Aq!A1d|r)rrfrrrdictrgrh)rdsdirsrrrr>s r+rdz$treemanifest.copy.._copyfuncNs 8<8L8L8N8N  J,,..((DAq vvxxE!HH99T[1199T[11r)rXr_r^rarerdrbrc)r>rrds` r+rztreemanifest.copyHsD. ::Z k >U " " 2 2 2 2 2~&& $!*!^DN rc|rS|s?|}||}||Stfd|S)rc |j|jkr|js |jsdS|||||jD]O\}}||jvr|j|}||(|P|jD]3}||jvr( | |4dSrA) rarerrrrupdaterrgaddrl) r|r}rr rr _filesnotinr3r>s r+rz,treemanifest.filesnotin.._filesnotinjsx28##BI#bi# HHJJJ HHJJJ   r2 & & &)) 0 02==!BKB''''LL////i / /RY&&IIbkk"oo... / /r)rr rr)r>rr r rr3s` @@r+rztreemanifest.filesnotinas  % %u%%BU##B==$$ $ / / / / / / /"  D" rc*tj|SrArrCs r+_alldirsztreemanifest._alldirs~rrc|jSrA)rrCs r+rztreemanifest.dirss }rc|t|\}}|r@||||jvr |j||SdS|dz}||jvp||jvS)NFrS)rrUrsrrrf)r>rtopdirr[dirslashs r+rztreemanifest.hasdirs %c**   NN6 " " "##z&)008885:4:%CT^)CCrc#K|rt|D]}|VdSt|}||D]}||vr|||V |dt|D]-}||s| |d.dS)zxGenerates matching file names. It also reports nonexistent files by marking them bad with match.bad(). Nr) rrrr3_walkrrrrrrs r+rztreemanifest.walks <<>> $ZZ   F5;;==!!**U##  BTzz BHHHH S,, $ $B;;r?? $ "d### $ $rc#K||jdd}|sdS|||}t t |jt |jzD]e}||jvr%||}||r|V0|r |dd|vr'|j| |D]}|VfdS)z5Recursively generates matching file names for walk().Nr) visitchildrensetr^rrzrrrrgrlr)r>r rwrfullpr's r+rztreemanifest._walks &&ty"~66  F ))%00TZ((4 +<+<<==  ADK a((5<< KKK #2#%!Z]0077    rc||r|S||S)zCrecursively generate a new manifest filtered by the match argument.)rr_matches_inner)r>r s r+r ztreemanifest._matchess4 <<>> 99;; ""5)))rc&|r|S||jdd}|dkr|St |j|j}|s|S||jD]a}|dkr||vr ||}||s.|j||j|<||j vr|j ||j |<b| |}|j D]G\}}|r |dd|vr| |}|s ||j |<H|sd|_|S)NrrurvT)rrrr^rXr_rrgrlrhrzrrrrre) r>r rwretrrrr\rs r+rztreemanifest._matches_inners <<>> 99;; &&ty"~66 F??99;; 4-ty99 J + 1 1B BeOOMM"%%E5<< ![_CJrNT[  !%R 2))%00))++ # #IC SbS..##E**A::<< #!" #||~~ CJ rctrA)FastdeltaUnavailable)r>r.r/s r+r;ztreemanifest.fastdeltas"$$$rFcf |rU|sA|}||}||Si tj  fd}g}||||r&|\}}|||||& S)r r c |j|jkr|js |jsdS|||||jD]7\}}|j| }|||f8|jD]%\}}||jvr| |f&|jD]\}}|j |d}|j|d} |j |d} || ks|| kr||f| | ff | |< rd | |<|jD]E\}} ||jvr7|j |d} d| | ff | |<FdS)zicompares two tree manifests and append new tree-manifests which needs to be compared to stackNrr) rarerrrrrr/rgrhrl)r|r}stackrr rrn1fl1n2fl2r emptytreeresultr>s r+_iterativediffz)treemanifest.diff.._iterativediffsx28##BI#bi# HHJJJ HHJJJ   r2 & & &)) ' '2X\\!Y// b"X&&&&)) 2 22BH$$LL)R111)//++ 3 3BimmB,,Y]]2t,,immB,,88sczz02Cy2s).DF2;;r??++3.2F2;;r??+)//++ G GBRY&&)--C00C/:RI.FF2;;r??+ G Gr)rr rrXr_pop) r>rr rr rstacklsr|r}rrs ` ` @@r+rztreemanifest.diffs  , ,u%%BU##B772U7++ + !344  G G G G G G G G>tR))) ,[[]]FB N2r7 + + + , rcB|j o|j o|j|jkSrAr)r>rs r+unmodifiedsinceztreemanifest.unmodifiedsince,s#;Kry=KTZ285KKrc|j}t|j|D]R\}}}|dkr|dz}||df||<d|vr|||<|r|||<||j|<|r ||j|<SdS)NrjrSF)rfr,rYrrgrh)r>rr]selflazyr'r(r5s r+riztreemanifest.parse/s>t}d33 ( (HAq"TzzH !+u5  Q(LLB'''"# A(%'DKN' ( (rcl|t|S)z3Get the full data of this manifest as a bytestring.)rr6rrCs r+rztreemanifest.textFs) T%%''(((rcjdjD}fdjD}fdjD}t t||z|zS)zGet the full data of this directory as a bytestring. Make sure that any submanifests have been written first, so their nodeids are correct. c:g|]\}}|dd|ddfS)NrrrjrB)rrrrs r+ z(treemanifest.dirtext..Qs/LLLTQQssVQqT4(LLLrcJg|]}|ddj|jdf S)Nrrj)rra)rrr>s r+rz(treemanifest.dirtext..Rs1HHH3B3A,d3HHHrcBg|]}|j||fSrB)rg)rr'r*r>s r+rz(treemanifest.dirtext..Ss.DDD1!T[^UU1XX.DDDr)rr*rfrrrgr6r)r>lazydirsrr3r*s` @r+dirtextztreemanifest.dirtextKs  LLT^5I5I5K5KLLLHHHHTZHHHDDDDD DDDVD5L8344555rc$fd}||_dS)NcR|d|_dSr)rire)rdgettextr]s r+_load_for_readz)treemanifest.read.._load_for_readWs( GGGGII{ + + +AHHHr)rc)r>rr]rs `` r+readztreemanifest.readVs/      (rc  |||t|j fd}||jdd}||}|dks|dkrd}|jD]N\}}|r |dd|vr|||} |||} | |jjkr| | } } ||| | |OdS)Nc|j|}|r|dS|j|jSr:)rfrrra)rrldrs r+getnodez+treemanifest.writesubtrees..getnodecs@##B !u 7;;q),,2 2rrrvru) rrXr_rr^rzrrr`) r>r r writesubtreer rrwrr\subp1subp2rs @r+ writesubtreesztreemanifest.writesubtrees]s6      !344  3 3 3 3 3&&ty"~66))%00 G  uEz'')) 4 4GAt 3B3u,,GBNNEGBNNE*111$eu LueU 3 3 3 3 4 4rc#ZK|r$||jddsdS|r||jddr|V|||jD]"\}}||D]}|V#dS)zReturns an iterator of the subtrees of this manifest, including this manifest itself. If `matcher` is provided, it only returns subtrees that match. Nr)matcher)visitdirr^rrprr walksubtrees)r>rrr\subtrees r+rztreemanifest.walksubtreesws  7++DIcrcN;;  F ''$)CRC.11 JJJ  z''))  GAt,,W,==      r)rrrAr)5rOrPrQr?rlrprsrzrrrr=rr strmethodrrrrrrr#rrrDrrrr*rJrrrrrrr>rrrrrr rr;rrrirrrrrrBrr+rXrXs.   """   ,###HPPP             I%%% $ $ $ / / / /""" + + +;;; &"2:##]# D D D$$$4   &*** '''R%%%;;;;zLLL(((.))) 6 6 6(((4444rrXceZdZdZdZfdZfdZdZfdZfdZ fdZ fd Z fd Z fd Z dfd Zdfd ZxZS)manifestfulltextcachezFile-backed LRU cache for the manifest cache File consists of entries, up to EOF: - 20 bytes node, 4 bytes length, manifest data These are written in reverse cache order (oldest to newest). smanifestfulltextcachectt||d|_d|_d|_dSr)superrr?re_read_opener)r>max __class__s r+r?zmanifestfulltextcache.__init__s; #T**33C888   rcd|js|jdS ||j5}tt|j} |d}t|dkrn tj d|dd}n#tj $rYnGwxYwt||}t||krn |||dddn #1swxYwYn#t$rYnwxYwd|_d|_ dS)NTr>LrF)rr_filerrrrr!rLunpackr r,IOErrorre)r>fprrrrrs r+rzmanifestfulltextcache.reads : - F dj)) %R1488D %772;;D4yy2~~%}UBGGAJJ??B!<%bggdmm44E5zzT))Ce$$$ % % % % % % % % % % % % % % % %     D   sZDAD3.B"!D"B41D3B44AD: DD  D D D DDc |jr|jdS ||jddd5}|jj} |j|jvrn||j|tj dt|j ||j ||jurn|j} ddddS#1swxYwYdS#t$rYdSwxYw)NwT) atomictemp checkambigr) rerr_headr%r|_cachewriterLrMr!rr)r>rrs r+r zmanifestfulltextcache.writesU{ dl2 F  DTd %z%x4;..***UC OO!D!DEEE,,,tz))9D%  % % % % % % % % % % % % % % % % % %    DD s5C'BC C'CC'!C"C'' C54C5c|js|tt|SrA)rrrrrr>rs r+rzmanifestfulltextcache.__len__s7z  IIKKK*D1199;;;rc|js|tt||SrA)rrrrrr>ryrs r+rz"manifestfulltextcache.__contains__s9z  IIKKK*D11>>qAAArc|js|tt|SrA)rrrrrDr s r+rDzmanifestfulltextcache.__iter__s7z  IIKKK*D11::<<rysetdirtyrrs r+rz!manifestfulltextcache.__getitem__sfz  IIKKK;??1%%TZ7+T22>>qAA  DK rc|js|tt|||d|_dSr)rrrrrre)r>ryrrrs r+rz!manifestfulltextcache.__setitem__sFz  IIKKK #T**66q!<<< rc|js|tt||d|_dSr)rrrrrrers r+rz!manifestfulltextcache.__delitem__sDz  IIKKK #T**66q999 rNc|js|tt|||S)N)r)rrrrr)r>ryrrs r+rzmanifestfulltextcache.gets>z  IIKKK*D1155a5IIIrFctt||rd|_|d|_dS)NTF)rrclearrer r)r>clear_persisted_datars r+rzmanifestfulltextcache.clearsG #T**00222  DK JJLLL rrAr)rOrPrQrrr?rr rrrDrrrrr __classcell__rs@r+rrsN %E 88<<<<< BBBBB =====   JJJJJJ rrceZdZdZdS)rz;Exception raised when fastdelta isn't usable on a manifest.N)rOrPrQrrBrr+rr sEEEErrcDeZdZdZ d$dZdZedZd%dZd Z d&d Z d Z d Z d Z dZdZdZdZdZdZdZd'dZd'dZdZdZdZdddejdfdZ d(dZdZdZdZ dZ!d Z" d)d!Z#ed"Z$e$j%d#Z$dS)*manifestrevlogznA revlog that stores manifest texts. This is responsible for caching the full-text manifest contents. rNFc N||_d}d}t|dd}|,|d|}|dd}|p||_t ||_|r|jsJ|d|zfd} |rd |z| z} ||_|r||_n d |i|_tj|tj |jf| t| d t|j d d |_|jj|_|jj|_dS)aConstructs a new manifest revlog `indexfile` - used by extensions to have two manifests at once, like when transitioning between flatmanifeset and treemanifests. `treemanifest` - used to indicate this is a tree manifest revlog. Opener options can also be used to make this a tree manifest revlog. The opener option takes precedence, so if it is set to True, we ignore whatever value is passed in to the constructor. rFoptionsNmanifestcachesize treemanifests opts is %rs 00manifestsmeta/rTspersistent-nodemap)targetradixrmmaplargeindexupperboundcomppersistentnodemap)r_rr _treeondiskr_fulltextcachetree _dirlogcacherrevlog_constantsKIND_MANIFESTLOGrMAXCOMPRESSIONr _revlogrv _generaldelta) r>r_openerr* dirlogcacherX cachesizeoptiontreemanifestoptsr$s r+r?zmanifestrevlog.__init__sU$+ "vy$//  !5yAAI!%/5!A!A -=3I>>  B# A AdMD,@%A A A A  ,tOe+E   , +D  !$d D } $5tyA::~)$n001FNN     \' !\7rctj|dsdS|j|j_||jdStj|tj|fd}| |dS)z1Persist the manifestfulltextcache on lock releases _wlockrefNc|sdS}}||dS|jd|urdS|jdSr) manifestlog getstorager)r )successrepor>manifestrevlogrefreporefs r+persistmanifestcachezEmanifestrevlog._setupmanifestcachehooks..persistmanifestcache`ss 799D$$&&D|t|**3//t;;   % % ' ' ' ' 'r) r safehasattr wcachevfsr)r _currentlock _wlockrefweakrefref _afterlock)r>r;r>r<r=s @@r+_setupmanifestcachehooksz'manifestrevlog._setupmanifestcachehooksTsl33  F&*n#   T^ , , 4 F+d###K-- ( ( ( ( ( ( ,-----rc|jSrA)r)rCs r+ fulltextcachezmanifestrevlog.fulltextcacheps ""rc|j|j||j|i|_dSN)r)r/ clearcachesr)rr*r+r>rs r+rKzmanifestrevlog.clearcachestsF   """ !!7K!LLL!Y-rc|r |jsJ||jvr2t|j|j||j|j}||j|<|j|S)N)rX)r(r+rr_r1)r>rmfrevlogs r+dirlogzmanifestrevlog.dirlogysr  $# # # # D% % %%" !!- H$,D a  ##rc  ||jvrtt|tjdt |Ddt |D} ||j|| \} } |j|| f} tj | }|j |||||| }|j |}n#t$r|j rY|s Jd| s Jd||j|}||j|}|||||||| }d} n[|}|j |||||}|j |}t#|} YnwxYw| | |j|<|S)aadd some manifest entry in to the manifest log input: m: the manifest dict we want to store transaction: the open transaction p1: manifest-node of p1 p2: manifest-node of p2 added: file added/changed compared to parent removed: file removed compared to parent tree manifest input: readtree: a function to read a subtree match: a filematcher for the subpart of the tree manifest cg|]}|dfSrrBrs r+rz&manifestrevlog.add..s333!U333rcg|]}|dfSrrBrs r+rz&manifestrevlog.add..s444q!T444rs,readtree must be set for treemanifest writess/match must be specified for treemanifest writesr N)rHrr0heapqmergerr;r/revrr' addrevisionrr(r*_addtreerr,)r>r transactionlinkp1p2addedremovedreadtreer workr:r9 cachedeltarrVr(r rs r+rzmanifestrevlog.adds8) ,+++*,,, E " " ";33VE]]33344F7OO444D $%;;t/A"/Et#L#L Iy))"--y8J;y))D,**k4RC !!#&&AA# , , ,  ,PP!PPPPPPPPPPXdi,,Xdi,,MM{D"b(%"! vvxxl..t[$BOOL%%c**%dOO ' ,*  $-D q !sC6C99CGGcjdkr>||s||r|Sfd}||||||} d} jdkrY| |kr|} n,| |kr|} | s\j| ||} j| } || | S)Nrc |}||||dd| dS)Nr_r )rOrr) r\rrr sublogrZr_r>rYs r+rz-manifestrevlog._addtree..writesubtrees\[[,,F JJ!      r)r*rrrrr/rWr) r>rrYrZr rr_r rrr(rVs ` `` ` r+rXzmanifestrevlog._addtreesZ 9    b ! ! %&%6%6r%:%: 6688O         B e444yy{{  9  rzz||##GGII%%GGII ',**k4BGGIIC !!#&&A ! rc*t|jSrA)r!r/rCs r+rzmanifestrevlog.__len__s4<   rc4|jSrA)r/rDrCs r+rDzmanifestrevlog.__iter__s|$$&&&rc6|j|SrA)r/rVrs r+rVzmanifestrevlog.revs|%%%rc6|j|SrA)r/rr>rVs r+rzmanifestrevlog.nodes|  %%%rc6|j|SrA)r/lookupr>rs r+rlzmanifestrevlog.lookup s|""5)))rc6|j|SrA)r/ parentrevsrjs r+rozmanifestrevlog.parentrevs s|&&s+++rc6|j|SrA)r/parentsrs r+rqzmanifestrevlog.parentss|##D)))rc6|j|SrA)r/linkrevrjs r+rszmanifestrevlog.linkrev|##C(((rc4|jSrA)r/ checksizerCs r+rvzmanifestrevlog.checksizes|%%'''rc:|j||SN)_df)r/revisionr>rrys r+rzzmanifestrevlog.revisions|$$Ts$333rc:|j||Srx)r/rawdatar{s r+r}zmanifestrevlog.rawdatas|##Dc#222rc8|j||SrA)r/revdiff)r>rev1rev2s r+rzmanifestrevlog.revdiffs|##D$///rc8|j||SrA)r/cmp)r>rrs r+rzmanifestrevlog.cmp!s|d+++rc6|j|SrA)r/ deltaparentrjs r+rzmanifestrevlog.deltaparent$s|'',,,rcB|j||||||S)N) nodesorder revisiondataassumehaveparentrevisions deltamodesidedata_helpers)r/ emitrevisions)r>nodesrrrrrs r+rzmanifestrevlog.emitrevisions's5|)) !%&?- *   rcB|j||||||S)N) alwayscache addrevisioncbduplicaterevisioncb)r/addgroup)r>deltas linkmapperrYrrrs r+rzmanifestrevlog.addgroup9s5|$$   #' 3 %   rc6|j|SrA)r/rawsizerjs r+rzmanifestrevlog.rawsizeKrtrc6|j|SrA)r/ getstrippoint)r>minlinks r+rzmanifestrevlog.getstrippointNs|))'222rc8|j||SrA)r/strip)r>rrYs r+rzmanifestrevlog.stripQs|!!';777rc4|jSrA)r/r3rCs r+r3zmanifestrevlog.filesTs|!!###rc t|tstjd|jj||jfi|S)Ns"expected manifestrevlog to clone())rrr ProgrammingErrorr/clone)r>tr destrevlogkwargss r+rzmanifestrevlog.cloneWsI*n55 P()NOO O!t|!"j&8CCFCCCrc@|j|||||S)N)exclusivefiles sharedfilesrevisionscount trackedsize storedsize)r/ storageinfo)r>rrrrrs r+rzmanifestrevlog.storageinfo]s2|'')#)#! (   rc|jjSrAr/r1rCs r+r1zmanifestrevlog.openerms |""rc||j_dSrArrms r+r1zmanifestrevlog.openerqs# r)rNFr)NNrA)FNN)FFFFF)&rOrPrQrr?rFpropertyrHrKrOrrXrrDrVrrlrorqrsrvrzr}rrrrCG_DELTAMODE_STDrrrrrr3rrr1setterrBrr+rrs <8<8<8<8|...8##X#.... $ $ $.JJJJX(((T!!!'''&&&&&&***,,,***)))(((44443333000,,,--- "'-    .     $)))333888$$$DDD     ##X# ]$$]$$$rrc@eZdZdZdZdZd dZdZd dZd Z d Z d S)r8aA collection class representing the collection of manifest snapshots referenced by commits in the repository. In this situation, 'manifest' refers to the abstract concept of a snapshot of the list of files in the given commit. Consumers of the output of this class do not care about the implementation details of the actual manifests they receive (i.e. tree or flat or lazily loaded, etc).cV|j|_d}d}t|dd}|,|d|}|d|}||_||_|j|||_i|_tj ||jd<||_ dS)NFrr r"r!r) r_rr_treemanifests _rootstorerF _narrowmatch _dirmancacher lrucachedict _cachesize)r>r1r; rootstore narrowmatchusetreemanifestr3r5s r+r?zmanifestlog.__init__s!/ vy$//  "hhHHO!5yAAI-# 00666'!%!29!=!=##rc.|d|S)zgRetrieves the manifest instance for the given node. Throws a LookupError if not found. r)rrs r+rzmanifestlog.__getitem__sxxT"""rTc||j|dvr|j||S|js8|j|ddst |j||S|rl|jjr<|r(| | |t|||}nitj td|z|r|j ||jrt|d|}nt!||}||jjkrD|j|}|s#t%j|j}||j|<|||<|S)zRetrieves the manifest instance for the given node. Throws a LookupError if not found. `verify` - if True an exception will be thrown if the node is not in the revlog rBNrs9cannot ask for manifest directory '%s' in a flat manifestr)rrrrrexcludeddirmanifestctxr_rr(r9rVtreemanifestctxr Abortrr manifestctxr`rrr)r>r*rverifyrmancaches r+rzmanifestlog.gets 4$((r22 2 2$T*40 0 '')) N$--d3B3i88 N-d.@$MMM  ,* 4OOD))--d333#D$55k$  *##D)))" ,#D#t44d++ 4%, , ,(,,T22H 3,T_==*2!$'HTNrc6|j|SrA)rrO)r>r*s r+r9zmanifestlog.getstorages%%d+++rFcn|j|j|dSrJ)rrrrKrLs r+rKzmanifestlog.clearcachess7 !!! ##9M#NNNNNrc6|j|SrA)rrVrs r+rVzmanifestlog.revs""4(((rcB|jj|S)N)rY)rr/ update_caches)r>rYs r+rzmanifestlog.update_cachess&444MMMrNrr) rOrPrQrr?rrr9rKrVrrBrr+r8r8vs??$$$,### ----^,,,OOOO)))NNNNNrr8c.eZdZdZdZdZdZddZdS)memmanifestctxcP||_t|jj|_dSrA) _manifestlogrr_r# _manifestdict)r>r8s r+r?zmemmanifestctx.__init__s&')+*C*KLLrc6|jdSrrr9rCs r+_storagezmemmanifestctx._storage ++C000rct|j}||_|SrArrrrrr>memmfs r+rzmemmanifestctx.copy3t011"iikk..00 rc|jSrA)rrCs r+rzmemmanifestctx.read !!rNc j||j|||||||S)NrS)rrr)r>rYrZr[r\r]r^r s r+r zmemmanifestctx.writesB}}""        #   rrArOrPrQr?rrrr rBrr+rrsgMMM111 """       rrc\eZdZdZdZdZdZdZedZ dZ d d Z d d Z d Z d S)rzxA class representing a single revision of a manifest, including its contents, its parent revs, and its linkrev. c0||_d|_||_dSrA)r_datara)r>r8rs r+r?zmanifestctx.__init__s'  rc6|jdSrrrCs r+rzmanifestctx._storage rrc|jSrArarCs r+rzmanifestctx.node rrct|j}||_|SrArrs r+rzmanifestctx.copyrrcZ||jSrArrqrarCs r+rqzmanifestctx.parents }}&&tz222rc|j|jj}|j|jkrt |j|_n|}|j|jvr%tj |j|j}n8| |j}t|}||j|j<t |j||_|jSrA) rrr_rar`rr#rrHrrIrzr,)r>ncstorerr:s r+rzmanifestctx.reads : "0BzRY&&)"*55  :!444#+E,? ,KLLDD >>$*55D )$I6?E' 3)"*d;; zrFc|}||j}||}|tkr+|||vr|S|S)aCalls either readdelta or read, based on which would be less work. readdelta is called if the delta is against the p1, and therefore can be read quickly. If `shallow` is True, nothing changes since this is a flat manifest. )rrVrarrro readdeltarr>shallowrrrs r+readfastzmanifestctx.readfast)sx  IIdj ! !''** ' ! !kU5E5Ea5H5H&H&H>>## #yy{{rc|}||j}tj||||}t|jj |S)a Returns a manifest containing just the entries that are present in this manifest, but not in its p1 manifest. This is efficient to read if the revlog delta is already p1. Changing the value of `shallow` has no effect on flat manifests. ) rrVrar patchtextrrrr_r#)r>rrrrs r+rzmanifestctx.readdelta7se  IIdj ! ! OEMM%*;*;A*>*>BB C CE/7;;;rcP||SrArrJrs r+rJzmanifestctx.findCyy{{$$$rNr)rOrPrQrr?rrrr>rqrrrrJrBrr+rrs111 33]3     < < < <%%%%%rrc0eZdZddZdZdZdZd dZdS) memtreemanifestctxrcT||_||_t|j|_dSrA)rr^rXr_ _treemanifest)r>r8rs r+r?zmemtreemanifestctx.__init__Is*' )+*CDDrc6|jdSrrrCs r+rzmemtreemanifestctx._storageNrrcxt|j|j}|j|_|SNr)rrr^rrrs r+rzmemtreemanifestctx.copyQs5"4#4$)DDD"05577 rc|jSrA)rrCs r+rzmemtreemanifestctx.readVrrNc xfd}j|||||||| S)Nc^j||SrArrr)rrr>s r+r_z*memtreemanifestctx.write..readtreeZs($((d3388:: :rrd)rrr) r>rYrZr[r\r]r^r r_s ` r+r zmemtreemanifestctx.writeYsa ; ; ; ; ;}}""        #   rr<rArrBrr+rrGsmEEEE 111 """      rrcXeZdZdZdZdZdZdZedZ d dZ d d Z d Z d S) rc>||_||_d|_||_dSrA)rr^rra)r>r8rrs r+r?ztreemanifestctx.__init__ls#'   rc|jj}|sA||jddst |jj|jS|j|jSr)rrrrr^excludedmanifestrevlogr_r9)r>rs r+rztreemanifestctx._storagezs{'4 !!## '' #2#77 -%3TY ++DI666rcjHjjjjkrt jj_njrct jjj}fd}fd}| ||| j|_njj vr%tj j j}n8j}t|}|j j<t jjj|_jS)Nrc8jSrA)rzra)r>rsr+rz%treemanifestctx.read..gettexts >>$*555rcbj||dS)NF)rr)rr\r>s r+r]z)treemanifestctx.read..readsubtrees/ ,00d50IINNPPPr)rr)rrrarr_r`rXr(r^rrrHrrIrzr,)r>rrr]rr:rs` @r+rztreemanifestctx.readsb : MMOOEzT.<CCC)$*;*IJJ "  !2!@diPPP666666QQQQQ w ,,, $*%%% :!444#+E,? ,KLLDD >>$*55D )$I6?E' 3)%3 zrc|jSrArrCs r+rztreemanifestctx.noderrct|j|j}||_|Sr)rrr^rrrrs r+rztreemanifestctx.copys:"4#4$)DDD"iikk..00 rcZ||jSrArrCs r+rqztreemanifestctx.parentsrrFc|}|ro||j}tj||||}t|jj |S|||j}|j |j | |}|}t|j j|j }||D]-\} \\} } \} } | r| || <| r|| | .|S)aReturns a manifest containing just the entries that are present in this manifest, but not in its p1 manifest. This is efficient to read if the revlog delta is already p1. If `shallow` is True, this will read the delta for this directory, without recursively reading subdirectory manifests. Instead, any subdirectory entry will be reported as it appears in the manifest, i.e. the subdirectory will be reported among files and distinguished only by its 't' flag. r)rrVrar rrrrr_r#rrr^rrrXrrr)r>rrrrr0m0r mdr'n0fl0rrs r+rztreemanifestctx.readdeltasQ    $*%%A e.?.?.B.BA F FGGA 3 ;Q?? ?""599TZ#8#899B"&&ty%**R..AAFFHHBBd/=49MMMB-/WWR[[->->-@-@ + +))IRyC+BqE+ 1c***Irc|}||j}||}|tkr-|||vr||S|r2t|jj | |jS| S)a#Calls either readdelta or read, based on which would be less work. readdelta is called if the delta is against the p1, and therefore can be read quickly. If `shallow` is True, it only returns the entries from this manifest, and not any submanifests. )r) rrVrarrrorrr_r#rzrrs r+rztreemanifestctx.readfasts  IIdj ! !''** ' ! !kU5E5Ea5H5H&H&H>>'>22 2  #+U^^DJ-G-G 99;; rcP||SrArrs r+rJztreemanifestctx.findrrNr) rOrPrQr?rrrrr>rqrrrJrBrr+rrjs777B 33]3:*%%%%%rrc(eZdZdZfdZdZxZS) excludeddiraStand-in for a directory that is excluded from the repository. With narrowing active on a repository that uses treemanifests, some of the directory revlogs will be excluded from the resulting clone. This is a huge storage win for clients, but means we need some sort of pseudo-manifest to surface to internals so we can detect a merge conflict outside the narrowspec. That's what this class is: it stands in for a directory whose node is known, but whose contents are unknown. ctt|||||_||jd<d|jd<dS)Nrrj)rrr?rargrh)r>r_rrrs r+r?zexcludeddir.__init__sJ k4  ))-===   C Crc|SrArBrCs r+rzexcludeddir.copyrEr)rOrPrQrr?rrrs@r+rrsQ       rrc,eZdZdZdZdZddZdZdS) rzBcontext wrapper for excludeddir - see that docstring for rationalec0||_||_||_dSrA)r_r^ra)r>r_rrs r+r?zexcludeddirmanifestctx.__init__ s*  rcBt|j|j|jSrA)rr_r^rarCs r+rzexcludeddirmanifestctx.read s4-ty$*EEErFc*|SrA)r)r>rs r+rzexcludeddirmanifestctx.readfast syy{{rc:tjd|jz)Ns.attempt to write manifest from excluded dir %sr rr^)r>argss r+r zexcludeddirmanifestctx.write s!$ = I   rNr)rOrPrQrr?rrr rBrr+rr s^LL FFF     rrc6eZdZdZdZdZdZdZdZdZ dS) ra\Stand-in for excluded treemanifest revlogs. When narrowing is active on a treemanifest repository, we'll have references to directories we can't see due to the revlog being skipped. This class exists to conform to the manifestrevlog interface for those directories and proactively prevent writes to outside the narrowspec. c"||_||_dSrA)r_r^)r>r_rs r+r?zexcludedmanifestrevlog.__init__" s* rc:tjd|jz)Ns(attempt to get length of excluded dir %srrCs r+rzexcludedmanifestrevlog.__len__& !$ 7$) C   rc:tjd|jz)Ns'attempt to get rev from excluded dir %srrs r+rVzexcludedmanifestrevlog.rev+ s!$ 6 B   rc:tjd|jz)Ns+attempt to get linkrev from excluded dir %srrs r+rszexcludedmanifestrevlog.linkrev0 s!$ :TY F   rc:tjd|jz)Ns(attempt to get node from excluded dir %srrjs r+rzexcludedmanifestrevlog.node5 rrcdSrArB)r>rrs r+rzexcludedmanifestrevlog.add: s rN) rOrPrQrr?rrVrsrrrBrr+rr sx                 rr)rN)ErTrrLrCi18nrrrrrrrr r r rr r rrr interfacesr interfaceutil revlogutilsrr, importmodrr>r(r,r6r8rTrZrhr"rm lazymanifestAttributeError implementer imanifestdictrr)r0r+rUrbrXrrr. Exceptionrimanifeststorager imanifestlogr8imanifestrevisionwritablerimanifestrevisionstoredrrrrrrrBrr+r1s                          & 9 % %"  $6   .""""""""J   )((qqqqqqqqh  (MM   D :344g$g$g$g$g$g$g$54g$T((((V!!!, :344h h h h h h h 54h VzzzzzD-zzz~FFFFF9FFF:677b$b$b$b$b$b$b$87b$J :233_N_N_N_N_N_N_N43_ND:?@@       A@ ::=>>L%L%L%L%L%L%L%?>L%^:?@@       A@ D:=>>x%x%x%x%x%x%x%?>x%v,:     _   *( ( ( ( ( ^( ( ( ( ( sB$$B,+B,