\x89\x50\x4E\x47\x0D\x0A\x1A\x0A PNG  \x89\x50\x4E\x47\x0D\x0A\x1A\x0A  13\c@@sLddlmZddlZddlmZmZmZmZddlm Z m Z m Z m Z m Z ddlmZejZejZejZdZdZid d6d d 6d d 6d d 6d d 6ZdZdZdefdYZdZdeZdeZdZeeZdZ dZ!dZ"de#fdYZ$dS(i(tabsolute_importNi(tbinthextnullidtnullrev(tencodingterrortpycompattscmutiltutil(t stringutilcC@s)d}|jr%d||jf}n|S(s7name of a branchcache file for a given repo or repoviewtbranch2s%s-%s(t filtername(trepotfilename((s9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pyt _filename!s cC@sd}z^y|jt|}t|}t|jdjdd}|d \}}t|t|}}d}t |dkrt|d}nt d|d|d|}|j |st dn|j }x|D]} | jd} | s qn| jdd\} } } | dkrBt d ntj| j} t| } |j| st d tjt| n|j| gj| | d kr|jj| qqWWnttfk rdStk rb} |jjrYd }|jdk r/|d |j7}n|d7}|jj|tj | nd}nXWd|rz|j!nX|S(Ns t ittipnodettiprevt filteredhashs tip differstocsinvalid branch statesnode %s does not existtcsinvalid branchheads caches (%s)s: %s ("tNonetcachevfsRtitertnexttrstriptsplitRtinttlent branchcachetvalidfort ValueErrort changelogRttolocaltstripthasnodeRtsysstrRt setdefaulttappendt _closednodestaddtIOErrortOSErrort Exceptiontuit debugflagR tdebugtbytestrtclose(R tftlineitertcachekeytlasttlrevRtpartialtcltltnodetstatetlabeltinsttmsg((s9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pytread(sX !         tvisiblesvisible-hiddentservedt immutabletbasec@s6|j}|j}|jj|g}dksFj| rt|dkrtj|}|dkrtq|j |}|j j |jj |j }|j fd|Dqn|j |jdjd|r"j||j|n|j|jwststarti(R!R t _branchcachestgetRRR?t subsettableRtfilteredt branchmaptcopyt filteredrevstextendtrevsRtupdatetwrite(R R8R ROt subsetnametsubsett extrarevs((R7s9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pyt updatecachegs&      # c@s(|j}|j|j}g}g}xf|jD]X}|j|xB|D]:}|}||\} } | rN|j|qNqNWq4W|r$tfd|D} t||| j| d|} xMdD]B} |j | }| j |r| |j | <| j |PqqWndS(sReplace the branchmap cache for a repo with a branch mapping. This is likely only called during clone with a branch map from a remote. c3@s!|]}t|VqdS(N(R(RDR:(tclrev(s9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pys st closednodesRCRBRAN(RCRBRA( R!trevt branchinfot itervaluesRNR'tmaxRR:RJRRGRQ(R tbmR8t clbranchinfotrbheadstclosedtbheadsthREtbRtrtiprevtcachet candidatetrview((RVs9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pyt replacecaches2            RcB@szeZdZd eed d dZdZdZdZ dZ e dZ dZ dZd Zd ZRS( s/A dict like object that hold branches heads cache. This cache is used to avoid costly computations to determine all the branch heads of a repo. The cache is serialized on disk in the following format: [optional filtered repo hex hash] ... The first line is used to check if the cache is still valid. If the branch cache is for a filtered repo view, an optional third hash is included that hashes the hashes of all filtered revisions. The open/closed state is represented by a single letter 'o' or 'c'. This field can be used to avoid changelog reads when determining if a branch head closes a branch or not. cC@sYtt|j|||_||_||_|dkrLt|_n ||_dS(N( tsuperRt__init__RRRRtsetR((tselftentriesRRRRW((s9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pyRis    cC@sWy>|j|jj|jko<|jtj||jkSWntk rRtSXdS(sIs the cache content valid regarding a repo - False when cached tipnode is unknown or if we detect a strip. - True when cache is up to date or a subset of current repo.N(RR!R:RRRt IndexErrortFalse(RkR ((s9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pyRs  cC@sP|d}t}x3t|D]%}||jkr|}t}PqqW||fS(shReturn tuple with last open head in heads and false, otherwise return last closed head and true.i(tTruetreversedR(Rn(RktheadsttipR_Ra((s9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pyt _branchtips cC@s|j||dS(sReturn the tipmost open head on branch head, otherwise return the tipmost closed head on branch. Raise KeyError for unknown branch.i(Rs(Rktbranch((s9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pyt branchtipsc@sfd|DS(Nc3@s$|]}|jkr|VqdS(N(R((RDtn(Rk(s9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pys s((Rktnodes((Rks9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pytiteropenscC@s,||}|s(t|j|}n|S(N(tlistRx(RkRtR_Rq((s9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pyt branchheadss cc@s9x2|jD]$\}}||f|j|Vq WdS(N(t iteritemsRs(RktbnRq((s9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pyt iterbranchesscC@s"t||j|j|j|jS(s-return an deep copy of the branchcache object(RRRRR((Rk((s9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pyRLsc C@s}y:|jt|ddt}t|jd|jg}|jdk re|jt|jn|j dj |dd}xt |j D]n\}}x_|D]W}|d7}||j krd}nd }|j d t||tj|fqWqW|j|jjd d |jt||Wn<tttjfk rx} |jjd tj| nXdS(Ntwt atomictemps%dRs iiRtos %s %s %s Rs2wrote %s branch cache with %d labels and %d nodes s couldn't write branch cache: %s (RRRoRRRRRR'RQtjointsortedR{R(Rt fromlocalR1R-tlogR RR*R+RtAbortR/R t forcebytestr( RkR R2R4t nodecountR<RwR:R;R=((s9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pyRQs,      c@sntj}|ji}|jj}xa|D]Y}||d\}}|j|gj||r1|jjj |q1q1Wt j } x|j D]\}} |j|g} t fd| D} | j | | | } | r5t| }t j| |}| |8} nt| }g|D]}j |^qH||<|d}||jkrj ||_||_qqW|j|s&t|_t|_x`|jD]O}tfd|D}||jkrj ||_||_qqWntj||j|_tj|}|jjdd|j|dS(sGiven a branchhead cache, self, that may have extra nodes or be missing heads, and a generator of nodes that are strictly a superset of heads missing, this function updates self to be correct. R!c3@s|]}j|VqdS(N(RX(RDR:(R8(s9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pys )sic3@s|]}j|VqdS(N(RX(RDR:(R8(s9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pys DsRs(updated %s branch cache in %.4f seconds N(R ttimerR!trevbranchcacheRYR&R'R(R)R:RjtheadrevsR{RPtmint ancestorsRRRRRRtvaluesR[RRR-RR (RkR trevgent starttimet newbranchest getbranchinfoRERtt closesbrancht topoheadst newheadrevsR`tbheadsett uncertaintfloorrevRt bheadrevsRXRRqtduration((R8s9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pyRPsJ         &   (N(t__name__t __module__t__doc__RRRRiRRsRuRxRnRzR}RLRQRP(((s9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pyRs       s-v1s rbc-namessrbc-revss>4sIiiIRcB@s\eZdZedZdZddZddZdZ ddZ ddZ RS( sPersistent cache, mapping from revision number to branch name and close. This is a low level cache, independent of filtering. Branch names are stored in rbc-names in internal encoding separated by 0. rbc-names is append-only, and each branch name is only stored once and will thus have a unique index. The branch info for each revision is stored in rbc-revs as constant size records. The whole file is read into memory, but it is only 'parsed' on demand. The file is usually append-only but will be truncated if repo modification is detected. The record for each revision contains the first 4 bytes of the corresponding node hash, and the record is only used if it still matches. Even a completely trashed rbc-revs fill thus still give the right result while converging towards full recovery ... assuming no incorrectly matching node hashes. The record also contains 4 bytes where 31 bits contains the index of the branch and the last bit indicate that it is a branch close commit. The usage pattern for rbc-revs is thus somewhat similar to 00changelog.i and will grow with it but be 1/8th of its size. cC@s||_g|_t|_d|_y\|jjt}t||_|rg|j dD]}t j |^qa|_nWn,t t fk r|r|j|_qnX|jry |jjt}||j(Wqt t fk r}|jjdtj|qXntt|jtt|j|_|jdkrZg|_nt|j|_tdt|jD|_dS(Niss(couldn't read revision branch cache: %s cs@s!|]\}}||fVqdS(N((RDRERb((s9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pys s(t_repot_namest bytearrayt_rbcrevst _rbcsnameslenRR?t _rbcnamesRRRR"R*R+t _branchinfoRYR-R/R RRt _rbcrecsizeR!t _rbcrevslent_rbcnamescounttdictt enumeratet _namesreverse(RkR treadonlytbndataR|tdataR=((s9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pyRiqs4    2   cC@sUd|_|j2d|_|jjt|jj|_t |jt |_ dS(Ni( RRRRtclearRRR!RRRR(Rk((s9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pyt_clears    c C@sr|p|jj}|t}|tkr5|j|St|j|tkra|j|d|S|j|t }t t t j |j|\}}t|t@}|r|tM}n|dkrn||kry|j||fSWq_tk r|jjjd|jq_Xn@|jjjd||t}|j|3t|j||_|j|d|S(sWReturn branch name and close flag for rev, using and updating persistent cache.R!ssRreferenced branch names not found - rebuilding revision branch cache from scratch sPhistory modification detected - truncating revision branch cache to revision %d (RR!RRRYRRRR:t _rbcnodelent unpack_fromt _rbcrecfmtR tbuffertboolt _rbccloseflagt_rbcbranchidxmaskRRmR-R/RRR( RkRXR!t rbcrevidxtreponodet cachenodet branchidxR1ttruncate((s9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pyRYs4   !      cC@s|p|jj}|j|\}}||jkrF|j|}n,t|j}|jj|||j|<|j|}|r|tO}n|j ||||||fS(s7Retrieve branch info from changelog and update _rbcrevs( RR!RYRRRR'R:Rt _setcachedata(RkRXR!RbR1RR((s9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pyRs  cC@s||jkr|j|}n,t|j}|jj|||j|<|r^|tO}n|j|||dt|kr|`ndS(s%add new data information to the cacheRYN(RRRR'RRtvarsRY(RkRtRXR:R1R((s9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pytsetdatas  cC@s|tkrdS|p|jj}|t}t|j|tkrs|jjdt|tt|jntt|j|||t |j ||_ |jj }|r|j d|j ndS(s:Writes the node's branch data to the in-memory cache data.Nsswrite-revbranchcache(RRR!RRRRNt pack_intoRRRtcurrenttransactiont addfinalizeRQ(RkRXR:RR!Rttr((s9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pyRs    c C@s|j}d }d}zym|jt|jkr\d}|jdt}|jdkr|jjt d}|j |j kr|j dq|j |jjdt d|_d|_n|jdkr|jjtdt|jjt d }n|j djd |j|jD|j |_ |j t|j|_n|jt}|t|jkrd}|d kr|jdt}ntt|jt|jt}|jjtd}|j |krM|jjd t|f|j||j |kr@d}|j|n|jn|t}|j |j||!|j ||_nWnHtttjtjfk r} |jjd |tj | fnXWd |d k r|j!nXd S(s!Save branch cache if it is dirty.ts namestwaititabss%s changed - rewriting it t ignoremissingtwbcs@s|]}tj|VqdS(N(RR(RDRb((s9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pys sstruncating cache/%s to %d s+couldn't write revision branch cache%s: %s N("RRRRRtwlockRnRtopenRttellRRQR1R-R/Rt unlinkpathRRoRRRR!tseekRR*R+RRt LockErrorR Rtrelease( RkRR RtstepR2RFROtendR=((s9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pyRQsb            !  N( RRRRoRiRRRYRRRRQ(((s9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pyRZs !  *   (%t __future__RtstructR:RRRRRRRRRR tutilsR tcalcsizeRRRR?RRIRURgRRt _rbcversionRRRRRRRtobjectR(((s9/usr/lib64/python2.7/site-packages/mercurial/branchmap.pyts4 "(     9    #