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

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


�
�c@s8ddklZddkZddkZddkZddkZeiZd�Zd�Z	d�Z
e
�\ZZd�Z
e
�Zdi�Zd�Zd	Zd
Zd
eddZd
�Zd�ZdZdefd��YZdefd��YZdefd��YZdefd��YZdd�ZdS(i�(t_NcCs@|id�p|Sn|idd�idd�idd�S(Nsdata/s.hg/s.hg.hg/s.i/s.i.hg/s.d/s.d.hg/(t
startswithtreplace(tpath((s"/sys/lib/python/mercurial/store.pyt	encodedirscCs@|id�p|Sn|idd�idd�idd�S(Nsdata/s.d.hg/s.d/s.i.hg/s.i/s.hg.hg/s.hg/(RR(R((s"/sys/lib/python/mercurial/store.pyt	decodedirscsWd}g}dD]}|t|�q~}tg}td�D]}|t|�t|�fqA~��x9td�tdd�|D]}d|�t|�<q�WxTttd�td	�d
�t|�gD]&}|t|�i��t|�<q�Wh�x$�i�D]\}}|�|<qW�fd���fd��fd
�fS(NRs\:*?"<>|ii i~is~%02xtAtZic	3s~d}xq|t|�jo]xVtdd�D]?}y#�||||!V||7}PWq,tj
oq,Xq,Wt�q	WdS(Niii(tlentxrangetKeyError(tstitl(tdmap(s"/sys/lib/python/mercurial/store.pytdecode+s
	cs2dig}t|�D]}|�|q~�S(t(tjoinR(Rt_[1]tc(tcmap(s"/sys/lib/python/mercurial/store.pyt<lambda>7scstdit�|����S(R(RRtlist(R(R(s"/sys/lib/python/mercurial/store.pyR8s(tordtdictR	tchrtrangetlowert	iteritems(teRtxtwin_reservedt_[2]tktv((RRRs"/sys/lib/python/mercurial/store.pyt_buildencodefun s '?-$
cs�g}dD]}|t|�q~}tg}td�D]}|t|�t|�fq;~��x9td�tdd�|D]}d|�t|�<q�WxCttd�td�d	�D]"}t|�i��t|�<q�W�fd
�S(Ns\:*?"<>|ii i~is~%02xRRics,dig}|D]}|�|q~�S(R(R(RRR(R(s"/sys/lib/python/mercurial/store.pyRCs(RRR	RRR(RRRR ((Rs"/sys/lib/python/mercurial/store.pyt_build_lower_encodefun<s'?  sqcon prn aux nul
    com1 com2 com3 com4 com5 com6 com7 com8 com9
    lpt1 lpt2 lpt3 lpt4 lpt5 lpt6 lpt7 lpt8 lpt9c	Cs�g}x�|id�D]�}|o�|id�d}|o>|tjo1dt|d�}|dd!||d}n|ddjo |d dt|d�}q�n|i|�qWdi|�S(	Nt/t.is~%02xiii�s. (tsplitt_windows_reserved_filenamesRtappendR(Rtrestntbasetec((s"/sys/lib/python/mercurial/store.pyt	auxencodeJs$ixiiicCs�|id�p|Snt|�}|td�}dtt|��}t|�tjo`t|�i�}tt|��}t	i
i|�\}}|id�}|d}g}	x{|d D]o}
|
t
 }|ddjo|d d}ndi|	�d|}t|�tjoPn|	i|�q�Wdi|	�}
