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

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


��c@s�ddlmZmZmZddlmZddlZddlZddlZddl	Z	idd6Z
d�Zd�Zd�Z
d	�Zd
efd��YZd�Zd
ejfd��YZdS(i�(tbinthextnullid(t_NtdefaulttbranchcCs:|jdd�jdd�jdd�}|jdd�S(	s
    >>> d = {'nl': chr(10), 'bs': chr(92), 'cr': chr(13), 'nul': chr(0)}
    >>> s = "ab%(nl)scd%(bs)s%(bs)sn%(nul)sab%(cr)scd%(bs)s%(nl)s" % d
    >>> s
    'ab\ncd\\\\n\x00ab\rcd\\\n'
    >>> res = _string_escape(s)
    >>> s == res.decode('string_escape')
    True
    s\s\\s
s\ns
s\rts\0(treplace(ttext((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pyt_string_escapes*cCs�tj�}x�|jd�D]}|rd|krm|jdd�}|jdd�}|jdd�}n|jd�jdd	�\}}|||<qqW|S(
s�
    >>> sorted(decodeextra(encodeextra({'foo': 'bar', 'baz': chr(0) + '2'})
    ...                    ).iteritems())
    [('baz', '\x002'), ('branch', 'default'), ('foo', 'bar')]
    >>> sorted(decodeextra(encodeextra({'foo': 'bar',
    ...                                 'baz': chr(92) + chr(0) + '2'})
    ...                    ).iteritems())
    [('baz', '\\\x002'), ('branch', 'default'), ('foo', 'bar')]
    Rs\0s\\s\\
s
tt
string_escapet:i(t
_defaultextratcopytsplitRtdecode(Rtextratltktv((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pytdecodeextras
!cCs@gt|�D] }td|||f�^q
}dj|�S(Ns%s:%sR(tsortedR	tjoin(tdRtitems((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pytencodeextra2s3cCs5djg|j�D]}|j�^q�jd�S(s>strip trailing whitespace and leading and trailing empty liness
(Rt
splitlinestrstriptstrip(tdescR((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pyt	stripdesc7stappendercBs\eZdZd�Zd�Zd�Zd�Zd�Zdd�Zdd	�Z	d
�Z
RS(s`the changelog index must be updated last on disk, so we use this class
    to delay writes to itcCs:||_||_|j�|_tj|�j|_dS(N(tdatatfpttelltoffsettutiltfstattst_sizetsize(tselfR"tbuf((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pyt__init__>s		cCs|jtdj|j��S(NR
(R(tlenRR!(R)((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pytendDscCs|jS(N(R$(R)((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pyR#FscCsdS(N((R)((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pytflushHscCs|jj�dS(N(R"tclose(R)((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pyR/JsicCs�|dkr||_n@|dkr6|j|7_n"|dkrX|j�||_n|j|jkr�|jj|j�ndS(s,virtual file offset spans real file and dataiiiN(R$R-R(R"tseek(R)R$twhence((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pyR0Msi�cCs�d}|j|jkrg|jj|�}|}|jt|�7_|dkrg|t|�8}qgn|dkr�j|j}|jjddj|j��|jd3|jd|||!}|jt|�7_||7}n|S(s5only trick here is reads that span real file and dataR
ii(R$R(R"treadR,R!tinsertR(R)tcounttrettstdoff((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pyR2Xs

cCs/|jjt|��|jt|�7_dS(N(R!tappendtstrR$R,(R)R6((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pytwritejs(t__name__t
__module__t__doc__R+R-R#R.R/R0R2R:(((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pyR ;s					csd����fd�}|S(NtrcsR|�kr�||�S�r<�|d|jdd��St�||���S(Ns.atatw(RR (tnametmode(R*tdiverttopenerttarget(s7/sys/lib/python2.7/site-packages/mercurial/changelog.pytoos

((RDRERCR*RF((R*RCRDREs7/sys/lib/python2.7/site-packages/mercurial/changelog.pytdelayopenernst	changelogcBs�eZd�Zd�Zd�Zddd�Zejd��Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zdd�Zd�Zddd�Zd�ZRS(cCsitjj||d�|jr>|jtjM_t|_n||_t|_t|_	t
�|_dS(Ns
00changelog.i(trevlogR+t
_initemptytversiontREVLOGGENERALDELTAtFalset
_generaldeltat_realopenert_delayedt_divertt	frozensettfilteredrevs(R)RD((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pyR+ys				cCsGx@tt|�ddd�D]"}||jkr|j|�SqWdS(sfiltered version of revlog.tipii�i�N(txrangeR,RStnode(R)ti((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pyttip�s#cs;t�j�dkr%tjj��S�fd�}|�S(s#filtered version of revlog.__iter__ic3s8x1tt���D]}|�jkr|VqqWdS(N(RTR,RS(RV(R)(s7/sys/lib/python2.7/site-packages/mercurial/changelog.pytfilterediter�s(R,RSRIt__iter__(R)RX((R)s7/sys/lib/python2.7/site-packages/mercurial/changelog.pyRY�siccsAx:tt|�j||�D]}||jkr|VqqWdS(sfiltered version of revlog.revsN(tsuperRHtrevsRS(R)tstarttstopRV((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pyR[�s"cCs|j|jd��|jS(Ni(trevRUt
_nodecache(R)((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pytnodemap�scCs9y |j|�}||jkSWntk
r4tSXdS(s"filtered version of revlog.hasnodeN(R^RStKeyErrorRM(R)RURV((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pythasnode�s

cCs&|jr|j�Stt|�j�S(N(RSt	_headrevsRZRHtheadrevs(R)((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pyRd�s	
cOs-|jst�tt|�j||�dS(N(RStAssertionErrorRZRHR(R)targstkwargs((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pyR�scCsRtt|�j|�}||jkrNtjt|�|jtd���n|S(sfiltered version of revlog.revsno node(	RZRHR^RSterrortLookupErrorRt	indexfileR(R)RUR>((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pyR^�s'cCs4||jkrt|��ntt|�j|�S(sfiltered version of revlog.node(RSt
IndexErrorRZRHRU(R)R^((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pyRU�scCs4||jkrt|��ntt|�j|�S(s"filtered version of revlog.linkrev(RSRkRZRHtlinkrev(R)R^((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pyRl�scCs4||jkrt|��ntt|�j|�S(s%filtered version of revlog.parentrevs(RSRkRZRHt
parentrevs(R)R^((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pyRm�scCs4||jkrt|��ntt|�j|�S(s filtered version of revlog.flags(RSRkRZRHtflags(R)R^((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pyRn�scCsOt|_t|�dk|_g|_t|j|j|j|j�|_dS(s2delay visibility of index updates to other readersiN(	tTrueRPR,RQt	_delaybufRGRORjRD(R)((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pytdelayupdate�s
		cCs�t|_|j|_|jr^|j|jd�}|j}|j�tj	||d �nM|j
r�|j|jd�}|jdj|j
��|j�g|_
n|j
|�dS(sfinalize index updatess.ai�R?R
N(RMRPRORDRQRjRAR/R%trenameRpR:Rtcheckinlinesize(R)ttrtnfiletnR"((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pytfinalize�s			
	
cCsItj|j|�}|j|_|j|_|j|_|j|_dS(N(RIRDtindexR`R_t_chunkcache(R)tfileR>((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pytreadpending�s
cCs�|jr|j|j�}|j|jdd�}|j|j��|jdj|j��|j�g|_t|_n|jr�tSt	S(sDcreate a file containing the unfinalized state for pretxnchangegroups.aR@R
(
RpRORjR:R2RR/RoRQRM(R)tfp1tfp2((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pytwritepending�s	
		cCs&|js"tjj|||�ndS(N(RPRIRs(R)RtR"((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pyRs	s	c
CsM|j|�}|s+tdd	gdtfS|jd�}tj||d�}|| jd�}t|d�}tj|d�}|djdd�}t|�dkr�|d�}	yt
|d�}
Wntk
r�d}
nXt}n1t	|d�t
|d�}	}
t|d�}|d}|||	|
f|||fS(
s�
        format used:
        nodeid
        : manifest node in ascii
        user
          : user, no 
 or 
 allowed
        time tz extra
 : date (time is int or float, timezone is int)
                        : extra is metadata, encoded and separated by ''
                        : older versions ignore it
        files

       : files modified by the cset, no 
 or 
 allowed
        (.*)            : comment (free text, ideally utf-8)

        changelog v0 doesn't use extra
        R
is

is
it i(ii(
trevisionRR
RxtencodingttolocalRRR,tfloattintt
ValueErrorR(
R)RURtlastRRtmanifesttuserttdatattimettimezoneRtfiles((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pyR2
s(


	!
c
Cs�tj|�tj|�}}|j�}|sItjtd���nd|krwtjtd�t|���nt|�}|r�dtj	|�}
ndtj
�}
|	r|	jd�}|d
kr�|	d=q|dkrtjtd�|��qn|	r*t|	�}	d|
|	f}
nt
|�||
gt|�d|g}dj|�}
|j|
|t|�||�S(Nsempty usernames
susername %s contains a newlines%d %dRRR
t.tnullRWsthe name '%s' is reserveds%s %s(sdefaultR
(R�R�stip(R�t	fromlocalRRhtRevlogErrorRtreprRR%t	parsedatetmakedatetgetRRRRtaddrevisionR,(R)R�R�Rttransactiontp1tp2R�tdateRt
parseddateRRR((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pytadd3s0
)cCs#tj|j|�djd��S(s�return the branch of a revision

        This function exists because creating a changectx object
        just to access this is costly.iR(R�R�R2R�(R)R^((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pyRXsN(R;R<R+RWRYtNoneR[R%t
propertycacheR`RbRdRR^RURlRmRnRqRwR{R~RsR2R�R(((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pyRHxs*																'$(RURRRti18nRR%RhRIR�R
R	RRRtobjectR RGRH(((s7/sys/lib/python2.7/site-packages/mercurial/changelog.pyt<module>s0
				3	

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.