\x89\x50\x4E\x47\x0D\x0A\x1A\x0A PNG  \x89\x50\x4E\x47\x0D\x0A\x1A\x0A  13\c@@sdZddlmZddlZddlZddlZddlmZddlm Z m Z m Z m Z m Z mZmZmZddlmZejdZejZejZejZejZeZd Zd Zd Z d Z!d Z"dZ#e j$Z$e j%Z%dZ&dZ'dZ(ee'Z)ee(Z*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2ee1Z3ee2Z4ee0Z5dZ6dZ7e6e7>Z8dZ9ee9Z:dZ;dZ<dZ=ie+e,fe&6e=e<fe/6Z>dZ?ej@dddZBe&dZCee&d ZDej@d!ZEej@d"ZFej@d#ZGd$ZHd%eIfd&YZJd'ZKd(ZLd)ZMd*ZNd+ZOd,ZPiZQd-ZRd.ZSd/ZTd0ZUeRd1d2ZVeRd3d4ZWeRd5d6ZXeRd7d8ZYeRd9d:ZZeRd;d<Z[d=Z\ddddd>Z]dS(?sObsolete marker handling An obsolete marker maps an old changeset to a list of new changesets. If the list of new changesets is empty, the old changeset is said to be "killed". Otherwise, the old changeset is being "replaced" by the new changesets. Obsolete markers can be used to record and distribute changeset graph transformations performed by history rewrite operations, and help building new tools to reconcile conflicting rewrite actions. To facilitate conflict resolution, markers include various annotations besides old and news changeset identifiers, such as creation date or author name. The old obsoleted changeset is called a "predecessor" and possible replacements are called "successors". Markers that used changeset X as a predecessor are called "successor markers of X" because they hold information about the successors of X. Markers that use changeset Y as a successors are call "predecessor markers of Y" because they hold information about the predecessors of Y. Examples: - When changeset A is replaced by changeset A', one marker is stored: (A, (A',)) - When changesets A and B are folded into a new changeset C, two markers are stored: (A, (C,)) and (B, (C,)) - When changeset A is simply "pruned" from the graph, a marker is created: (A, ()) - When changeset A is split into B and C, a single marker is used: (A, (B, C)) We use a single marker to distinguish the "split" case from the "divergence" case. If two independent operations rewrite the same changeset A in to A' and A'', we have an error case: divergent rewriting. We can detect it because two markers will be created independently: (A, (B,)) and (A, (C,)) Format ------ Markers are stored in an append-only file stored in '.hg/store/obsstore'. The file starts with a version header: - 1 unsigned byte: version number, starting at zero. The header is followed by the markers. Marker format depend of the version. See comment associated with each format for details. i(tabsolute_importNi(t_(tencodingterrortnodetobsutiltphasestpolicytpycompattutil(tdateutiltparserst createmarkerst allowunstabletexchangecC@sd|}|jjd|}|dk r/|Sy|jjddSWntjtfk rt|jjdd}d|krtSt |dkrt rtS|jj dd}|r|j dn||kSXdS( sTReturns True if the given repository has the given obsolete option enabled. s evolution.%st experimentalt evolutiontallisevolution.createmarkersR N( tuit configbooltNoneRt ConfigErrortAttributeErrortsett configlisttTruetlent_enabledtconfigtadd(trepotoptiont configkeyt newconfigtresult((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt_getoptionvalueis    cC@sqt|t}t|t}t|t}|s9|rX| rXtjtdni|t6|t6|t6S(s5Returns dicts showing state of obsolescence features.sU'createmarkers' obsolete option must be enabled if other obsolete options are enabled(R#tcreatemarkersopttallowunstableoptt exchangeoptRtAbortR(Rtcreatemarkersvaluet unstablevaluet exchangevalue((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt getoptionsscC@st||S(sTReturns True if the given repository has the given obsolete option enabled. (R+(RR((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt isenabledss>BIB20st20scc@s]xV||krX|||t!}|t7}tt|\}}}}d }|rt|} |||| !}tt||}|| 7}n||||!} t| |krtjtd|t| fn||7}t | } y=| j ddj d\} } t | t | f} Wntk rCd } nXd}d| kr}| j dd| j ddf}n9d| kr| j ddf}nd | krd}n|dk r&yGtd |D}x*|D]"}t|d krd}PqqWWq&tk r"d}q&Xntt| j} |||| | |fVqWdS(NsIparsing obsolete marker: metadata is too short, %d bytes expected, got %dtdates0 0t gitp2tp1tp0cs@s|]}tj|VqdS(N(Rtbin(t.0tp((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pys si((gi((t _fm0fsizet_unpackt _fm0fixedt _fm0fnodesizet_fm0nodeRRR'Rt_fm0decodemetatpoptsplittfloattintt ValueErrorRttuplet TypeErrortsortedt iteritems(tdatatofftstoptcurtnumsuctmdsizetflagstpretsucststmetadatatwhentoffsetR.tparentsR5((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt_fm0readmarkerssN     !   '        cC@s|\}}}}}}|t@r:tjtdnt|}|\}}d||f|d<|dk r|sd|dIdhHBBB20st32siitBBcc@st}t}t}t}t}t}t} t} t} t } t j t j } x||kr|| }| |||!\}}}}}}}}||@r\|dkr||}|||!f}n(|||}| |||||!}||kr|}d}q|dkr1||}|||!f}q|||}| |||||!}n|dkr||}|||!f}n(|||}| |||||!}||kr|}d}nQ|dkr||}|||!f}n(|||}| |||||!}|| |}| d| ||||!}g}xjtjdt|dD]M}|||}|||d}|j|||!|||!f|}qgW|||t|||df|fVqQWdS(Nit>iii<(t_fm1parentnoneRUt_fm1nodesha1sizet_fm1nodesha256sizet _fm1nodesha1t_fm1nodesha256t_fm1metapairsizet _fm1metapairt _fm1fsizeR7tstructtStructt _fm1fixedtunpackRRtxrangeRtappendRA(RERFRGtnoneflagtsha2flagtsha1sizetsha2sizetsha1fmttsha2fmttmetasizetmetafmttfsizeRxtufixedto1tttsecsR^RKRItnumpartnummetatprecto2RMto3RRt metapairsizeROtidx((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt_fm1purereadmarkersLsd +             "! cC@s|\}}}}}}t}|t@r1t}nt|}|} |dkrXt} nt|} | | 7} || } tt|} t| | } |dd}d|d|||| t||g}|j||dk r|j|nt | }x|D]\}}t|}t|}|dkrZd||f}t j |n|dkrd|||f}t j |n|j ||j ||||7}qW||dBii(R7(RE((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt_readmarkerversionscC@st|}|sd}n|dkr6t|}n|tkrjtd|}tj|d|n|t|d|||fS(s(Read and enumerate markers from raw datais+parsing obsolete marker: unknown version %rtversioniN(RRRtformatsRRtUnknownVersion(RERFRGt diskversionR((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt _readmarkerss    cC@s td|S(Ns>B(R[(R((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt encodeheaderscc@sBt|d}|r"t|Vnx|D]}||Vq)WdS(Ni(RR(tmarkerst addheaderRt encodeoneR\((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt encodemarkerss  cC@s5x.|D]&}|j|dtj|qWdS(Ni(t setdefaultRR(t successorsRtmark((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt_addsuccessorss cC@sFx?|D]7}x.|dD]"}|j|tj|qWqWdS(Ni(RRR(t predecessorsRRtsuc((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt_addpredecessorss cC@s[xT|D]L}|d}|dk rx-|D]"}|j|tj|q*WqqWdS(Ni(RRRR(tchildrenRRRRR5((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt _addchildrens     cC@s@x9|D]1}tj|dkrtjtdqqWdS(ssearch for marker with invalid data and raise error if needed Exist as a separated function to allow the evolve extension for a more subtle handling. is;bad obsolescence marker detected: invalid successors nullidN(RtnullidRR'R(RR((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt_checkinvalidmarkerss tobsstorecB@seZdZdZeedZdZd Zd Z e Z e d Z dd ddddd ZdZdZedZedZedZedZedZedZdZdZdZRS(sStore obsolete markers Markers can be accessed with two mappings: - predecessors[x] -> set(markers on predecessors edges of x) - successors[x] -> set(markers on successors edges of x) - children[x] -> set(markers on predecessors edges of children(x) RtsuccstflagRdR.RRcC@s(i|_||_||_||_dS(N(tcachestsvfst_defaultformatt _readonly(tselfRt defaultformattreadonly((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt__init__s   cC@s t|jS(N(titert_all(R((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt__iter__ scC@s t|jS(N(RR(R((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt__len__#scC@sj|jds]y|jjdjdkSWq]tk rY}|jtjkrZqZq]Xnt|jS(NRRi( t_cachedRtstattst_sizetOSErrorterrnotENOENTtboolR(Rtinst((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt __nonzero__&s cC@s|jS(sgTrue if marker creation is disabled Remove me in the future when obsolete marker is always on.(R(R((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyR3sic C@s|dkri}n|dkrd|krHtj|jd}q|dk r|jdd}|dkrtj}qqtj}nt|dkrt|nx/|D]'} t| dkrt| qqW||krtdtj t j |nt t |j}xq|D]i\} } y| jd| jdWq6tk rtjdtj| tj| fq6Xq6Wt|t |t||||f} t|j|| gS( s~obsolete: add a new obsolete marker * ensuring it is hashable * check mandatory metadata * encode metadata If you are a human writing code creating marker you want to use the `createmarkers` function in this module instead. return True if a new marker have been added, False if the markers already existed (no op). R.tdevels default-dateisin-marker cycle with %ssutf-8sEobsstore metadata must be valid UTF-8 sequence (key = %r, value = %r)N(RR t parsedateR<t configdatetmakedateRR@RtsysstrRRXRARCRDtdecodetUnicodeDecodeErrorRRtbytestrtbytesR?RR( Rt transactionRRRRRR.RORtsuccRgtvR\((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pytcreate:s:        "  **c C@s|jr!tjtdnt}|jj}g}xP|D]H}|||dd krC||krC|j||j|qCqCW|rT|j dd}zQ|j }|jd|dj t ||dk|j } |j| Wd|jX|jjd} | dk r4| j|n|j|| |jjnt|jjdd } d | t||jdt}x|D]} |j|j| dg|j| dD]} | ds| ^q} |j| g|j| dD]} | ds| ^q} |j| qUW||8}tg|D]} | d^q}||O}||8}||O}q?W|S(sqreturn a set of all obsolescence markers relevant to a set of nodes. "relevant" to a set of nodes mean: - marker that use this changeset as successor - prune marker of direct children on this changeset - recursive application of the two rules on predecessors of these markers It is a set so you cannot rely on order.ii((((RRRRRR( Rtnodest pendingnodest seenmarkerst seennodestprecursorsmarkerst succsmarkersRtdirecttcurrentRtpruned((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pytrelevantmarkerss(         / / #  (RRRRdR.RR(N(t__name__t __module__t__doc__tfieldst _fm1versiontFalseRRRRt__bool__tpropertyRRRRRt propertycacheRRRRRRRRR(((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyRs*     1 &    cC@s|jdd}i}|dk r1||dBsdump%i( t _maxpayloadRaRRzRWtreversedRcR[t _fm0versionR t b85encode( Rtkeystpartst currentlenR\tnextdatat currentpartRtpartRE((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt_pushkeyescapes    cC@s |js iStt|jS(sList markers over pushkey(RRRC(R((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt listmarkers's c C@s|jds-|jjtd|tS|rQ|jjtd|tStj|}|j>|jd(}|j j |||j t SWdQXWdQXdS(sPush markers over pushkeytdumpsunknown key: %rsunexpected old value for %rspushkey: obsolete markersN( t startswithRR RRR t b85decodetlockRRRtinvalidatevolatilesetsR(RRetoldRREttr((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt pushmarker-s  c@sfd}|S(sADecorator to register a function as computing the cache for a setc@s@tkr2d}tj|tfn|t<|S(Ns;duplicated registration for volatileset '%s' (existing: %r)(t cachefuncsRR(tfuncR(tname(s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt decorator?s    ((R(R)((R(s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pytcachefor=scC@sY|j}|jstS||jjkrKt|||jj| set Such access may compute the set and cache it for future use(t unfilteredRt frozensetRR&(RR(((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pytgetrevsGs   cC@s&d|jkr"|jjjndS(sRemove all obsolescence related cache from a repo This remove all cache in obsstore is the obsstore already exist on the repo. (We could be smarter here given the exact event that trigger the cache clearing)RN(t _filecacheRRR(R((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pytclearobscachesXs cC@s|jj|tjS(s-the set of mutable revision in the repository(t _phasecachet getrevsetRt mutablephases(R((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt _mutablerevsdstobsoletec@sJ|jjt|}|jjjtfd|D}|S(sthe set of obsolete revisionsc3@s'|]}|r|VqdS(N((R4tr(tgetnodetisobs(s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pys ns(t changelogRR3RRt __contains__R(Rt notpublictobs((R6R7s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt_computeobsoleteseths   torphancC@s|jj}t|}t|d}||}t}xTt|D]F}x=||D]/}||ksx||krZ|j|PqZqZWqGW|S(s7the set of non obsolete revisions with obsolete parentsR4(R8t parentrevsR3R-RRCR(RtpfunctmutableR4totherstunstableR5R5((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt_computeorphansetqs      t suspendedc@s>|jjt|dtfdt|dDS(s9the set of obsolete parents with non obsolete descendantsR=c3@s!|]}|kr|VqdS(N((R4R5(RD(s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pys sR4(R8t ancestorsR-R(R((RDs8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt_computesuspendedsetstextinctcC@st|dt|dS(s<the set of obsolete parents without non obsolete descendantsR4RD(R-(R((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt_computeextinctsetstphasedivergentc C@st}|jj}tj}|j}|jj}|j}x|j dD]y}||}xdt j |j |gdt D]D} || } | dk r}||| |kr}|j|Pq}q}WqLW|S(s3the set of revs trying to obsolete public revisionss#(not public()) and (not obsolete())t ignoreflagsN(RR0tphaseRtpublicR8tnodemapRRtrevsRtallpredecessorsRt bumpedfixRR( RtbumpedRKRLtclttorevttonodetrevRtpnodetprev((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt_computephasedivergentsets         !  tcontentdivergentc C@s;t}|j}i}|jj}x|jdD]}||}|jj|d}t|}t} x|r2|jd} | | krqsn| j| | |krt j || d|ng|| D]} | r| ^q} t | dkr|j|Pn|j |jj| dqsWq4W|S(sMthe set of rev that compete to be the final successors of some revision. s(not public()) - obsolete()itcachei((( RRR8RRNRRR<RRtsuccessorssetsRR( Rt divergentRtnewermapRTRURRt toprocesstseenRtntnewer((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt_computecontentdivergentsets,          # $cC@smtj|}xD|d|dD]0}|jd|j|j|jq"Wtj|jd S(Niis%di(thashlibtsha1RRURRXtdigest(trelationtusert folddigestR5((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyt makefoldids cC@sU|dkri}nd|kr[|jjddpB|jj}tj||d must be an iterable of ((,...), (, ...)[,{metadata}]) tuple. `old` and `news` are changectx. metadata is an optional dictionary containing metadata for this marker only. It is merged with the global metadata specified through the `metadata` argument of this function. Any string values in metadata must be UTF-8 bytes. Trying to obsolete a public changeset will raise an exception. Current user and date are used except if specified otherwise in the metadata attribute. This function operates within a transaction of its own, but does not take any lock on the repo. RgRsuser.obsmarkerRsevolution.track-operationt operationsevolution.effect-flagssadd-obsolescence-markeriis/Fold markers can only have 1 successors, not %disfold-ids%dsfold-idxs fold-sizes$cannot obsolete public changeset: %sthints see 'hg help phases' for detailscs@s|]}|jVqdS(N(R(R4RN((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pys scs@s|]}|jVqdS(N(R(R4R5((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pys ss#changeset %s cannot obsolete itselfRRR.RORN(RRRtusernameRt fromlocalRRt isinstanceRARRRRiRWtcopyRR@R'RRRRRt geteffectflagtEFFECTFLAGFIELDRzRRtfilteredrevcacheR(Rt relationsRR.RORjtlusert useoperationtsaveeffectflagR$t markerargstrelRRtfoldidtfoldsizetfoldidxRRMt localmetadatatnprectnsucstnparet effectflagtargs((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pyR sn   $         (            !   (^Rt __future__RRRcRuti18nRRTRRRRRRRR tutilsR t importmodR tpackR[RxR7tcalcsizeRRRRR$R%R&R#R+R,RPRURR8R:R6R9RSRaRYR;RRwRpRqRnRoRtRmt_fm1parentshiftt_fm1parentmaskRsRrRRRRRtnogcRRRRRRRRtobjectRR RRRRR%R&R*R-R/R3R<RCRFRHRXRbRiR (((s8/usr/lib64/python2.7/site-packages/mercurial/obsolete.pytEs   :      "       3  +      J ,