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

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


�
�c@sKddklZddklZddkZddkZddkZddkZddkZddk	Z	ddk
Z
ddkZddkZd�Z
defd��YZdefd��YZd	efd
��YZdefd��YZhed
<ed<d�d<d�d<d�d<ed<Zedddd�ZdS(i�(t_(thexNcCs$|oti|�}nvt|t�ptd��ntii|�}|i�}x4|D],}|i	|�o|t
|� }Pq_q_Wtiiti|��}ti|�}|i	d�p|d7}n|i
d�p tii|�p
d|jotitd���n|S(sWchoose prefix to use for names in archive.  make sure prefix is
    safe for consumers.s dest must be string if no prefixt/s../s/../s*archive prefix contains illegal components(tutiltnormpatht
isinstancetstrt
ValueErrortostpathtbasenametlowertendswithtlent	localpathtpconvertt
startswithtisabstAbortR(tdesttprefixtsuffixesRtsfxtlpfx((s%/sys/lib/python/mercurial/archival.pyt
tidyprefixs$	0ttaritcBsEeZdZdeifd��YZdd�Zd�Zd�ZRS(sawrite archive to tar file or stream.  can write uncompressed,
    or compress with gzip or bzip2.tGzipFileWithTimecBseZd�Zd�ZRS(cOsid}d|jo|id�}n|djoti�|_n
||_tii|||�dS(Nt	timestamp(tNonetpopttimeRtgziptGzipFilet__init__(tselftargstkwR((s%/sys/lib/python/mercurial/archival.pyR!+s

	cCs�|iid�|iid�t|dd�p|i}d}|o
ti}n|iit|��ti|it	|i
��|iid�|iid�|o|ii|d�ndS(Ns�tnameiss�(tfileobjtwritetgetattrRtfilenameRtFNAMEtchrtwrite32utlongR(R"tfnametflags((s%/sys/lib/python/mercurial/archival.pyt_write_gzip_header5s
(t__name__t
__module__R!R1(((s%/sys/lib/python/mercurial/archival.pyR)s	
tcs�t||dddddg��_��_d���fd�}t|t�o||dd��_n|d	d
ddd|��_dS(
Ns.tars.tar.bz2s.tar.gzs.tgzs.tbz2cs��djog|d}|pt||d�}n�i||dti|d��}tii|||�Snti||�|�SdS(NtgzitbR(topenRtzlibtZ_BEST_COMPRESSIONttarfiletTarFilettaropen(R%tmodeR't	gzfileobj(tkindR"tmtime(s%/sys/lib/python/mercurial/archival.pyR<Is

R=sw:R%R4sw|R'(RRR@RRRtz(R"RRR@R?R<((R?R"R@s%/sys/lib/python/mercurial/archival.pyR!Ds	cCs�ti|i|�}|i|_t|�|_|o1ti|_d|_||_	d}d|_n||_ti|�}|i
i||�dS(Ni�i(R:tTarInfoRR@R
tsizetSYMTYPEttypeR=tlinknameRt	cStringIOtStringIORAtaddfile(R"R%R=tislinktdatati((s%/sys/lib/python/mercurial/archival.pyRI[s		
	cCs|ii�dS(N(RAtclose(R"((s%/sys/lib/python/mercurial/archival.pytdonejs(	R2R3t__doc__RR RR!RIRN(((s%/sys/lib/python/mercurial/archival.pyR%s
	ttellablecBs2eZdZd�Zd�Zd�Zd�ZRS(sVprovide tell method for zipfile.ZipFile when writing to http
    response file object.cCs||_d|_dS(Ni(tfptoffset(R"RQ((s%/sys/lib/python/mercurial/archival.pyR!qs	cCst|i|�S(N(R)RQ(R"tkey((s%/sys/lib/python/mercurial/archival.pyt__getattr__uscCs)|ii|�|it|�7_dS(N(RQR(RRR
(R"ts((s%/sys/lib/python/mercurial/archival.pyR(xscCs|iS(N(RR(R"((s%/sys/lib/python/mercurial/archival.pyttell|s(R2R3ROR!RTR(RV(((s%/sys/lib/python/mercurial/archival.pyRPms
			tzipitcBs,eZdZed�Zd�Zd�ZRS(s]write archive to zip file or stream.  can write uncompressed,
    or compressed with deflate.cCs�t||d�|_t|t�p:y|i�Wq_ttfj
ot|�}q_Xnti	|d|o
ti
pti�|_t
i|�d |_dS(Ns.ziptwi(s.zip(RRRRRVtAttributeErrortIOErrorRPtzipfiletZipFiletZIP_DEFLATEDt
ZIP_STOREDRARtgmtimet	date_time(R"RRR@tcompress((s%/sys/lib/python/mercurial/archival.pyR!�scCsti|i||i�}|ii|_d|_ti	}|od}ti
}n||Bd>|_|ii||�dS(Nii�l(
R[tZipInfoRR`RAtcompressiont
compress_typet
create_systemtstattS_IFREGtS_IFLNKt
external_attrtwritestr(R"R%R=RJRKRLtftype((s%/sys/lib/python/mercurial/archival.pyRI�s		
cCs|ii�dS(N(RARM(R"((s%/sys/lib/python/mercurial/archival.pyRN�s(R2R3ROtTrueR!RIRN(((s%/sys/lib/python/mercurial/archival.pyRWs	
tfileitcBs)eZdZd�Zd�Zd�ZRS(s$write archive as files in directory.cCsB|otitd���n||_ti|i�|_dS(Ns*cannot give prefix when archiving to files(RRRtbasedirtopener(R"R%RR@((s%/sys/lib/python/mercurial/archival.pyR!�s	cCs}|o|ii||�dSn|i|ddt�}|i|�|i�tii|i|�}ti	||�dS(NRXt
atomictemp(
RotsymlinkRlR(trenameRR	tjoinRntchmod(R"R%R=RJRKtftdestfile((s%/sys/lib/python/mercurial/archival.pyRI�s

cCsdS(N((R"((s%/sys/lib/python/mercurial/archival.pyRN�s(R2R3ROR!RIRN(((s%/sys/lib/python/mercurial/archival.pyRm�s		
tfilesttarcCst|||d�S(tbz2(R(R%RR@((s%/sys/lib/python/mercurial/archival.pyt<lambda>�sttbz2cCst|||d�S(R5(R(R%RR@((s%/sys/lib/python/mercurial/archival.pyRz�sttgzcCst|||t�S((RWtFalse(R%RR@((s%/sys/lib/python/mercurial/archival.pyRz�stuziptzipc	s����fd�}|tjotitd�|��n��}	t||||p|	i�d���iiddt�o#|ddt��fd��nxQ|	D]I}
|	i	|
�}||
d	|jod
pdd|j|	|
i
�q�W�i�dS(
s�create archive of repo as it was at node.

    dest can be name of directory, name of archive file, or file
    object to write archive to.

    kind is type of archive to create.

    decode tells whether to put files through decode filters from
    hgrc.

    matchfn is function to filter names of files to write to archive.

    prefix is name of path to put before every archive member.cs]�o�|�odSn|�}�o�i||�}n�i||||�dS(N(t
wwritedataRI(R%R=RJtgetdataRK(trepotmatchfntdecodetarchiver(s%/sys/lib/python/mercurial/archival.pyR(�s
	sunknown archive type '%s'ituitarchivemetas.hg_archival.txti�cs&dt�iid��t��fS(srepo: %s
node: %s
i(Rt	changelogtnode((R�R�(s%/sys/lib/python/mercurial/archival.pyRz�stxi�tlN(t	archiversRRRtdateR�t
configboolRlR}R0RKRN(R�RR�R?R�R�RR@R(tctxRutff((R�R�R�R�R�s%/sys/lib/python/mercurial/archival.pytarchive�s

'8(ti18nRR�RRRGRRfR:RR[R8RRtobjectRRPRWRmR�RlRR�(((s%/sys/lib/python/mercurial/archival.pys<module>s$H	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 [email protected].