-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /usr/lib/python2.7/dist-packages/mercurial/
File Upload :
Current File : //usr/lib/python2.7/dist-packages/mercurial/obsolete.pyc


\,Tc@s&dZddlZddlZddlZddlZddlZddlmZejZ	ej
ZdZe
ZdZdZdZejeZejeZdZd	Zd
ZdZdefd
YZdefdYZe
dZdZdZdZdZ dZ!dZ"dZ#dZ$ddZ%ddZ&dZ'ddZ)dZ*iZ+dZ,dZ-d Z.e,d!d"Z/e,d#d$Z0e,d%d&Z1e,d'd(Z2e,d)d*Z3e,d+d,Z4ddd-Z5dS(.s	Obsolete 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 "precursor" and possible
replacements are called "successors". Markers that used changeset X as
a precursor 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 "precursor markers of Y" because they hold
information about the precursors 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 are used:

    (A, (C, 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. Each marker is made of:

- 1 unsigned byte: number of new changesets "N", can be zero.

- 1 unsigned 32-bits integer: metadata size "M" in bytes.

- 1 byte: a bit field. It is reserved for flags used in common
  obsolete marker operations, to avoid repeated decoding of metadata
  entries.

- 20 bytes: obsoleted changeset identifier.

- N*20 bytes: new changesets identifiers.

- M bytes: metadata as a sequence of nul-terminated strings. Each
  string contains a key and a value, separated by a colon ':', without
  additional encoding. Keys cannot contain '' or ':' and values
  cannot contain ''.

iN(t_iis>BIB20st20siccs`d}td|||d!d}|d7}|tkrVtjtd|nt|}x|t|kr[|||t!}|t7}tt|\}}}}d}	|rt|}
||||
!}tt	||}	||
7}n||||!}t||kr=tjtd|t|fn||7}||	||fVqeWdS(s(Read and enumerate markers from raw datais>Bis+parsing obsolete marker: unknown version %rsIparsing obsolete marker: metadata is too short, %d bytes expected, got %dN((
t_unpackt
_fmversiontutiltAbortRtlent_fmfsizet_fmfixedt
_fnodesizet_fmnode(tdatatofftdiskversiontltcurtnbsuctmdsizetflagstpretsucststmetadata((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyt_readmarkerss.





cCsx\|jD]N\}}d|ks1d|kr@tdnd|kr
tdq
q
Wdjgt|D]}d|||f^qrS(smReturn encoded metadata string to string mapping.

    Assume no ':' in key and no '' in both key and value.t:ts*':' and '' are forbidden in metadata key's#':' is forbidden in metadata value's%s:%s(t	iteritemst
ValueErrortjointsorted(tmetatkeytvaluetk((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyt
encodemetascCsLi}x?|jdD].}|r|jd\}}|||<qqW|S(s8Return string to string dictionary from encoded version.RR(tsplit(RtdRRR ((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyt
decodemetastmarkercBsMeZdZdZdZdZdZdZdZdZ	RS(sWrap obsolete marker raw datacCs||_||_d|_dS(N(t_repot_datatNonet_decodedmeta(tselftrepoR((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyt__init__s		cCs
t|jS(N(thashR((R+((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyt__hash__scCs,t|t|krtS|j|jkS(N(ttypetFalseR((R+tother((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyt__eq__scCs|jdS(s#Precursor changeset node identifieri(R((R+((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pytprecnodescCs|jdS(s-List of successor changesets node identifiersi(R((R+((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyt	succnodesscCs/|jdkr(t|jd|_n|jS(sDecoded metadata dictionaryiN(R*R)R%R((R+((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyRscCs7|jdjd}t|dt|dfS(s#Creation date as (unixtime, offset)tdatet ii(RR#tfloattint(R+tparts((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyR6s(
t__name__t
__module__t__doc__R-R/R3R4R5RR6(((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyR&s						tobsstorecBs_eZdZdZdZdZdZd
dddZdZ	dZ
d	ZRS(sStore obsolete markers

    Markers can be accessed with two mappings:
    - precursors[x] -> set(markers on precursors edges of x)
    - successors[x] -> set(markers on successors edges of x)
    cCs\i|_g|_i|_i|_||_|jd}|rX|jt|ndS(NR>(tcachest_allt
precursorst
successorstsopenerttryreadt_loadR(R+RCR((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyR-s					cCs
t|jS(N(titerR@(R+((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyt__iter__scCs
t|jS(N(RR@(R+((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyt__len__scCs
t|jS(N(tboolR@(R+((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyt__nonzero__sicCs|dkri}nd|kr8dtj|d<nt|dkrYt|nx/|D]'}t|dkr`t|q`q`W||krttdtj|nt|t	|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).
        R6s%d %disin-marker cycle with %sN(R)RtmakedateRRRtnodethextstrttupleR9R"RItadd(R+ttransactiontprectsuccstflagRtsuccR&((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pytcreates
	
"*c	Cststjdnt|j}g}x7|D]/}||kr4|j||j|q4q4W|r|jdd}z]|jdt	|j
}|jd|x*t||dkD]}|j|qWWd|j
X|j||jjnt|S(spAdd new markers to the store

        Take care of filtering duplicate.
        Return the number of new marker.s,obsolete feature is not enabled on this repoR>tabiN(t_enabledRRtsetR@RPtappendRCtseekt	_SEEK_ENDttellt_encodemarkerstwritetcloseRER?tclearR(	R+RQtmarkerstknowntnewtmtftoffsettbytes((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyRPs(


cCs t|}|j||dS(N(RRP(R+RQRRb((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pytmergemarkersAscCsx}|D]u}|jj||d \}}|jj|tj|x-|D]%}|jj|tj|qSWqWtj|jkrt	j
tdndS(Nis;bad obsolescence marker detected: invalid successors nullid(R@RZRBt
setdefaultRYRPRARLtnullidRRR(R+RbtmarkRRtsuc((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyREEs

'(N(R;R<R=R-RGRHRJR)RVRPRiRE(((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyR>s					$	ccs7|rtdtVnx|D]}t|VqWdS(Ns>B(t_packRt_encodeonemarker(Rbt	addheaderR&((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyR^Ps
cCsb|\}}}}t|}tt|}|t|||g}|j|t|||S(N(RRR
textendRn(R&RRRRRtformatR((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyRoYs
ic
Csi}g}td}xi|D]a}t|}t||tkrag}d}|j|n|j||t|7}qWxVtt|D]B\}}djtdtg|}	t	j
|	|d|<qW|S(sencode markers into a dict suitable for pushkey exchange

    - binary data is base85 encoded
    - split in chunks smaller than 5300 bytesiits>Bsdump%i(t_maxpayloadRoRRZt	enumeratetreversedRRnRtbase85t	b85encode(
RbtkeysR:t
currentlenR&tnextdatatcurrentparttidxtpartR((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyt_pushkeyescapegs


cCs|js
iSt|jS(sList markers over pushkey(R>R(R,((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pytlistmarkers|s	cCs|jds-|jjtd|dS|rQ|jjtd|dStj|}|j}zF|jd}z%|jj	|||j
dSWd|jXWd|jXdS(sPush markers over pushkeytdumpsunknown key: %risunexpected old value for %rspushkey: obsolete markersiN(t
startswithtuitwarnRRwt	b85decodetlockRQR>RiR`trelease(R,RtoldRdRRttr((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyt
pushmarkers 
ccs&x|jD]}t||Vq
WdS(s*all obsolete markers known in a repositoryN(R>R&(R,t
markerdata((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyt
allmarkerssccsAx:|jjjj|jdD]}t|j|Vq"WdS(s6obsolete marker marking this changeset as a successorsN((R'R>RAtgetRLR&(tctxR((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pytprecursormarkerss(ccsAx:|jjjj|jdD]}t|j|Vq"WdS(s.obsolete marker making this changeset obsoleteN((R'R>RBRRLR&(RR((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pytsuccessormarkerss(ccst|}t|}x|r|j}|Vxo|jj|dD]X}|d|@rbqHnx;|dD]/}||krm|j||j|qmqmWqHWqWdS(sYield node for every successor of <nodes>.

    Some successors may be unknown locally.

    This is a linear yield unsuited to detecting split changesets. It includes
    initial nodes too.iiN((RYtpopRBRRP(R>tnodestignoreflagst	remainingtseentcurrentRlRm((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyt
allsuccessorss	
ccst|}t|}x|r|j}|Vxd|jj|dD]M}|d|@rbqHn|d}||krH|j||j|qHqHWqWdS(sYield node for every precursors of <nodes>.

    Some precursors may be unknown locally.

    This is a linear yield unsuited to detecting folded changesets. It includes
    initial nodes too.iiN((RYRRARRP(R>RRRRRRlRm((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyt
allprecursorss	

cs|j}t|jd|}|jr|jjd}xt||krt|}td|D}g|D]}|jr}|j^q}}|jt	|j|fd|D}t|jd|}qBWntd|DS(sRreturn all nodes in the "foreground" of other node

    The foreground of a revision is anything reachable using parent -> children
    or precursor -> successor relation. It is very similar to "descendant" but
    augmented with obsolescence information.

    Beware that possible obsolescence cycle may result if complex situation.
    s%ln::icss|]}|jVqdS(N(RL(t.0tc((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pys	<genexpr>sc3s!|]}|kr|VqdS(N((Rtn(tnm(s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pys	<genexpr>scss|]}|jVqdS(N(RL(RR((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pys	<genexpr>s(
t
unfilteredRYR>t	changelogtnodemapRtmutableRLtupdateR(R,Rt
foregroundtplenRSRRRc((Rs6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyRs		+cCs|jj}|g}t|}|dkr6i}nxC|r{|d}||krk|j|jq9||kr||kr|fg||<qxg||<q9xt||D]b}xX|dD]I}||kr||krg||<q|j||j|PqqWqPqWg}	xt||D]}gg}
x|dD]~}g}xi|
D]a}xX||D]L}
t	|}x*|
D]"}||kr|j|qqW|j|qoWq^W|}
qKW|	j
|
q1Wg}g}td|	Ddddt}xR|D]J\}}x;|D]}|j|r)Pq)q)W|j||j|qW|j
|||<q9W||S(sYReturn all set of successors of initial nodes

    The successors set of a changeset A are a group of revisions that succeed
    A. It succeeds A as a consistent whole, each revision being only a partial
    replacement. The successors set contains non-obsolete changesets only.

    This function returns the full list of successor sets which is why it
    returns a list of tuples and not just a single tuple. Each tuple is a valid
    successors set. Not that (A,) may be a valid successors set for changeset A
    (see below).

    In most cases, a changeset A will have a single element (e.g. the changeset
    A is replaced by A') in its successors set. Though, it is also common for a
    changeset A to have no elements in its successor set (e.g. the changeset
    has been pruned). Therefore, the returned list of successors sets will be
    [(A',)] or [], respectively.

    When a changeset A is split into A' and B', however, it will result in a
    successors set containing more than a single element, i.e. [(A',B')].
    Divergent changesets will result in multiple successors sets, i.e. [(A',),
    (A'')].

    If a changeset A is not obsolete, then it will conceptually have no
    successors set. To distinguish this from a pruned changeset, the successor
    set will only contain itself, i.e. [(A,)].

    Finally, successors unknown locally are considered to be pruned (obsoleted
    without any successors).

    The optional `cache` parameter is a dictionary that may contain precomputed
    successors sets. It is meant to reuse the computation of a previous call to
    `successorssets` when multiple calls are made at the same time. The cache
    dictionary is updated in place. The caller is responsible for its live
    spawn. Code that makes multiple calls to `successorssets` *must* use this
    cache mechanism or suffer terrible performances.

    iicss'|]}|rt||fVqdS(N(RY(RR((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pys	<genexpr>sRcSst|dS(Ni(R(tx((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyt<lambda>streverseN(R>RBRYR)tremoveRRRZRPtlistRqtTruetissubsetR(R,tinitialnodetcachetsuccmarkerst	toproceedt
stackedsetRRlRmt	succssetstmarksst
productresulttprefixtsuffixtnewssR~Rtfinalt	candidatet
setversiontlistversiontseenset((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pytsuccessorssetssd'			

!


	





ccsD|jjj}x.|D]&}||}|dk	r|VqqWdS(sgyield revision numbers of known nodes passed in parameters

    Unknown revisions are silently ignored.N(RRRR)(R,RttorevRtrev((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyt
_knownrevss

csfd}|S(sADecorator to register a function as computing the cache for a setcs tkst|t<|S(N(t
cachefuncstAssertionError(tfunc(tname(s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyt	decorators
((RR((Rs6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pytcacheforscCsV|j}|jsdS||jjkrHt|||jj|<n|jj|S(syReturn the set of revision that belong to the <name> set

    Such access may compute the set and cache it for future use((RR>R?R(R,R((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pytgetrevss	cCs&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)R>N(t
_filecacheR>R?Ra(R,((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pytclearobscachess	tobsoletecCsvt}|jjj}|jj}xK|jjD]=}||}|dk	r1|||r1|j	|q1q1W|S(sthe set of obsolete revisionsN(
RYRRRt_phasecachetphaseR>RBR)RP(R,tobstgetrevtgetphaseRLR((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyt_computeobsoletesets	tunstablecsHt|dstS|j}tfd|jDS(s7the set of non obsolete revisions with obsolete parentsRc3s!|]}|kr|VqdS(N((Rtr(R(s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pys	<genexpr>s(RRYRtdescendants(R,tcl((Rs6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyt_computeunstablesets
	t	suspendedcs>|jjt|dtfdt|dDS(s9the set of obsolete parents with non obsolete descendantsRc3s!|]}|kr|VqdS(N((RR(R(s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pys	<genexpr>sR(Rt	ancestorsRRY(R,((Rs6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyt_computesuspendedsetstextinctcCst|dt|dS(s<the set of obsolete parents without non obsolete descendantsRR(R(R,((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyt_computeextinctsetstbumpedcCst}|jj}tj}|j}|jj}t|d}x|D]}||||krI||krI|j	|}xdt
|j|gdtD]D}	||	}
|
dk	r|||
|kr|j|PqqWqIqIW|S(s3the set of revs trying to obsolete public revisionsRRN(RYRRtphasestpublicRRRRRLRR>t	bumpedfixR)RP(R,RRRRRRRRLtpnodetprev((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyt_computebumpedsets 			
!
!
t	divergentc
Cst}|j}i}x|jdD]}|jj|jd}t|}x|r|jd}||krt|||ng||D]}|r|^q}	t|	dkr|j|j	Pn|j
|jj|dqXWq(W|S(sMthe set of rev that compete to be the final successors of some revision.
    s(not public()) - obsolete()ii(((RYR>RARRLRRRRPRR(
R,RR>tnewermapRRlt	toprocessRRRtnewer((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyt_computedivergentset&s 			#$cCso|dkri}nd|kr8dtj|d<nd|krZ|jj|d<n|jd}zx|D]}|d}|d}|j}dt|kr|j|dn|j	stj
d|n|j}	td	|D}
|	|
kr%tj
d
|n|j
j||	|
|||jjqsW|jWd|jXdS(sqAdd obsolete markers between changesets in a repo

    <relations> must be an iterable of (<old>, (<new>, ...)[,{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,

    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.
    R6s%i %itusersadd-obsolescence-markeriiis'cannot obsolete immutable changeset: %scss|]}|jVqdS(N(RL(RR((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pys	<genexpr>`ss#changeset %s cannot obsolete itselfN(R)RRKRtusernameRQtcopyRRRRRLROR>RVtfilteredrevcacheRaR`R(R,t	relationsRTRRtrelRRRt
localmetadatatnprectnsucs((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyt
createmarkers<s2	


	
(6R=tstructRRwRLRti18nRtpackRntunpackRR\R1RXRRR
tcalcsizeRR	RRR"R%tobjectR&R>R^RoRtRRRRRRRRRR)RRRRRRRRRRRRR(((s6/usr/lib/python2.7/dist-packages/mercurial/obsolete.pyt<module>VsX$		 	!			$k													

Copyright © 2017 || Recoded By Mr.Bumblebee