Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/site-packages/mercurial/revlog.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


��c@s�dZddlmZmZmZmZddlmZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZejZejZejZejZejZdZdZdZdZeZeZ e eBZ!eeBZ"dZ#d	Z$d
Z%ej&Z&ej'Z'd�Z(d�Z)d
�Z*ee�Z+d�Z,d�ZdZ-dZ.de/fd��YZ0dZ1dZ2dZ3de/fd��YZ4de/fd��YZ5dS(s�Storage back-end for Mercurial.

This provides efficient delta storage with O(1) retrieve and append
and O(changes) merge between branches.
i�(tbinthextnullidtnullrev(t_NiiiiiicCst|d?�S(Ni(tint(tq((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyt	getoffset.scCst|d@�S(Ni�(R(R((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pytgettype1scCstt|�d>|B�S(Ni(tlong(toffsetttype((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pytoffset_type4scCsv|tkr(tj�}|j|�n7||g}|j�t|d�}|j|d�|j|�|j�S(s�generate a hash from the given text and its parent hashes

    This hash combines both the current file contents and its history
    in a manner that makes it easy to distinguish nodes with the same
    content in the revision graph.
    ii(Rtnullhashtcopytupdatetsortt_shatdigest(ttexttp1tp2tstl((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pythash9s

cCs�|s
|S|d}|dkr$|S|dkrvyt|�SWqvtjk
rr}ttd�t|���qvXn|dkr�|dSttd�|��dS(	s decompress the given input ittxsrevlog decompress error: %stuisunknown compression type %rN(t_decompresstzlibterrortRevlogErrorRtstr(Rttte((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyt
decompressNs
#s>4l20s20s20si8trevlogoldiocBs#eZd�Zd�Zd�ZRS(cCstjt�|_dS(N(tstructtcalcsizet
indexformatv0tsize(tself((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyt__init__jsc	Cs%|j}g}itt6}d}}t|�}x�|||kr�|||!}	||7}tt|	�}
t|
dd�|
dd|
d|
d|j|
dt�|j|
dt�|
df}|j|�|||
d<|d7}q5W|jdddddddtf�||dfS(	Niii�iiiii(
R(RRtlent_unpackR'RtgettappendtNone(R)tdatatinlineRtindextnodemaptntoffRtcurR"te2((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyt
parseindexms 	


(3
%cCs{t|d�r%ttd���nt|d�|d|d|d||d�||d�|df}tt|�S(	Nisindex entry flags need RevlogNGiiiiii(RRRRt_packR'(R)tentrytnodetversiontrevR7((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyt	packentry�s
"'(t__name__t
__module__R*R8R>(((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyR$is		s>Qiiiiii20s12xi s>ItrevlogiocBs#eZd�Zd�Zd�ZRS(cCstjt�|_dS(N(R%R&t
indexformatngR((R)((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyR*�scCs1tj||�\}}|t|dd�|fS(NR3(tparserstparse_index2tgetattrR/(R)R0R1R2tcache((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyR8�scCs9tt|�}|dkr5tt|�|d}n|S(Nii(R9RBt
versionformat(R)R:R;R<R=tp((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyR>�s(R?R@R*R8R>(((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyRA�s		trevlogcBs?eZdZd�Zd�Zd�Zd�Zdd9d�Ze	j
d��Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZeZded�Zd�Zd9d9d�Zd9d9d�Zd9d9d�Zd9d9d�Z d�Z!d�Z"d9d9d�Z#d�Z$d�Z%d �Z&d!�Z'd"�Z(d#�Z)d$�Z*d%�Z+d&�Z,d'�Z-d(�Z.d)�Z/d*�Z0d+�Z1d,�Z2d-�Z3d.�Z4d/�Z5d9d0�Z6d9d1�Z7d2�Z8d3�Z9d9d4�Z:d5�Z;d6�Z<d7�Z=d8�Z>RS(:sM
    the underlying revision storage object

    A revlog consists of two parts, an index and the revision data.

    The index is a file with a fixed record size containing
    information on each revision, including its nodeid (hash), the
    nodeids of its parents, the position and offset of its data within
    the data file, and the revision it's based on. Finally, each entry
    contains a linkrev entry that can serve as a pointer to external
    data.

    The revision data itself is a linear collection of data chunks.
    Each chunk represents a revision and is usually represented as a
    delta against the previous chunk. To bound lookup time, runs of
    deltas are limited to about 2 times the length of the original
    version data. This makes retrieval of a version proportional to
    its size, or O(1) relative to the number of revisions.

    Both pieces of the revlog are written to in an append-only
    fashion, which means we never need to rewrite a file to insert or
    remove data, and can use some simple techniques to avoid the need
    for locking while reading.
    cCs||_|d d|_||_d|_d|_d|_g|_i|_it	t
6|_d|_t
}t|dd�}|dk	r�d|kr�d|kr�|tO}q�q�d}nd}t|_yd|j|j�}|j�}|j�t|�dkr0tjt|d �d}t|_nWn+tk
r^}|jtjkr_�q_nX||_|t@|_|t@|_|d@}|d	@}	|	t kr�|r�t!t"d
�|j|d?f��nk|	t#kr|t$@rt!t"d�|j|d?f��n.|	t#kr9t!t"d
�|j|	f��nt%�|_&|jt krct'�|_&ny|j&j(||j�}
Wn0t)t*fk
r�t!t"d�|j��nX|
\|_}|_|dk	r�|_+|_n|js�j,�ndS(s�
        create a revlog object

        opener is a function that abstracts the file opening operation
        and can be used to implement COW semantics or the like.
        i�s.dittoptionstrevlogv1tgeneraldeltaii�s*index %s unknown flags %#04x for format v0is)index %s unknown flags %#04x for revlogngsindex %s unknown format %dsindex %s is corruptedN(ii(iRJi�t	indexfiletdatafiletopenerR/t_cachet
_basecachet_chunkcacheR2t_pcacheRRt
_nodecachet_nodepostREVLOG_DEFAULT_VERSIONREtREVLOGGENERALDELTAtTruet
_initemptytreadtcloseR+R%tunpackRGtFalsetIOErrorterrnotENOENTR<tREVLOGNGINLINEDATAt_inlinet
_generaldeltatREVLOGV0RRtREVLOGNGtREVLOGNG_FLAGSRAt_ioR$R8t
ValueErrort
IndexErrorR3t_chunkclear(R)RPRNtvtoptstitftinsttflagstfmttdR3((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyR*�sn										

	



	cCs|jt|j�d�S(Ni(R;R+R2(R)((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyttipscCst|j�dS(Ni(R+R2(R)((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyt__len__scCsttt|���S(N(titertxrangeR+(R)((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyt__iter__sicCsPd}|dk	r4||kr'd}n||7}nt|�}t|||�S(s8iterate over all rev in this revlog (from start to stop)ii�N(R/R+Rw(R)tstarttstoptstep((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pytrevs
s	
cCs|j|jd��|jS(Ni(R=R;RU(R)((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyR3scCs.y|j|�tSWntk
r)tSXdS(N(R=RYtKeyErrorR^(R)R;((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pythasnodes


cCsBy|jj�Wn*tk
r=itt6|_d|_nXdS(N(RUtclearcachestAttributeErrorRRR/RV(R)((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyR!s

cCs�y|j|SWn�tk
r=t||jtd���n�tk
r�|j}|j}|j}|dkr�t	|�d}nxOt
|dd�D];}||d}|||<||kr�|d|_|Sq�Wt||jtd���nXdS(Nsno nodeii�ii(RURtLookupErrorRNRR}R2RVR/R+Rw(R)R;R4RnRHtrRl((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyR=(s"

			

cCs|j|dS(Ni(R2(R)R=((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyR;=scCs|j|dS(Ni(R2(R)R=((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pytlinkrev?scCs>|j}||j|�}||dd||ddfS(Niii(R2R=(R)R;RnRs((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pytparentsAs	cCs|j|dd!S(Nii(R2(R)R=((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyt
parentrevsEscCst|j|dd?�S(Nii(RR2(R)R=((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyRyGscCs|j|�|j|�S(N(Rytlength(R)R=((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pytendIscCs|j|dS(Ni(R2(R)R=((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyR�KscCsB|j}||d}x$||kr=|}||d}qW|S(Ni(R2(R)R=R2tbase((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyt	chainbaseMs	cCs|j|dd@S(Nii�(R2(R)R=((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyRqTscCsC|j|d}|dkr!|S|j|j|��}t|�S(s?return the length of the uncompressed text for a given revisionii(R2trevisionR;R+(R)R=RR!((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pytrawsizeVs
cCstj||d|d|�S(s�Generate the ancestors of 'revs' in reverse topological order.
        Does not generate revs lower than stoprev.

        See the documentation for ancestor.lazyancestors for more details.tstoprevt	inclusive(tancestort
lazyancestors(R)R|R�R�((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyt	ancestors`sccs�t|�}|tkr2x|D]}|VqWdSt|�}xf|jd|d�D]N}xE|j|�D]4}|tkrk||krk|j|�|VPqkqkWqUWdS(s$Generate the descendants of 'revs' in revision order.

        Yield a sequence of revision numbers starting with a child of
        some rev in revs, i.e., each revision is *not* considered a
        descendant of itself.  Results are ordered by revision number (a
        topological sort).NRyi(tminRtsetR|R�tadd(R)R|tfirstRntseenR((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pytdescendantsis
	
csx|dkrtg}n|dkr3|j�}ng|D]}|j|�^q:}g|D]}|j|�^q\}t|j|����jt��j|�t�}t	j
�fd�|D��}xk|r;|j�}||kr�q�|j|�x3|j|�D]"}|�kr|j
|�qqWq�Wt|�}|j��g|D]}|j|�^q\fS(s�Return a tuple of the ancestors of common and the ancestors of heads
        that are not ancestors of common. In revset terminology, we return the
        tuple:

          ::common, (::heads) - (::common)

        The list is sorted by revision number, meaning it is
        topologically sorted.

        'heads' and 'common' are both lists of node IDs.  If heads is
        not supplied, uses all of the revlog's heads.  If common is not
        supplied, uses nullid.c3s!|]}|�kr|VqdS(N((t.0R�(thas(s4/sys/lib/python2.7/site-packages/mercurial/revlog.pys	<genexpr>�sN(R/RtheadsR=R�R�R�RRtutiltdequetpopleftR�R.tlistRR;(R)tcommonR�R4tmissingtvisitR�RH((R�s4/sys/lib/python2.7/site-packages/mercurial/revlog.pytfindcommonmissing~s,
""

		

cCsI|dkrtg}n|dkr3|j�}ntj|||j�S(sxReturn the revision numbers of the ancestors of heads that
        are not ancestors of common.

        More specifically, return a list of revision numbers corresponding to
        nodes N such that every N satisfies the following constraints:

          1. N is an ancestor of some node in 'heads'
          2. N is not an ancestor of any node in 'common'

        The list is sorted by revision number, meaning it is
        topologically sorted.

        'heads' and 'common' are both lists of revision numbers.  If heads is
        not supplied, uses all of the revlog's heads.  If common is not
        supplied, uses nullid.N(R/RtheadrevsR�tmissingancestorsR�(R)R�R�((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pytfindmissingrevs�s
cCs�|dkrtg}n|dkr3|j�}ng|D]}|j|�^q:}g|D]}|j|�^q\}gtj|||j�D]}|j|�^q�S(s.Return the ancestors of heads that are not ancestors of common.

        More specifically, return a list of nodes N such that every N
        satisfies the following constraints:

          1. N is an ancestor of some node in 'heads'
          2. N is not an ancestor of any node in 'common'

        The list is sorted by revision number, meaning it is
        topologically sorted.

        'heads' and 'common' are both lists of node IDs.  If heads is
        not supplied, uses all of the revlog's heads.  If common is not
        supplied, uses nullid.N(R/RR�R=R�R�R�R;(R)R�R�R4R�((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pytfindmissing�s""c
Cs�gggf}|dk	r\t|�}|s1|Stg|D]}|j|�^q;�}ntg}t}|tkr�|dkr�g|D]}|j|�^q�tgt|j��fS|dkr�|�d}d}i}n�t|�}|s�St	�}t
j|t�}t	|�}	t
g|	D]}|j|�^q-�}x�|	r|	j�}|tkrrqNn|j|�}||krN||kr�|j|�|	jg|j|�D]}
|
tkr�|
^q��q�|kr�j|�q�qNW|s|S|tkrtg|D]}||kr|^q}|rmtg|D]}|j|�^qL�}q�|Snt}tg}t	|�}|j�}g}x�|jdt
|d�d|d�D]z}|j|�}t}
|tkr�}
n�||kr`t}
||kr�t|j|��}
|
d|ksJ|
d|kr]|j|�q]q�nKt|j|��}
|
d|ks�|
d|kr�|j|�t}
n|
r�|dks�||kr�|j|�|dk	r�|kr�||<qA|dkrAt||<x*|j|�D]}
|j|
d�q!WqAq�q�Wg|j�D]\}}|rR|^qR}t|�}|s�t�|s�t�|s�t�|||fS(s�Return a topological path from 'roots' to 'heads'.

        Return a tuple (nodes, outroots, outheads) where 'nodes' is a
        topologically sorted list of all nodes N that satisfy both of
        these constraints:

          1. N is a descendant of some node in 'roots'
          2. N is an ancestor of some node in 'heads'

        Every node is considered to be both a descendant and an ancestor
        of itself, so every reachable node in 'roots' and 'heads' will be
        included in 'nodes'.

        'outroots' is the list of reachable nodes in 'roots', i.e., the
        subset of 'roots' that is returned in 'nodes'.  Likewise,
        'outheads' is the subset of 'heads' that is also in 'nodes'.

        'roots' and 'heads' are both lists of node IDs.  If 'roots' is
        unspecified, uses nullid as the only root.  If 'heads' is
        unspecified, uses list of all of the revlog's heads.iRyiRzN(R/R�R�R=RRR;R�R+R�tdicttfromkeysR^tmaxtpopR�RR�RR|RYttupletremoveR.t	iteritemstAssertionError(R)trootsR�tnonodesR4t	lowestrevR�t
highestrevR�t
nodestotagRHR�t
orderedouttisdescendanttflag((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pytnodesbetween�s�+	8		(	
%+	,	  
	


+cCs0y|jj�SWntk
r+|j�SXdS(N(R2R�R�t	_headrevs(R)((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyR�ts
cCs�t|�}|stgSdg|d}|j}x<|D]4}d||<||}d||d<||d<q:Wgt|�D]\}}|r|^qS(Niiii(R+RR2t	enumerate(R)tcounttisheadR2R�R"tval((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyR�zs	


cCs�|dkrQ|dkrQt|�s+tgSg|j�D]}|j|�^q8S|dkrft}n|dkr{g}ntg|D]}|j|�^q��}|j|�}t|f�}t|f�}|j}	x�|jd|d�D]}}xt|	|�D]f}
|
|krA||kr1|j	|�n|j	|�n|
|kr|
|kr|j
|
�qqWq�|D]}|j|�^qxS(sreturn the list of all nodes that have no children

        if start is specified, only heads that are descendants of
        start will be returned
        if stop is specified, it will consider all the revs from stop
        as if they had no children
        RyiN(R/R+RR�R;R�R=R�R|R�R�(R)RyRzR�R4tstoprevststartrevt	reachableR�R�RH((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyR��s,&		(	cCs�g}|j|�}x�|jd|d�D]�}g|j|�D]}|tkrB|^qB}|r�x[|D]+}||krm|j|j|��qmqmWq,|tkr,|j|j|��q,q,W|S(s!find the children of a given nodeRyi(R=R|R�RR.R;(R)R;tcRHR�tprtprevs((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pytchildren�s.
 cCsQ|tkrtSx:|j|g�D]&}||kr9tS||kr#Pq#q#WtS(N(RRYR�R^(R)RyR�Rn((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyt
descendant�scCs�|j|�|j|�}}y|jj||�}Wn/ttfk
ritj|j||�}nX|r�tt|j	|��St
S(s4calculate the least common ancestor of nodes a and b(R=R2R�R�t
OverflowErrorR�R�R�tmapR;R(R)tatbtancs((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyR��scCsLt|t�r|j|�St|�dkr`y|}|j|�|SWq`tk
r\q`Xny~t|�}t|�|kr�t�n|dkr�t|�|}n|dks�|t|�kr�t�n|j|�SWnttfk
r�nXt|�dkrHy!t	|�}|j|�|SWqHt
tfk
rDqHXndS(Niii((t
isinstanceRR;R+R=R�R RiR�Rt	TypeError(R)tidR;R=((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyt_match�s6


		
cCs�y|jj|�SWnBtk
rBt||jtd���nttfk
rXnX||jkrs|j|St	|�dkr�y�	|�d}t
||d �}g|jD]#}|dj|�r�|d^q�}g|D]!}t|�j|�r�^q�t	|�dkrht	|�dkrJ|d|j|<|dSt||jtd���ndSWq�tk
r�q�XndS(Nsambiguous identifieri(iiii(R2tpartialmatchRR�RNRR�RiRTR+Rt
startswithRR/R�(R)R�RtprefixR"tnlR4((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyt
_partialmatch�s.
3.
cCsW|j|�}|dk	r|S|j|�}|r8|St||jtd���dS(s�locate a node based on:
            - revision number or str(revision number)
            - nodeid or subset of hex nodeid
        sno match foundN(R�R/R�R�RNR(R)R�R4((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pytlookupscCs+|j|�\}}t|||�|kS(spcompare text with a given file revision

        returns True if text is different than what is stored.
        (R�R(R)R;RRR((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pytcmpscCsj|j\}}|t|�|krWt|�t|�tkrW|||f|_n||f|_dS(N(RSR+t
_chunksize(R)R
R0toRs((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyt	_addchunk$s2cCs�|jr|j|j�}n|j|j�}td|�}|j|�|j|�}|j�|j||�||kr�t	j
|d|�S|S(Nii(RcRPRNROR�tseekR[R\R�R�tbuffer(R)R
R�tdft	readaheadRs((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyt
_loadchunk,s	

cCs�|j\}}t|�}||}||}|dkrz||krz|dkrc||krc|Stj||||�S|j||�S(Ni(RSR+R�R�R�(R)R
R�R�RsRt
cachestarttcacheend((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyt	_getchunk;s

cCsV|j|�}|j|�|}|jrF||d|jj7}n|j||�S(Ni(RyR�RcRhR(R�(R)R�tendrevRyR�((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyt	_chunkrawIs
	cCst|j||��S(N(R#R�(R)R=((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyt_chunkPscCs
|j|�S(N(R�(R)R=((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyt
_chunkbaseSscCs
d|_dS(NiRJ(iRJ(RS(R)((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyRkVscCs:|j|d}||kr!tS|jr.|S|dSdS(s(return deltaparent of the given revisioniiN(R2RRd(R)R=R�((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pytdeltaparentYs	cCsV|tkr4|j|�|kr4t|j|��Stj|j|�|j|��S(s1return or calculate a delta between two revisions(RR�R R�tmdiffttextdiffR�(R)trev1trev2((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pytrevdiffcs!cCs&t|t�r'|}|j|�}n|}d}d}|tkrIdS|jr�|jd|krp|jdS|jd}nd}|dkr�|j|�}n|j|�t@r�t	t
d�|j|�t@��ng}|j}|j}|}	||	}
xT|	|
dkr]|	|kr]|j
|	�|rF|
d}	n
|	d8}	||	}
q
W|j�|	}|	|kr�|jd}nd|_|j||�|dkr�t|j|��}ng|D]}|j|�^q�}
tj||
�}|j|||�}|||f|_|S(sTreturn an uncompressed revision of a given node or revision
        number.
        RJiiisincompatible revision flag %xiN(R�RR;R/RRQR=RqtREVIDX_KNOWN_FLAGSRRR2RdR.treverseR�R R�R�R�tpatchest
_checkhash(R)t	nodeorrevR=R;t	cachedrevRtchainR2RMtiterrevR"R�R�tbins((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyR�ksT			




	"cCsS|j|�\}}|t|||�krOttd�|j|f��n|S(Nsintegrity check failed on %s:%d(R�RRRRN(R)RR;R=RR((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyR��s
c
Cs�|js,|jd�|jd�tkr0dS|j|j�}|dkrjttd�|j��n|d}|j|�}|j	|j
|�|r�|j�|j�n|j
|j
d�}z.x'|D]}|j|j||��q�WWd|j�X|j
|jddt�}|jtM_t|_xC|D];}|jj|j||j|j|�}	|j|	�q?W|j�|j|j||jj�|j�dS(Ni�s%s not found in the transactionitwt
atomictemp(RcRyR�t
_maxinlinetfindRNR/RRR�ROtflushR\RPtwriteR�RYR<RbR^RhR>R2R;treplaceR(Rk(
R)ttrtfpttrinfottrindextdataoffR�R�RnR"((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pytcheckinlinesize�s4,



!	
(
c

Cs�t|||�}||jkr%|Sd}|jsL|j|jd�}n|j|jd�}	z)|j||||||||	|�SWd|r�|j�n|	j�XdS(sadd a revision to the log

        text - the revision data to add
        transaction - the transaction object used for rollback
        link - the linkrev data to add
        p1, p2 - the parent nodeids of the revision
        cachedelta - an optional precomputed delta
        R�sa+N(	RR3R/RcRPRORNt_addrevisionR\(
R)RttransactiontlinkRRt
cachedeltaR;tdfhtifh((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pytaddrevision�s		
cCs0|sd|fSt|�}d	}|dkr1n�|dkr�tj�}g}d}x=||kr�|d
}|j|j|||!��|}qXW|j|j��ttt|��|kr�j	|�}q�t
|�}|d	kst|�|kr&|ddkrd|fSd|fSd|fS(s7 generate a possibly-compressed representation of text RJi,i@BiiiRRNi(R+R/RtcompressobjR.tcompressR�tsumR�tjoint	_compress(R)RRRtzRHtpostpos2((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyR�s.




c
	s[|g���������fd�������fd�}
t��}|d}|}
}�j|��d}d}�j��j���j��}}|tkr1�jr
|�dkr�|
|�}q|�dkr�|�}q|
|�}n|
|�}|\}}}}
}n|dkrctj�j	�d��d�}nt|�}|dks�||dkr���}�j
|�}t|d�t|d�}|}
}nt�|�|||
|||�f}�jj
d|�|�j�<�jj|�j�j|�}�js�|j�j��|j�j|t|��|dr��j|d�n�j|d��j��j|�ni�|�jj7�|j�j�|��j|��j|d��j|d��j|��t|�tkrH�||f�_n||f�_�S(sinternal function to add revisions to the log

        see addrevision for argument descriptions.
        invariants:
        - text is optional (can be None); if not set, cachedelta must be set.
          if both are set, they must correspond to each other.
        cs��ddk	r�dS�r+�j�n�j��j�j�d��}tj|�d��d<t�d���}|�kr�ttd���n�dS(Niisconsistency error in delta(	R/R�R�R;R�tpatchRRR(tbasetexttchk(tbtextRRRR;RRR)(s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyt	buildtexts

c	s��r#�d|kr#�d}n3��}�j�j|��}tj||�}�j|�}t|d�t|d�}�d|kr��d}n�j|�}|��j|�}�jr�|}n|}|||||fS(Nii(	R�R;R�R�RR+R�RyRd(	R=tdeltaR!tptextR0RR�tdistR�(t	basecacheRRR
R)(s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyt
builddelta's
	
		iiii�N(R+R�R/RRR=RRdR�tpatchedsizeR�RRR2tinsertR3RhR>R;R<RcR�RORNR�R�R(R�RR RQ(R)R;RRRRRRRRRtcurrtprevR�R�RqRstp1rtp2rRRR0ttextlenR"R:((RRRRRRR;R
RRR)s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyR�sh		$

			

!	


c#s6t|�dkr!|j�VdS�jr6|tk	s<|rytj��}t�fd�|D��}|j|�}n(tg|D]}�j	|�^q��}�j
|d�d}|jd|�x\tt|�d�D]D}||||d}	}
x"|j
�|
|	�D]}|VqWq�W|j�VdS(s�Calculate a delta group, yielding a sequence of changegroup chunks
        (strings).

        Given a list of changeset revs, return a set of deltas and
        metadata corresponding to nodes. The first delta is
        first parent(nodelist[0]) -> nodelist[0], the receiver is
        guaranteed to have this parent as it has all history before
        these changesets. In the case firstparent is nullrev the
        changegroup starts with a full revision.
        iNc3s|]}�j|�VqdS(N(R=(R�R4(R)(s4/sys/lib/python2.7/site-packages/mercurial/revlog.pys	<genexpr>�si(R+R\RdR^tdagutilt	revlogdagR�t	linearizetsortedR=R�RRwtrevchunk(R)tnodelisttbundlertreordertdagR|R4RHR�RRR�((R)s4/sys/lib/python2.7/site-packages/mercurial/revlog.pytgroupzs
(
c
Cs�g}d
}t|�}d}|r:|j|d�}n|j|jd�}||jj}	|jr�|j|j||	|�d
}
n>|j|j|	|�|j|j	|�|j|j	d�}
z�d
}x�t
r\|j|�}|s�|d}|d}
|d}|d}|d	}|d
}|j|�||�}||j
krd|}q�nxA|
|fD]3}||j
krqt||jtd���qqqqW||j
kr�t||jtd���n|j|�}|j|d
|||
|||f||
�}|
r�|jr�|j�|j|j	d�}
|j|jd�}q�q�WWd
|
rt|
j�n|j�X|S(s�
        add a delta group

        given a set of deltas, add them to the revision log. the
        first delta is against its parent, which should be in our
        log, the rest are against the previous delta.
        iisa+R�R;RRtcst	deltabaseRsunknown parentsunknown delta baseN(R/R+R�RPRNRhR(RcR�RORYt
deltachunkR.R3R�RR=R�R\(R)tbundlet
linkmapperRtcontentR;R�R�RtisizeRR�t	chunkdataRRR)R*RRRHtbaserev((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pytaddgroup�sb
			







 
cCst|�dkrdSx-|D]!}|j|d|krPqqWdS|j|�}|js�|j|j|�||jj}n|||jj7}|j|j|�d|_
|j�x0t|t|��D]}|j
|j|�=q�W|j|d5dS(s7truncate the revlog on the first revision with a linkrev >= minlink

        This function is called when we're stripping revision minlink and
        its descendants from the repository.

        We have to remove all revisions with linkrev >= minlink, because
        the equivalent changelog revisions will be renumbered after the
        strip.

        So we truncate the revlog on the first of these revisions, and
        trust that the caller has saved the revisions that shouldn't be
        removed and that it'll re-add them after this truncation.
        iNii�(R+R2RyRcR�RORhR(RNR/RQRkRwR3R;(R)tminlinkRR=R�R((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pytstrip�s"
		
cCs�d}t|�r7td|jt|�d��}nyF|j|j�}|jdd�|j�}|j�||}Wn1tk
r�}|j	t	j
kr��nd}nXy�|j|j�}|jdd�|j�}|j�|jj
}td||�}|||}|jrvd}	x*|D]"}
|	td|j|
��7}	q/Wd}|t|�||	}nWn1tk
r�}|j	t	j
kr��nd}nX||fS(Niii(R+R�R�RPROR�ttellR\R_R`RaRNRhR(RcR�(R)texpectedRotactualtddRpRRntdit	databytesR�((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyt	checksizes@%


	
 
cCs,|jg}|js(|j|j�n|S(N(RNRcR.RO(R)tres((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pytfiles8s	N(?R?R@t__doc__R*RtRuRxR/R|R�t
propertycacheR3R~RR=R;R�R�R�RyR�R�R�RqR�R(R^R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�RkR�R�R�R�R�RRR�R(R2R4R;R=(((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyRI�sr	D																		*�	
"		
	
	"											
		@	'		k&	J	)	%ii(6R>R;RRRRti18nRR�R�RCRR�RR%RR`tpackR9R]R,RR
R#Rtsha1RReRfRbRXtREVLOG_DEFAULT_FLAGStREVLOG_DEFAULT_FORMATRWRgR�R�R�RR�RRRR
RR'tv0shaoffsettobjectR$RBtngshaoffsetRGRARI(((s4/sys/lib/python2.7/site-packages/mercurial/revlog.pyt<module>sH"H$					

							+

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.