\x89\x50\x4E\x47\x0D\x0A\x1A\x0A PNG  \x89\x50\x4E\x47\x0D\x0A\x1A\x0A  13\c@@sjddlmZddlZddlmZmZmZmZddlm Z ddl m Z m Z m ZmZmZddlmZdZd Zd Zd Zd Zd ZdZdZdedZdedZdddZdZ dZ!dZ"dZ#edZ$dedZ%dZ&d Z'ddZ(de)fdYZ*dS(!i(tabsolute_importNi(tbinthextnullidtshort(t_(tencodingterrortmatchtscmutiltutil(t stringutilcC@si|j}|jj}g|D]}||^q}t|||ddd}t||}|S(sreturn the list of '.hgtags' fnodes used in a set revisions This is returned as list of unique fnodes. We use a list instead of a set because order matters when it comes to tags.Ni(t unfilteredt changelogtnodet _getfnodest _filterfnodes(tuitrepotrevstunfittonodetrtnodestfnodes((s4/usr/lib64/python2.7/site-packages/mercurial/tags.pyt fnoderevsTs   cC@s|tkrdS|S(sconvert nullid to None For tag value, nullid means "deleted". This small utility function helps translating that to None.N(RtNone(tvalue((s4/usr/lib64/python2.7/site-packages/mercurial/tags.pyt _nulltonone`s c C@s||krgSt|||}t|||}g}xu|jD]g\}\}} t|}|j|d\} } t| } | |krG|j|| |fqGqGWxQ|jD]C\}\} } t| } | dk r|j|| dfqqW|j|S(sJlist differences between tags expressed in two set of file-nodes The list contains entries in the form: (tagname, oldvalue, new value). None is used to expressed missing value: ('foo', None, 'abcd') is a new tag, ('bar', 'ef01', None) is a deletion, ('baz', 'abcd', 'ef01') is a tag movement. N(NN(t_tagsfromfnodestitemsRtpopRtappendtsort( RRt oldfnodest newfnodestoldtagstnewtagstentriesttagtnewt__told((s4/usr/lib64/python2.7/site-packages/mercurial/tags.pytdifftagsis"       c C@sd}d}d}d}x|D]\}}}|dk rIt|}n|dk rdt|}n|dkr|j|||fq|dkr|j|||fq|j|||f|j|||fqWdS(swrite tags diff information to a file. Data are stored with a line based format: Action are defined as follow: -R tag is removed, +A tag is added, -M tag is moved (old value), +M tag is moved (new value), Example: +A 875517b4806a848f942811a315a5bce30804ae85 t5 See documentation of difftags output for details about the input. s +A %s %s s -R %s %s s -M %s %s s +M %s %s N(RRtwrite( tfptdifflisttaddtremovet updateoldt updatenewR'R*R(((s4/usr/lib64/python2.7/site-packages/mercurial/tags.pyt writediffs    c C@st||\}}}}}|dk rAi}t|||Sxt|D]}qNWt|t|} t||| }|rt||||n|S(sFind global tags in a repo: return a tagsmap tagsmap: tag name to (node, hist) 2-tuples. The tags cache is read and updated as a side-effect of calling. N(t _readtagcacheRt _updatetagstreversedRRt_writetagcache( RRtheadsttagfnodetvalidt cachetagst shouldwritetalltagstheadR((s4/usr/lib64/python2.7/site-packages/mercurial/tags.pytfindglobaltagss  cC@sbt}g}xL|D]D}|j|}|r||kr|j||j|qqW|S(sreturn a list of unique fnodes The order of this list matches the order of "nodes". Preserving this order is important as reading tags in different order provides different results.(tsettgetR/R (R9RtseenRtnotfnode((s4/usr/lib64/python2.7/site-packages/mercurial/tags.pyRs   cC@si}d}xo|D]g}|dkr=|jdd|}n|j|}t|||jj|}t||qW|S(s~return a tagsmap from a list of file-node tagsmap: tag name to (node, hist) 2-tuples. The order of the list matters.s.hgtagstfileidN(Rtfilectxt _readtagstdatat splitlinesR5(RRRR=tfctxRDtfiletags((s4/usr/lib64/python2.7/site-packages/mercurial/tags.pyRs  !c C@sy|jjd}Wn,tk rD}|jtjkr@ndSXt|||jddtj}|j }xNt |D]@}y|j ||dWqt t fk r||=qXqWt||d|dS(s5Read local tags in repo. Update alltags and tagtypes.t localtagsNtrecodeitlocal(tvfstreadtIOErrorterrnotENOENTRGRIRt fromlocalR tlisttrevt LookupErrort ValueErrorR5( RRR=ttagtypesRHtinstRKtcltt((s4/usr/lib64/python2.7/site-packages/mercurial/tags.pyt readlocaltagss   c@sitj}tj}dfd}x)t|D]\} } d7| sbq@ny| jdd\} } Wntk r|dq@nX| j} |r|| } nyt| } Wn"tk r|d| q@nX|r1| |krg|| eZdZdZedZdZdZdZRS(s?Persistent cache mapping revisions to .hgtags filenodes. The cache is an array of records. Each item in the array corresponds to a changelog revision. Values in the array contain the first 4 bytes of the node hash and the 20 bytes .hgtags filenode for that revision. The first 4 bytes are present as a form of verification. Repository stripping and rewriting may change the node at a numeric revision in the changelog. The changeset fragment serves as a verifier to detect rewriting. This logic is shared with the rev branch cache (see branchmap.py). The instance holds in memory the full cache content but entries are only parsed on read. Instances behave like lists. ``c[i]`` works where i is a rev or changeset node. Missing indexes are populated automatically on access. cC@s||_d|_d|_y|jjt}Wnttfk rPd}nXt||_ t |j }|t }t |j }d|_||kr||_|j jd||nI||kr x%t||D]}|j jqWt |j |_ndS(NiRs(t_repoRRRRPt_fnodescachefileRRQt bytearrayt_rawRvR t_fnodesrecsizeRt _dirtyoffsetRwtrangeR(tselfRRHtcllent wantedlentrawlenti((s4/usr/lib64/python2.7/site-packages/mercurial/tags.pyt__init__s&         c C@s|j|}|j}|jd7_|t}d|j||t!}|dd!}|tkr|dd!}||kr|jd7_|dSn|sdSy|jd} Wnt j k rt } nX|j ||| | S(sObtain the filenode of the .hgtags file at a specified revision. If the value is in the cache, the entry will be validated and returned. Otherwise, the filenode will be computed and returned unless "computemissing" is False, in which case None will be returned without any potentially expensive computation being performed. If an .hgtags does not exist at the specified revision, nullid is returned. is%siis.hgtagsN( RRVRRRt_fnodesmissingrecRRtfilenodeRRWRt _writeentry( RRtcomputemissingtctxRVtoffsettrecordt properprefixt fileprefixRD((s4/usr/lib64/python2.7/site-packages/mercurial/tags.pyRs&         cC@sZ|j|}|j|jdt|kr2dS|j|jt|dd!|dS(s/Set the .hgtags filenode for a given changeset.RNii(RRRRRRVR(RRRDR((s4/usr/lib64/python2.7/site-packages/mercurial/tags.pytsetfnodes !cC@sIt||}||j||t+t|jp3d|p<d|_dS(Ni(RRRtminR(RRtprefixRDtentry((s4/usr/lib64/python2.7/site-packages/mercurial/tags.pyRscC@s|jdkrdS|j|j}|s-dS|j}y|jdt}Wn,tjk rz|jj ddt dSXzy|j j t d}z|j }||jkr||_|j|j}n|j|j|j|jj ddt|t f|j|d|_Wd|jXWn?ttfk rt}|jj ddt tj|fnXWd|jXdS(sPerform all necessary writes to cache file. This may no-op if no writes are needed or if a write lock could not be obtained. NtwaitRs9not writing .hg/cache/%s because lock cannot be acquired Rswriting %d bytes to cache/%s scouldn't write cache/%s: %s (RRRRRRRt LockErrorRRRRtopenttellRttruncateRvR,RRQRR t forcebytestrtrelease(RRHRtlocktft actualoffsetRZ((s4/usr/lib64/python2.7/site-packages/mercurial/tags.pyR,sB        ( t__name__t __module__t__doc__RRRRRR,(((s4/usr/lib64/python2.7/site-packages/mercurial/tags.pyRss  & - i(+t __future__RRRRRRRRti18nRRRRRRR R tutilsR RRR+R3R?RRR]RRRrRGR5RR4RR7R'RRRRtobjectR(((s4/usr/lib64/python2.7/site-packages/mercurial/tags.pyt s6 "(5  &    9  ]    H