t|
�djo|
d7}
nd|
||}tt|�}|djo$|| }d|
|||}q�n|S(szencodes path with a length limit

    Encodes all paths that begin with 'data/', according to the following.

    Default encoding (reversible):

    Encodes all uppercase letters 'X' as '_x'. All reserved or illegal
    characters are encoded as '~xx', where xx is the two digit hex code
    of the character (see encodefilename).
    Relevant path components consisting of Windows reserved filenames are
    masked by encoding the third character ('aux' -> 'au~78', see auxencode).

    Hashed encoding (not reversible):

    If the default-encoded path is longer than MAX_PATH_LEN_IN_HGSTORE, a
    non-reversible hybrid hashing of the path is done instead.
    This encoding uses up to DIR_PREFIX_LEN characters of all directory
    levels of the lowerencoded path, but not more levels than can fit into
    _MAX_SHORTENED_DIRS_LEN.
    Then follows the filler followed by the sha digest of the full path.
    The filler is the beginning of the basename of the lowerencoded path
    (the basename is everything after the last path separator). The filler
    is as long as possible, filling in characters from the basename until
    the encoded path has MAX_PATH_LEN_IN_HGSTORE characters (or all chars
    of the basename have been taken).
    The extension (e.g. '.i' or '.d') is preserved.

    The string 'data/' at the beginning is replaced with 'dh/', if the hashed
    encoding was used.
    sdata/R%i�s. Risdh/(RRRR.tencodefilenametMAX_PATH_LEN_IN_HGSTOREt_shat	hexdigesttlowerencodetosRtsplitextR'tDIR_PREFIX_LENRt_MAX_SHORTENED_DIRS_LENR)(RtndpathR*tdigesttaept_roottexttpartstbasenametsdirstptdtttdirst
space_lefttfiller((s"/sys/lib/python/mercurial/store.pythybridencode\s<



cCsYy9ti|�i}dti@d|@jo
d}nWntj
o
d}nX|S(Ni�(R4tstattst_modetutiltumasktNonetOSError(Rtmode((s"/sys/lib/python/mercurial/store.pyt	_calcmode�ss;data 00manifest.d 00manifest.i 00changelog.d  00changelog.it
basicstorecBsDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(s&base class for local repository storescsR||_||_t|�|_||i��|i�_�fd�|_dS(Ncs�t|�||�S((R(tftargstkw(top(s"/sys/lib/python/mercurial/store.pyR�s(t
pathjoinerRRNt
createmodetopener(tselfRRVRT((RSs"/sys/lib/python/mercurial/store.pyt__init__�s		cCs|i|it|��S(N(RTRR(RWRP((s"/sys/lib/python/mercurial/store.pyR�sc
Cs6|i|i|�}t|i�tti�}g}tii|�o�|g}x�|o�|i�}x�ti|dt	�D]�\}}	}
|i||�}|	t
ijoG|ddjo6ti
||�}|it|�||
if�q|	t
ijo|o|i|�qqWqVWnt|�S(s!yields (unencoded, encoded, size)RGi�s.ds.i(s.ds.i(RTRRR4tseptisdirtpoptosutiltlistdirtTrueRGtS_IFREGRItpconvertR)Rtst_sizetS_IFDIRtsorted(
RWtrelpathtrecurseRtstriplenR
tvisitR@RPtkindtsttfpR+((s"/sys/lib/python/mercurial/store.pyt_walk�s 	
!#cCs|idt�S(Ntdata(RkR^(RW((s"/sys/lib/python/mercurial/store.pyt	datafiles�sccsHx|i�D]}|Vq
Wx%t|idt��D]}|Vq5WdS(s!yields (unencoded, encoded, size)RN(RmtreversedRktFalse(RWR((s"/sys/lib/python/mercurial/store.pytwalk�s
	cCsdgti�S(Ntrequires(t_dataR'(RW((s"/sys/lib/python/mercurial/store.pytcopylist�s(	t__name__t
__module__t__doc__RXRRkRmRpRs(((s"/sys/lib/python/mercurial/store.pyRO�s						tencodedstorecBs,eZd�Zd�Zd�Zd�ZRS(csa||_|i|d�|_t|i�|_||i��|i�_�fd�|_dS(Ntstorecs�t|�||�S((R/(RPRQRR(RS(s"/sys/lib/python/mercurial/store.pyR�s(RTRRNRURV(RWRRVRT((RSs"/sys/lib/python/mercurial/store.pyRX�s	ccsdx]|idt�D]I\}}}yt|�}Wntj
o
d}nX|||fVqWdS(NRl(RkR^tdecodefilenameR
RK(RWtatbtsize((s"/sys/lib/python/mercurial/store.pyRm�scCs|i|it|��S(N(RTRR/(RWRP((s"/sys/lib/python/mercurial/store.pyR�scCs;ddgg}ti�D]}||id|�q~S(NRqs
00changelog.iRx(RrR'RT(RWRRP((s"/sys/lib/python/mercurial/store.pyRs�s	(RtRuRXRmRRs(((s"/sys/lib/python/mercurial/store.pyRw�s			tfncachecBs>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs||_d|_dS(N(RVRKtentries(RWRV((s"/sys/lib/python/mercurial/store.pyRX�s	cCs�t�|_y|iddd�}Wntj
odSnXxt|�D]q\}}t|�djp|ddjo'td�|d	}ti|��n|ii	t
|d ��qLW|i�dS(
s&fill the entries from the fncache fileR}RMtrbNii�s
s!invalid entry in fncache, line %si(tsetR~RVtIOErrort	enumerateRRRItAborttaddRtclose(RWRjR+tlineRB((s"/sys/lib/python/mercurial/store.pyt_load�s	
$cCsZ|iddd�}x%|D]}|it|�d�qW|i�t|�|_dS(NR}RMtwbs
(RVtwriteRR�R�R~(RWtfilesRjR@((s"/sys/lib/python/mercurial/store.pytrewrites
cCsE|idjo|i�n|idd�it|�d�dS(NR}tabs
(R~RKR�RVR�R(RWtfn((s"/sys/lib/python/mercurial/store.pyR�scCs+|idjo|i�n||ijS(N(R~RKR�(RWR�((s"/sys/lib/python/mercurial/store.pyt__contains__scCs+|idjo|i�nt|i�S(N(R~RKR�titer(RW((s"/sys/lib/python/mercurial/store.pyt__iter__s(RtRuRXR�R�R�R�R�(((s"/sys/lib/python/mercurial/store.pyR}�s					tfncachestorecBs,eZd�Zd�Zd�Zd�ZRS(cs�||_|i|d�|_t|i�|_||i��|i�_t����|_d��fd�}||_dS(NRxtrcsT|djo.|id�o|�jo�i|�n�t|�|||�S(NR�Rsdata/(R�srb(RR�RF(RRMRQRR(tfncRS(s"/sys/lib/python/mercurial/store.pyt
fncacheopener$s


(RTRRNRUR}RV(RWRRVRTR�((R�RSs"/sys/lib/python/mercurial/store.pyRXs		cCs|i|it|��S(N(RTRRF(RWRP((s"/sys/lib/python/mercurial/store.pyR,sccs�t}g}|i}|i}xs|iD]h}t|�}y:ti|||��}|||ifV|i|�Wq(t	j
o
t
}q(Xq(W|o|ii|�ndS(N(RoRTRR}RFR4RGRaR)RLR^R�(RWR�texistingtpjointspathRPtefRi((s"/sys/lib/python/mercurial/store.pyRm/s		
cCsEtd}ddgg}|i�D]}||id|�q$~S(Ns dh fncacheRqs
00changelog.iRx(RrR'RT(RWRARRP((s"/sys/lib/python/mercurial/store.pyRsBs
	(RtRuRXRRmRs(((s"/sys/lib/python/mercurial/store.pyR�s			cCse|p
tii}d|jo5d|jot|||�Snt|||�Snt|||�S(NRxR}(R4RRR�RwRO(trequirementsRRVRT((s"/sys/lib/python/mercurial/store.pyRxGs

(ti18nRR\RIR4RGtsha1R1RRR#R/RyR$R3R'R(R.R0R6R7RFRNRrtobjectRORwR}R�RKRx(((s"/sys/lib/python/mercurial/store.pys<module>s,									?	.,-

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.