Plan 9 from Bell Labs’s /usr/web/sources/contrib/bichued/root/sys/lib/python/mercurial/changelog.pyc

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


�
�c	@s�ddklZlZlZddklZddkZddkZddkZddk	Z	d�Z
d�Zd�Zde
fd��YZd	�Zd
eifd��YZdS(i�(tbinthextnullid(t_NcCs:|idd�idd�idd�}|idd�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((s&/sys/lib/python/mercurial/changelog.pyt_string_escapes*cCsZh}xM|id�D]<}|o/|id�idd�\}}|||<qqW|S(NRt
string_escapet:i(tsplittdecode(Rtextratltktv((s&/sys/lib/python/mercurial/changelog.pytdecodeextras!cCsHg}t|�D]!}|td|||f�q~}di|�S(Ns%s:%sR(tsortedRtjoin(tdt_[1]Rtitems((s&/sys/lib/python/mercurial/changelog.pytencodeextra"s;tappendercBs\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:||_||_|i�|_ti|�i|_dS(N(tdatatfpttelltoffsettutiltfstattst_sizetsize(tselfRtbuf((s&/sys/lib/python/mercurial/changelog.pyt__init__*s		cCs|itdi|i��S(Nt(RtlenRR(R ((s&/sys/lib/python/mercurial/changelog.pytend0scCs|iS(N(R(R ((s&/sys/lib/python/mercurial/changelog.pyR2scCsdS(N((R ((s&/sys/lib/python/mercurial/changelog.pytflush4scCs|ii�dS(N(Rtclose(R ((s&/sys/lib/python/mercurial/changelog.pyR'6sicCs�|djo
||_nE|djo|i|7_n%|djo|i�||_n|i|ijo|ii|i�ndS(s,virtual file offset spans real file and dataiiiN(RR%RRtseek(R Rtwhence((s&/sys/lib/python/mercurial/changelog.pyR(9s



i�cCs�d}|i|ijoR|ii|�}|}|it|�7_|djo|t|�8}qkn|djot|i|i}|iiddi|i��|id3|id|||!}|it|�7_||7}n|S(s5only trick here is reads that span real file and dataR#ii(RRRtreadR$RtinsertR(R tcounttrettstdoff((s&/sys/lib/python/mercurial/changelog.pyR*Ds


cCs/|iit|��|it|�7_dS(N(RtappendtstrRR$(R R.((s&/sys/lib/python/mercurial/changelog.pytwriteVs(t__name__t
__module__t__doc__R"R%RR&R'R(R*R2(((s&/sys/lib/python/mercurial/changelog.pyR's					csd����fd�}|S(Ntrcs\|�jo�||�Sn�o!�|d|idd��Snt�||���S(Ns.atatw(RR(tnametmode(ttargettopenertdivertR!(s&/sys/lib/python/mercurial/changelog.pyto[s

!((R<R;R=R!R>((R=R<R!R;s&/sys/lib/python/mercurial/changelog.pytdelayopenerZst	changelogcBsYeZd�Zd�Zd�Zd�Zd�Zdd�Zd�Z	dhd�Z
RS(	cCs5tii||d�||_t|_t|_dS(Ns
00changelog.i(trevlogR"t_realopenertFalset_delayedt_divert(R R<((s&/sys/lib/python/mercurial/changelog.pyR"es		cCsOt|_t|�dj|_g|_t|i|i|i|i�|_dS(s2delay visibility of index updates to other readersiN(	tTrueRDR$REt	_delaybufR?RBt	indexfileR<(R ((s&/sys/lib/python/mercurial/changelog.pytdelayupdateks
		cCs�t|_|i|_|io1|i|id�i}ti||d �nP|i	oE|i|id�}|i
di|i	��|i�g|_	n|i
|�dS(sfinalize index updatess.ai�R7R#N(RCRDRBR<RERHR9RtrenameRGR2RR'tcheckinlinesize(R ttrtnR((s&/sys/lib/python/mercurial/changelog.pytfinalizess	



cCs=ti|i|�}|i|_|i|_|i|_dS(N(RAR<tindextnodemapt_chunkcache(R tfileR6((s&/sys/lib/python/mercurial/changelog.pytreadpending�scCs�|iow|i|i�}|i|idd�}|i|i��|idi|i��|i�g|_t|_n|iotSnt	S(sDcreate a file containing the unfinalized state for pretxnchangegroups.aR8R#(
RGRBRHR2R*RR'RFRERC(R tfp1tfp2((s&/sys/lib/python/mercurial/changelog.pytwritepending�s

	

cCs(|iptii|||�ndS(N(RDRARK(R RLR((s&/sys/lib/python/mercurial/changelog.pyRK�s
c
Csy|i|�}|p#tddgdhdd<fSn|id�}ti||d�}|| id�}t|d�}ti|d�}|did	d�}t|�d
joCt|i	d��}	yt
|d�}
Wn
d}
nXh}n5|\}	}
}t|	�t
|
�}	}
t|�}|id�pd|d<n|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 metadatas, 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#itdefaulttbranchs

is
it i(ii(
trevisionRROtencodingttolocalR
RR$tfloattpoptintRtget(
R tnodeRtlasttdescR
tmanifesttusert
extra_datattimettimezoneRtfiles((s&/sys/lib/python/mercurial/changelog.pyR*�s.
#


c
Cs�|i�}|ptitd���nd|jo#titd�t|���ndig}
|i�D]}|
|i�qs~
�id�}ti	|�ti	|�}}|odt
i|�}ndt
i�}|	o!|	i
d�d	jo|	d=n|	o t|	�}	d||	f}nt|�||gt|�d|g}di|�}
|i|
|t|�||�S(
Nsempty usernames
susername %s contains a newlines%d %dRXRWR#s%s %s(sdefaultR#(tstripterrortRevlogErrorRtreprRt
splitlinestrstripR[t	fromlocalRt	parsedatetmakedateR`RRRtaddrevisionR$(R RdRiRcttransactiontp1tp2RetdateRRR
t
parseddateR((s&/sys/lib/python/mercurial/changelog.pytadd�s&
?)N(R3R4R"RIRNRSRVtNoneRKR*Ry(((s&/sys/lib/python/mercurial/changelog.pyR@ds						)(RaRRRti18nRRRkRAR[RRRtobjectRR?R@(((s&/sys/lib/python/mercurial/changelog.pys<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.