ó žçƒQc@s{ddlmZmZmZmZddlZddlZddlZd„Zd„Z d„Z de fd„ƒYZ dS(iÿÿÿÿ(tbinthextnullidtnullrevNcCs)d}|jr%d||jf}n|S(s7name of a branchcache file for a given repo or repoviewscache/branchheadss%s-%s(t filtername(trepotfilename((s7/sys/lib/python2.7/site-packages/mercurial/branchmap.pyt _filename s c Csy8|jt|ƒƒ}|jƒjdƒ}|jƒWnttfk rRdSXy4|jdƒjddƒ}|d \}}t |ƒt |ƒ}}d}t |ƒdkrÅt |dƒ}nt d|d|d|ƒ}|j |ƒsþtdƒ‚nx…|D]}}|sqn|jdd ƒ\} } tj| jƒƒ} | |krctd | ƒ‚n|j| gƒjt | ƒƒqWWn‚tk r‚notk r } |jjrd } |jdk rá| d |j7} n| d 7} |jj| | ƒnd}nX|S(Ns it ittipnodettiprevt filteredhashs tip differsisnode %s does not existsinvalid branchheads caches (%s)s: %s (topenerRtreadtsplittclosetIOErrortOSErrortNonetpopRtinttlent branchcachetvalidfort ValueErrortencodingttolocaltstript setdefaulttappendtKeyboardInterruptt Exceptiontuit debugflagRtwarn( RtftlinestcachekeytlasttlrevR tpartialtltnodetlabeltinsttmsg((s7/sys/lib/python2.7/site-packages/mercurial/branchmap.pyR sH   '    csT|j}|j}|jj|ƒ‰g}ˆdksFˆj|ƒ rßt|ƒ‰ˆdkrßtjj|ƒ}|dkrˆt ƒ‰qÜ|j |ƒ}|j ƒj ƒ‰|jj |j }|j‡fd†|Dƒƒqßn|j|jdˆjdƒƒ|r%ˆj||ƒˆj|ƒnˆj|ƒs@t|ƒ‚ˆ|j|jMststarti(t changelogRt _branchcachestgetRRR trepoviewt subsettableRtfilteredt branchmaptcopyt filteredrevstextendtrevsR tupdatetwritetAssertionError(RtclRR;t subsetnametsubsett extrarevs((R(s7/sys/lib/python2.7/site-packages/mercurial/branchmap.pyt updatecache=s(      # RcBsPeZdZdeedd„Zd„Zd„Zd„Z d„Z d„Z RS( s1A dict like object that hold branches heads cachecCs5tt|ƒj|ƒ||_||_||_dS(N(tsuperRt__init__R R R (tselftentriesR R R ((s7/sys/lib/python2.7/site-packages/mercurial/branchmap.pyREXs  cs‚|j}|jsdSd}t‡fd†|jDƒƒ}|r~tjƒ}x|D]}|jd|ƒqTW|jƒ}n|S(sBbuild hash of revision filtered in the current cache Tracking tipnode and tiprev is not enough to ensure validity of the cache as they do not help to distinct cache that ignored various revision bellow tiprev. To detect such difference, we build a cache of all ignored revisions. c3s$|]}|ˆjkr|VqdS(N(R (R.R/(RF(s7/sys/lib/python2.7/site-packages/mercurial/branchmap.pys lss%s;N(R1R9Rtsortedtutiltsha1R<tdigest(RFRR?tkeyR;tstrev((RFs7/sys/lib/python2.7/site-packages/mercurial/branchmap.pyt _hashfiltered_s    cCsQy8|j|jj|jƒko6|j|j|ƒkSWntk rLtSXdS(s¹Is 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(R R1R*R R ROt IndexErrortFalse(RFR((s7/sys/lib/python2.7/site-packages/mercurial/branchmap.pyRts  cCst||j|j|jƒS(s-return an deep copy of the branchcache object(RR R R (RF((s7/sys/lib/python2.7/site-packages/mercurial/branchmap.pyR8scCs yæ|jt|ƒddtƒ}t|jƒt|jƒg}|jdk rg|j t|jƒƒn|j dj |ƒdƒxWt |j ƒƒD]C\}}x4|D],}|j dt|ƒtj|ƒfƒq§Wq”W|jƒWntttjfk rnXdS(Ntwt atomictempRs s%s %s (R RtTrueRR tstrR R RRR=tjoinRHt iteritemsRt fromlocalRRRRItAbort(RFRR#R%R+tnodesR*((s7/sys/lib/python2.7/site-packages/mercurial/branchmap.pyR=ƒs .cs#|j‰i}ˆj}x6|D].}|j||ƒgƒjˆj|ƒƒqWx¿|jƒD]±\}}|j|gƒ}g|D]$} ˆj| ƒrƒˆj| ƒ^qƒ} g|D]$} ˆj| ƒr´ˆj| ƒ^q´} | oùt| ƒt | ƒk} t t | ƒj | ƒƒ} | r,t | ƒ} n t | ƒ} xu| r¯| jƒ}|| kr_q;nt ˆj|g| dƒƒ}|r;g| D]}||kr‹|^q‹} q;q;Wg| D]}ˆj|ƒ^q·||ÛsN(R1tbranchRRR*RWthasnodeRNtmintmaxRHtsettuniontlistRt ancestorsR R tkeysR:RRRtvaluesROR (RFRtrevgent newbranchest getbranchR/R[tnewnodestbheadsR*t bheadrevst newheadrevstctxisnewtiterrevstlatestRbtbRNR t droppednodestheadRZtheads((R?s7/sys/lib/python2.7/site-packages/mercurial/branchmap.pyR<’sZ   , $ $    ,&    (N( t__name__t __module__t__doc__RRRRERORR8R=R<(((s7/sys/lib/python2.7/site-packages/mercurial/branchmap.pyRUs     ( R*RRRRRRIR4RR RCtdictR(((s7/sys/lib/python2.7/site-packages/mercurial/branchmap.pyts "   *