�
�c@s�dZddklZlZlZlZlZddklZddk Z ddk
Z
ddkZddkZddk
Z
ddkZddkZddkZddkZeiZeiZeiZeiZeiZdZdZd ZeZeZ e eBZ!dZ"e
i#Z#e
i$Z$d �Z%d
�Z&d�Z'ee�Z(d�Z)d
�Zd�Zde*fd��YZ+de*fd��YZ,de*fd��YZ-dZ.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�(tbinthextnullidtnullrevtshort(t_NiiiicCst|d?�S(Ni(tint(tq((s#/sys/lib/python/mercurial/revlog.pyt getoffset'scCst|d@�S(Ni�(R(R((s#/sys/lib/python/mercurial/revlog.pytgettype*scCstt|�d>|B�S(Ni(tlong(toffsetttype((s#/sys/lib/python/mercurial/revlog.pytoffset_type-scCsx|tjoti�}|i|�n8||g}|i�t|d�}|i|d�|i|�|i�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((s#/sys/lib/python/mercurial/revlog.pythash2s
cCsH|pd|fSnt|�}d }|djon�|djo�ti�}g}d}x?||jo1|d
}|i|i|||!��|}q`W|i|i��ttt|��|jodi |�}q�
t
|�}|d jpt|�|jo-|ddjod|fSnd|fSnd|fS(s7 generate a possibly-compressed representation of text ti,i@BiiittuNi(tlentNonetzlibtcompressobjtappendtcompresstflushtsumtmaptjoint _compress(RRRtztptpostpos2((s#/sys/lib/python/mercurial/revlog.pyR"Gs.
cCs||p|Sn|d}|djo|Sn|djot|�Sn|djo|dSnttd�|��dS(s decompress the given input iRtxRisunknown compression type %rN(t_decompresstRevlogErrorR(Rtt((s#/sys/lib/python/mercurial/revlog.pyt
decompressds
t
lazyparsercBsDeZdZd�Zd�Zdd�Zd�Zddd�ZRS(sK
this class avoids the need to parse the entirety of large indices
cCs�yti|�i}Wntj
o
d}nX||_tit�|_||_ ||i|_
dg|i
|_ht
t<|_d|_d|_d|_dS(Ni(tutiltfstattst_sizetAttributeErrortdataftstructtcalcsizet
indexformatngRtdatasizeRRtindexRRR%tallmaptallt
mapfind_count(tselfR6tsize((s#/sys/lib/python/mercurial/revlog.pyt__init__zs c Cs�|iodSn|i}d|_d}d}|id}|iid�x�||jo�|ii|�}d}xftd�D]X}||t|td!}||i|<|d7}||i joPn||i7}q�W||7}qPWdS(s�
during a commit, we need to make sure the rev being added is
not a duplicate. This requires loading the entire index,
which is fairly slow. loadmap can load up just the node map,
which takes much less time.
Niiii(
R<R:RR6tseektreadtxrangetngshaoffsetR%R( R?tendtcurtcountt blocksizetdatatoffR,tn((s#/sys/lib/python/mercurial/revlog.pytloadmap�s(
c
CsU|iodSn|djoT|ii|�|||ijot|i|d�}n|ii|�}nt|�|i}||i}d}|t|i �|jot|i �|}nx�t
|�D]v}|i ||djoK||||i!}||i ||<|ttd!} |||i| <n||i7}q�WdS(Nii(
R=RR6RBR:tmaxRCRRR;RDRER%(
R?t
blockstartRIRJtlendtiRKR,tbRL((s#/sys/lib/python/mercurial/revlog.pyt loadblock�s(
cCs�|iodSn|idjo*|i�||ijo|SndSn|id7_|id}xJ|i|djo5|djod|_d|_dSn|d8}qkW|d|i}|id}x�djo�t ||d�}|i
i|�|i
i||�}||}x�t
o�|i|d|�}|}|djod||i} | |i}||t|td!}
|
|jo | ||i|i|
<|Sq�q)Pq)W||8}q�WdS(s;search backwards through the index file for a specific nodeiiiiiN(R<RR>RMR%RR;R=RRNR6RBRCtTruetfindRE(R?tnodetlastRFRItstartRJtfindendRKRQRL((s#/sys/lib/python/mercurial/revlog.pytfindnode�sF
cCs�|iodSnt}|djo-d}d|i|i}|i}t}nX|o(||i}||i}||}n)|d@|i}|id}||}x,||jo|i||�||7}q�W|o
t|_ndS(Niii�ii�R=tFalseRRR:RTRS(R?RQRFR=RORI((s#/sys/lib/python/mercurial/revlog.pyt loadindex�s(
N( t__name__t
__module__t__doc__RARMRRSRZR\(((s#/sys/lib/python/mercurial/revlog.pyR1qs -t lazyindexcBsVeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z
RS( s!a lazy version of the index arraycCs
||_dS(N(R)(R?tparser((s#/sys/lib/python/mercurial/revlog.pyRAscCst|ii�S(N(RR)R;(R?((s#/sys/lib/python/mercurial/revlog.pyt__len__scCsE|djo|t|ii�7}n|ii|�|ii|S(Ni(RR)R;R\(R?R*((s#/sys/lib/python/mercurial/revlog.pytloads
cCs'tt|ii|p
|i|��S(N(t_unpackR9R)R;Rc(R?R*((s#/sys/lib/python/mercurial/revlog.pyt__getitem__
scCstt|�|ii|<dS(N(t_packR9R)R;(R?R*titem((s#/sys/lib/python/mercurial/revlog.pyt__setitem__scCs|ii|=dS(N(R)R;(R?R*((s#/sys/lib/python/mercurial/revlog.pyt__delitem__scCs#|iii|tt|��dS(N(R)R;tinsertRfR9(R?R*te((s#/sys/lib/python/mercurial/revlog.pyRjscCs |iiitt|��dS(N(R)R;R!RfR9(R?Rk((s#/sys/lib/python/mercurial/revlog.pyR!s(R]R^R_RARbRcReRhRiRjR!(((s#/sys/lib/python/mercurial/revlog.pyR`s tlazymapcBsMeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z RS(sa lazy version of the node mapcCs
||_dS(N(R)(R?Ra((s#/sys/lib/python/mercurial/revlog.pyRAscCs3|ii|�}|djot|��ndS(N(R)RZRtKeyError(R?tkeyRL((s#/sys/lib/python/mercurial/revlog.pyRcs
cCs8||iijotSn|ii�||iijS(N(R)R%RTRM(R?Rn((s#/sys/lib/python/mercurial/revlog.pyt__contains__ s
ccs�tVx�t|ii�D]m}|ii|}|p$|ii|�|ii|}nt|t�ott |�}n|dVqWdS(Ni(
RRDR)RR;R\t
isinstancetstrRdR9(R?RQtret((s#/sys/lib/python/mercurial/revlog.pyt__iter__%scCswy|ii|SWn^tj
oRy|i|�|ii|SWqstj
otdt|���qsXnXdS(Nsnode (R)R%RmRcR(R?Rn((s#/sys/lib/python/mercurial/revlog.pyRe/s
cCs||ii|<dS(N(R)R%(R?Rntval((s#/sys/lib/python/mercurial/revlog.pyRh8scCs|ii|=dS(N(R)R%(R?Rn((s#/sys/lib/python/mercurial/revlog.pyRi:s(
R]R^R_RARcRoRsReRhRi(((s#/sys/lib/python/mercurial/revlog.pyRls
s>4l20s20s20si8trevlogoldiocBs#eZd�Zd�Zd�ZRS(cCstit�|_dS(N(R7R8t
indexformatv0R@(R?((s#/sys/lib/python/mercurial/revlog.pyRAAsc
Cs+|i}g}htt<}d}}t|�tjo||i�7}nt|�} x�||| jo�||||!}
||7}tt|
�}t|dd�|dd|d|d|i |dt�|i |dt�|df}|i
|�|||d<|d7}q^W||dfS( Niii�iiiii(R@RRRt_prereadsizeRCRdRvR
tgetR!R(
R?tfpRJtinlineRR;tnodemapRLRKRRGRkte2((s#/sys/lib/python/mercurial/revlog.pyt
parseindexDs"
(3
cCsVt|d�|d|d|d||d�||d�|df}tt|�S(Niiiiiii(RRfRv(R?tentryRVtversiontrevR|((s#/sys/lib/python/mercurial/revlog.pyt packentryYs"'(R]R^RAR}R�(((s#/sys/lib/python/mercurial/revlog.pyRu@s s>Qiiiiii20s12xi s>ItrevlogiocBs#eZd�Zd�Zd�ZRS(cCstit�|_dS(N(R7R8R9R@(R?((s#/sys/lib/python/mercurial/revlog.pyRAmsc
Cs�t|�tjo�ti�oz|ort|�}t|�}t|�}t|d�}t|d�}t d|�|d<||d<||dfSq�||i�7}nti
||�\}}} ||| fS(Ni(RRwR2t
openhardlinksR1R`RltlistR R
RRCtparserstparse_index(
R?RyRJRzRaR;R{RkRtcache((s#/sys/lib/python/mercurial/revlog.pyR}ps
cCs;tt|�}|djott|�|d}n|S(Nii(RfR9t
versionformat(R?R~RVRR�R)((s#/sys/lib/python/mercurial/revlog.pyR��s
(R]R^RAR}R�(((s#/sys/lib/python/mercurial/revlog.pyR�ls trevlogcBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z
d �Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd.d�Zd�Zd�Zd.d.d�Zd.d.d�Zd.d.d�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d �Z#d!�Z$d"�Z%d#�Z&d$�Z'd.d%�Z(d.d&�Z)d'�Z*d(�Z+d.d)�Z,d*�Z-d+�Z.d,�Z/d-�Z0RS(/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.
cCs||_|d d|_||_d|_d|_htt<|_g|_ t
}t|d�o&|i}|t
@o|tO}q�nd}yV|i|i�}|it�}t|�djotit|d �d}nWn/tj
o#}|itijo�qnX||_|t@|_|d@}|d@}|tjo.|o'ttd�|i|d ?f��nq|t
jo3|t@o'ttd
�|i|d ?f��n1|t
jo#ttd�|i|f��nt�|_|itjot�|_n|o�y|ii |||i�} Wn4t!t"fj
o"}
ttd�|i��nX| \|_ |_|_|ip|i#�q�n|i gjp+t$|i t%�p|i d
dtjo,|i i&dddd
d
d
d
tf�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.diRt
defversionii�s*index %s unknown flags %#04x for format v0is)index %s unknown flags %#04x for revlogngsindex %s unknown format %dsindex %s is corruptedi�iN(iRi�t indexfiletdatafiletopenerRt_cachet_chunkcacheRRR{R;tREVLOG_DEFAULT_VERSIONthasattrR�tREVLOGNGtREVLOGNGINLINEDATARCRwRR7tunpackR�tIOErrorterrnotENOENTRt_inlinetREVLOGV0R.RR�t_ioRuR}t
ValueErrort
IndexErrort_chunkclearRpR`R!(R?R�R�tvRQtftinsttflagstfmttdRk((s#/sys/lib/python/mercurial/revlog.pyRA�s` "
#cCs1t|it�o|iii||�ndS(s8load a block of indexes all at once from the lazy parserN(RpR;R`R)R\(R?RXRF((s#/sys/lib/python/mercurial/revlog.pyt
_loadindex�scCs=t|it�o&|ii}|i�|i|_ndS(s5loads both the map and the index from the lazy parserN(RpR;R`R)R\R%R{(R?R)((s#/sys/lib/python/mercurial/revlog.pyt
_loadindexmap�s
cCs=t|it�o&|iii�|iii|_ndS(s"loads the map from the lazy parserN(RpR{RlR)RMR%(R?((s#/sys/lib/python/mercurial/revlog.pyt_loadmap�scCs|it|i�d�S(Ni(RVRR;(R?((s#/sys/lib/python/mercurial/revlog.pyttip�scCst|i�dS(Ni(RR;(R?((s#/sys/lib/python/mercurial/revlog.pyRb�sccs&xtt|��D]}|VqWdS(N(RDR(R?RQ((s#/sys/lib/python/mercurial/revlog.pyRs�scCsDy|i|SWn.tj
o"t||itd���nXdS(Nsno node(R{RmtLookupErrorR�R(R?RV((s#/sys/lib/python/mercurial/revlog.pyR��scCs|i|dS(Ni(R;(R?R�((s#/sys/lib/python/mercurial/revlog.pyRV�scCs|i|dS(Ni(R;(R?R�((s#/sys/lib/python/mercurial/revlog.pytlinkrevscCs>|i}||i|�}||dd||ddfS(Niii(R;R�(R?RVRQR�((s#/sys/lib/python/mercurial/revlog.pytparentss cCs|i|dd!S(Nii(R;(R?R�((s#/sys/lib/python/mercurial/revlog.pyt
parentrevsscCst|i|dd?�S(Nii(RR;(R?R�((s#/sys/lib/python/mercurial/revlog.pyRXscCs|i|�|i|�S(N(RXtlength(R?R�((s#/sys/lib/python/mercurial/revlog.pyRF
scCs|i|dS(Ni(R;(R?R�((s#/sys/lib/python/mercurial/revlog.pyR�scCs|i|dS(Ni(R;(R?R�((s#/sys/lib/python/mercurial/revlog.pytbasescCsH|i|d}|djo|Sn|i|i|��}t|�S(s?return the length of the uncompressed text for a given revisionii(R;trevisionRVR(R?R�RR/((s#/sys/lib/python/mercurial/revlog.pyR@s
cCs�t|f�}|g}|o|i|�}nd}x�|o�|id�}||joq;n|tjoq;nx_|i|�D]N}|i|�|joq�n||jo|i|�|i|�q�q�Wq;W|S(sxreturn the set of all nodes ancestral to a given node, including
the node itself, stopping when stop is matchedi(tsetR�tpopRR�taddR!(R?RVtstopt reachabletvisittstopnRLR)((s#/sys/lib/python/mercurial/revlog.pyR�.s&
cgs�t|�}ttg�}x_|oWxP|i|id��D]6}||jo#|i|�|i|�|Vq>q>WqWdS(s:Generate the ancestors of revs using a breadth-first visitiN(R�R�RR�R�R!R�(R?trevsR�tseentparent((s#/sys/lib/python/mercurial/revlog.pyt ancestorsEs
cgs�t|�}xrtt|�dt|��D]Q}xH|i|�D]7}|tjo$||jo|i|�|VPqBqBWq,WdS(s5Generate the descendants of revs in topological orderiN(R�RDtminRR�RR�(R?R�R�RQR,((s#/sys/lib/python/mercurial/revlog.pytdescendantsPs
c
Cs�|djo
tg}n|djo|i�}ng}|D]}||i|�qB~}g}|D]}||i|�ql~}t|i|��}|it�|i|�t�}g}|D]} | |jo|| q�q�~}
xt|
ol|
i d�} | |joq�|i| �x5|i
| �D]$}||jo|
i|�q?q?Wq�t|�}|i
�g}|D]} ||i| �q�~S(sR
returns the topologically sorted list of nodes from the set:
missing = (ancestors(heads) \ ancestors(common))
where ancestors() is the set of ancestors from heads, heads included
if heads is None, the heads of the revlog are used
if common is None, nullid is assumed to be a common node
iN(RRtheadsR�R�R�R�RRR�R�R!R�RRV(
R?tcommonR�t_[1]RLt_[2]thastmissingt_[3]trR�R)t_[4]((s#/sys/lib/python/mercurial/revlog.pytfindmissingZs.
**
2
cCs1gggf}|dj oOt|�}|p|Sntg}|D]}||i|�qE~�}ntg}t}|tjoQ|djoDg}|D]}||i|�q�~tgt|i��fSn|djo t|�d} d}
h}n�t|�}|p|Snt �}
t
i|d�}t |�}tg}|D]}||i|�qU~�} x�|o�|i
�}|tjoqzn|i|�}||jo�||
joS|
i|�|ig}
|i|�D]}|tjo|
|q���q?||jo|i
|�q?qzqzW|
p|Sn|tjoug}|D]}||
jo||qkqk~}|o4tg}|D]}||i|�q�~�}q�|Snt}tg}t |�}|i�}g}x�tt|d�| d�D]�}|i|�}t}|tjo
t}n�||joct}||joLt|i|��}|d|jp|d|jo|i|�q�qnOt|i|��}|d|jp|d|jo|i|�t}n|o�|
djp
||
jo~|i|�|
dj o||jod||<q�|
djo8d||<x+|i|�D]}|i
|d�q�Wq�qqWg}|i�D]"}||djo||q�q�~}t|�}|pt�|pt�|pt�|||fS(sReturn a tuple containing three elements. Elements 1 and 2 contain
a final list bases and heads after all the unreachable ones have been
pruned. Element 0 contains a topologically sorted list of all
nodes that satisfy these constraints:
1. All nodes must be descended from a node in roots (the nodes on
roots are considered descended from themselves).
2. All nodes must also be ancestors of a node in heads (the nodes in
heads are considered to be their own ancestors).
If roots is unspecified, nullid is assumed as the only root.
If heads is unspecified, it is taken to be the output of the
heads method (i.e. a list of all nodes in the repository that
have no children).iiN(RR�R�R�RRRVR�RR�tdicttfromkeysRNR�R�RR�RRDR[RTttupletremoveR!titerkeystAssertionError(R?trootsR�tnonodesR�RLt lowestrevR�R�t
highestrevR�t
nodestotagR�R�R)t_[5]t_[6]tdescendentst
orderedouttisdescendentt_[7]((s#/sys/lib/python/mercurial/revlog.pytnodesbetween�s�
4 D
0
&
24
""
!
<c
Cs,|djo�|djo�t|�}|ptgSndg|d}|i}x8t|�D]*}||}d||d<||d<q_Wg}t|�D]%}||o||i|�q�q�~Sn|djo
t}n|djo
g}ntg} |D]}
| |i|
�q
~ �}|i|�}t|f�}
t|f�}|i}x�t|dt|��D]�}x{||�D]m}||
jo/||jo|
i |�n|i |�n||jo||jo|i
|�q�q�Wq|Wg}|D]}||i|�q~S(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
iiiiN(RRRR;RDRVR�R�R�R�R�(R?RXR�RHtisheadR;R�RkR�R�RLtstoprevststartrevR�R�R�R)R�((s#/sys/lib/python/mercurial/revlog.pyR�s>
A
0
cCs�g}|i|�}x�t|dt|��D]�}g}|i|�D]}|tjo||qIqI~}|o<x`|D]-}||jo|i|i|��q~q~Wq/|tjo|i|i|��q/q/W|S(s!find the children of a given nodei(R�trangeRR�RR!RV(R?RVtcR)R�R�tprtprevs((s#/sys/lib/python/mercurial/revlog.pytchildren>s;
"
cCsht|ttf�o|i|�Snt|�djo5y|}|i|�|SWqotj
oqoXny�t|�}t|�|jo
t�n|djot|�|}n|djp|t|�jo
t�n|i|�SWntt fj
onXt|�djoAy!t
|�}|i|�|SWqdttfj
oqdXndS(Niii((RpR
RRVRR�R�RqR�t
OverflowErrorRt TypeError(R?tidRVR�((s#/sys/lib/python/mercurial/revlog.pyt_matchLs6
c
Cs"t|�djoy�|�d}t||d �}g}|iD]"}|| |jo||qHqH~}g}|D]'}t|�i|�o||q~q~~}t|�djo>t|�djo|dSnt||itd���ndSWqt j
oqXndS(Ni(iiisambiguous identifier(
RRR{Rt
startswithR�R�RRR�(R?R�Rtbin_idR�RLtnlR�((s#/sys/lib/python/mercurial/revlog.pyt
_partialmatchns9;cCsa|i|�}|dj o|Sn|i|�}|o|Snt||itd���dS(s�locate a node based on:
- revision number or str(revision number)
- nodeid or subset of hex nodeid
sno match foundN(R�RR�R�R�R(R?R�RL((s#/sys/lib/python/mercurial/revlog.pytlookups
cCs+|i|�\}}t|||�|jS(s'compare text with a given file revision(R�R(R?RVRRR((s#/sys/lib/python/mercurial/revlog.pytcmp�scCsm|i\}}|t|�|jo4t|�t|�tjo|||f|_n||f|_dS(N(R�RRw(R?RRJtoR�((s#/sys/lib/python/mercurial/revlog.pyt _addchunk�s4cCs�|io|i|i�}n|i|i�}td|�}|i|�|i|�}|i||�||jo|| Sn|S(Ni(R�R�R�R�RNRBRCR�(R?RR�tdft readaheadR�((s#/sys/lib/python/mercurial/revlog.pyt
_loadchunk�s
cCs�|i\}}t|�}||}||}|djo>||jo1|djo||jo|Sn|||!Sn|i||�S(Ni(R�RR�(R?RR�R�R�Rt
cachestarttcacheend((s#/sys/lib/python/mercurial/revlog.pyt _getchunk�s
cCsX|i|�}|i|�|}|io||d|ii7}n|i||�S(Ni(RXRFR�R�R@R�(R?R�tendrevRXR�((s#/sys/lib/python/mercurial/revlog.pyt _chunkraw�s
cCst|i||��S(N(R0R�(R?R�((s#/sys/lib/python/mercurial/revlog.pyt_chunk�scCs
d|_dS(NiR(iR(R�(R?((s#/sys/lib/python/mercurial/revlog.pyR��scCsu|d|jo0|i|�|i|�jo|i|�Snti|i|i|��|i|i|���S(s1return or calculate a delta between two revisionsi(R�R�tmdiffttextdiffR�RV(R?trev1trev2((s#/sys/lib/python/mercurial/revlog.pytrevdiff�s0c
Cs�|tjodSn|io)|id|jot|id�Snd}|i|�}|i|�}|i|dd@o)ttd�|i|dd@��n|ioL|id|jo8|id|jo$|id}t|id�}n|i ||d�|i
||�|djo|i|�}ng}t|d|d�D]}||i|�qa~}t
i||�}|i|�\}} |t||| �jo#ttd�|i|f��n|||f|_|S( s/return an uncompressed revision of a given nodeRiii�sincompatible revision flag %xisintegrity check failed on %s:%dN(RR�RqRR�R�R;R.RR�R�R�RDR�tpatchesR�RR�(
R?RVRR�R�R�R�tbinsRR((s#/sys/lib/python/mercurial/revlog.pyR��s2
2
;c
Cs�|ip#|id�|id�djodSn|i|i�}|djottd�|i��n|d}|i|�}|i|i |�|o|i
�|i�n|i|i d�}z.x'|D]}|i
|i||��q�WWd|i�X|i|iddt�}|itM_t|_xC|D];}|ii|i||i|i|�} |i
| �qIW|i�|i|i||ii�|i�dS(Ni�is%s not found in the transactionitwt
atomictemp(R�RXR�RUR�RR.RR�R�R#tcloseR�twriteR�RTRR�R[R�R�R;RVtrenametreplaceR@R�(
R?ttrRyttrinfottrindextdataoffR�R�RQRk((s#/sys/lib/python/mercurial/revlog.pytcheckinlinesize�s8.
! (
c Cs�d}|ip|i|id�}n|i|id�}z&|i||||||||�SWd|o|i�n|i�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
d - an optional precomputed delta
tasa+N(RR�R�R�R�t_addrevisionR�( R?RttransactiontlinkRRR�tdfhtifh((s#/sys/lib/python/mercurial/revlog.pytaddrevisions
&c Cs�t|||�} | |ijo| Snt|�}
|
d}|i|�}|i|�}
|
oz|p.|i|i|��}ti||�}nt |�}t|d�t|d�}||
|i
|�}n|
p|t|�djo4t |�}t|d�t|d�}|
}nt|
d�|t|�|||i|�|i|�| f}|i
id|�|
|i| <|ii||i|i|
�}|ip||i|i|
�|i|i|
t|��|do|i|d�n|i|d�|i�|i|�nj|
|
|ii7}
|i|i|
|
�|i|�|i|d�|i|d�|i||�| |
|f|_| S(Niiii�(RR{RR�RFR�RVR�R�R"RXR
R�R;RjR�R�RR�R�R�R�R�R#R@RR�(R?RR R
RRR�RRRVtcurrtprevR�RtptextRJRtdistRkR~((s#/sys/lib/python/mercurial/revlog.pyR+sN
'
!
csX�fd�}ti�i|��i|�|�}|djotSn�i|�S(s4calculate the least common ancestor of nodes a and bcs9g}�i|�D]}|tjo||qq~S(N(R�R(R�R�R)(R?(s#/sys/lib/python/mercurial/revlog.pyR�`sN(tancestorR�RRRV(R?RRRR�R�((R?s#/sys/lib/python/mercurial/revlog.pyR]s
'
ccs�g}|D]}||i|�q~}|pti�VdSn|i|d�d}|id|�xWtt|�d�D]?}||||d} }
|i|
�}|dj o||�n|i |�}||d|d||�}| djo,|i
|�}|tit|��7}n|i
| |
�}tit|�t|��V|Vt|�djoAd}
x=|
t|�jo |
d }||
|!V|}
q�Wq�|Vq�Wti�VdS(
sGcalculate a delta group
Given a list of changeset revs, return a set of deltas and
metadata corresponding to nodes. the first delta is
parent(nodes[0]) -> nodes[0] the receiver is guaranteed to
have this parent as it has all history before these
changesets. parent is parent[0]
Niii�iiiii(R�tchangegroupt
closechunkR�RjRDRRVRR�R�R�ttrivialdiffheaderR�tchunkheader(R?tnodelistR�tinfocollectR�RLR�R)R�RRRtnbtmetaR*R+((s#/sys/lib/python/mercurial/revlog.pytgroupis8
*
cCs�t|�}|d}d
}t}}d} }
}|o|i|�}
n|i|id�}||ii}
|io$|i |i|
|
|�d
}n?|i |i|
|�|i |i
|
�|i|i
d�}z�}x�D]�}tid|d �\}}}}||�}||i
jo
|}q�t|d�}~xC||fD]5}||i
jot||itd���q_q_W|p9|}||i
jot||itd���q�n||jo@t|�}t|d�t|d�}ti||�}n||jp|
| ||d jo|o|i�n|i�|i|�}t|�djot|d
�}nti||g�}~|i|||||d
||�}|o9|io.|i|i
d�}|i|id�}n||jottd���nt|�}n/t|
d�|||||i|�|i|�|f}|iid|�||i
|<|ii||i|i|�}|io{|i |�|i |d�|i |d�|i!||�|ip.|i|i
d�}|i|id�}q}n0|i |d�|i |d�|i |�||d||f\}}}}|i"|�}|i#|�} |i|�}
q�Wd
|o|i$�n|i$�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+Rt20s20s20s20siPsunknown parentsunknown baseiisconsistency error adding groupi�N(%RRRRFR�R�R�R@R�R�R�R7R�R{tbufferR�RR"R�tpatchedsizeR#R�R�RR.R
R�R;RjR�RVRR�RR�RXR�(R?R�t
linkmapperR R�R/RVR�RRXRFttextlenRtisizeRtchaintchunkRRtcsR
tdeltaR)tcdeltat cdeltalenRtchkRkR~((s#/sys/lib/python/mercurial/revlog.pytaddgroup�s�
"
##
&
$
!
"cCs,t|�djodSnt|it�o|i�nx/|D]#}|i|d|joPqCqCWdS|i|�}|ip'|i|i|�||i i
}n|||i i
7}|i|i|�d|_
|i�x0t|t|��D]}|i|i|�=q�i|d5dS(s6truncate 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 readd them after this truncation.
iNii�(RRpR;R`R�RXR�R�R�R�R@R�RR�R�RDR{RV(R?tminlinkR R�RFR,((s#/sys/lib/python/mercurial/revlog.pytstrip
s*
cCs�d}t|�o&td|it|�d��}ny<|i|i�}|idd�|i�}||}Wn5tj
o)}|iti jo�nd}nXy�|i|i
�}|idd�|i�}|ii}td||�}|||}|i
oUd} x*|D]"}
| td|i|
��7} q"Wd}|t|�|| }nWn5tj
o)}|iti jo�nd}nX||fS(Niii(RRNRFR�R�RBttellR�R�R�R�R�R@R�R�(R?texpectedR�tactualtddR�RRQtdit databytesR�((s#/sys/lib/python/mercurial/revlog.pyt checksize9s>
&
cCs.|ig}|ip|i|i�n|S(N(R�R�R!R�(R?tres((s#/sys/lib/python/mercurial/revlog.pytfiles\s
N(1R]R^R_RAR�R�R�R�RbRsR�RVR�R�R�RXRFR�R�R@RR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�RR
RRRR)R+R2R4(((s#/sys/lib/python/mercurial/revlog.pyR��s\ >
'�( " %' 2 1 s , #i(6R_RVRRRRRti18nRRRR�R�terrorR2R7RR�tpackRfR�RdR"R'R0R-tsha1RR�R�R�tREVLOG_DEFAULT_FLAGStREVLOG_DEFAULT_FORMATR�RwR.R�RR R
RRtobjectR1R`RlRvtv0shaoffsetRuR9RER�R�R�(((s#/sys/lib/python/mercurial/revlog.pys<module>sH(H$
�%(
|