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

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


��c@s�ddlmZddlmZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZdZdZd�Zidgd6d	d
gd6dd
gd6dgd6Zd�Zdefd��YZdefd��YZdefd��YZdefd��YZied6ed6d�d6d�d6d�d6ed6Zeddde d�Z!dS( i�(t_(thexNi�i�cCs$|rtj|�}n}t|t�s6td��ntjj|�}|j�}x>t	j
|g�D]*}|j|�rg|t|� }PqgqgWtjjtj
|��}tj|�}|jd�s�|d7}n|jd�stjj|�sd|kr tjtd���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
ValueErrortostpathtbasenametlowertextstgettendswithtlent	localpathtpconvertt
startswithtisabstAbortR(tdesttkindtprefixRtsfxtlpfx((s6/sys/lib/python2.7/site-packages/mercurial/archival.pyt
tidyprefixs"
-s.tarttars.tbz2s.tar.bz2ttbz2s.tgzs.tar.gzttgzs.ziptzipcsDx=tj�D]/\}}tj�fd�|D��r
|Sq
WdS(Nc3s|]}�j|�VqdS(N(R(t.0text(R(s6/sys/lib/python2.7/site-packages/mercurial/archival.pys	<genexpr>6s(Rt	iteritemsRtanytNone(RRt
extensions((Rs6/sys/lib/python2.7/site-packages/mercurial/archival.pyt	guesskind4sttaritcBsEeZdZdejfd��YZdd�Zd�Zd�ZRS(sawrite archive to tar file or stream.  can write uncompressed,
    or compress with gzip or bzip2.tGzipFileWithTimecBseZd�Zd�ZRS(cOsed}d|kr$|jd�}n|dkrBtj�|_n	||_tjj|||�dS(Nt	timestamp(R#tpopttimeR(tgziptGzipFilet__init__(tselftargstkwR(((s6/sys/lib/python2.7/site-packages/mercurial/archival.pyR-As	cCs�|jjd�|jjd�y
|j}Wntk
rI|j}nX|rl|jd�rl|d }nd}|r�tj}n|jjt|��tj	|jt
|j��|jjd�|jjd�|r�jj|d�ndS(	Ns�s.gzi�iss�(tfileobjtwritetnametAttributeErrortfilenameRR+tFNAMEtchrtwrite32utlongR((R.tfnametflags((s6/sys/lib/python2.7/site-packages/mercurial/archival.pyt_write_gzip_headerKs"



(t__name__t
__module__R-R=(((s6/sys/lib/python2.7/site-packages/mercurial/archival.pyR'?s	
tcss��_d�_d���fd�}t|t�rQ||dd��_n|ddddd|��_dS(Ncs��dkrv|d}|s2t||d�}n�j||dtj|d��}|�_tjj|||�Stj||�|�SdS(NtgzitbR((topenR'tzlibtZ_BEST_COMPRESSIONR2ttarfiletTarFilettaropen(R4tmodeR2t	gzfileobj(RtmtimeR.(s6/sys/lib/python2.7/site-packages/mercurial/archival.pyRHcs
	RIsw:R4R@sw|R2(RKR#R2RRtz(R.RRKRRH((RRKR.s6/sys/lib/python2.7/site-packages/mercurial/archival.pyR-_s		
cCs�tj|�}|j|_t|�|_|r`tj|_d|_||_d}d|_n||_t
j|�}|jj
||�dS(Ni�i(RFtTarInfoRKRtsizetSYMTYPEttypeRItlinknameR#t	cStringIOtStringIORLtaddfile(R.R4RItislinktdatati((s6/sys/lib/python2.7/site-packages/mercurial/archival.pyRTvs			cCs*|jj�|jr&|jj�ndS(N(RLtcloseR2(R.((s6/sys/lib/python2.7/site-packages/mercurial/archival.pytdone�s
	(	R>R?t__doc__R+R,R'R-RTRY(((s6/sys/lib/python2.7/site-packages/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.R\((s6/sys/lib/python2.7/site-packages/mercurial/archival.pyR-�s	cCst|j|�S(N(tgetattrR\(R.tkey((s6/sys/lib/python2.7/site-packages/mercurial/archival.pyt__getattr__�scCs)|jj|�|jt|�7_dS(N(R\R3R]R(R.ts((s6/sys/lib/python2.7/site-packages/mercurial/archival.pyR3�scCs|jS(N(R](R.((s6/sys/lib/python2.7/site-packages/mercurial/archival.pyttell�s(R>R?RZR-R`R3Rb(((s6/sys/lib/python2.7/site-packages/mercurial/archival.pyR[�s
			tzipitcBs,eZdZed�Zd�Zd�ZRS(s]write archive to zip file or stream.  can write uncompressed,
    or compressed with deflate.cCs�t|t�sFy|j�WqFttfk
rBt|�}qFXntj|d|ratjpgtj	�|_
d}||kr�|}n||_tj
|�d |_dS(Ntwi�i(RRRbR5tIOErrorR[tzipfiletZipFiletZIP_DEFLATEDt
ZIP_STOREDRLRKR*tgmtimet	date_time(R.RRKtcompresstepoch((s6/sys/lib/python2.7/site-packages/mercurial/archival.pyR-�s		c	Cs�tj||j�}|jj|_d|_t}|rHd}t}n||Bd>|_	|j
tjddddt
|j��7_
|jj||�dS(	Nii�ls<hhBliUTiii(RftZipInfoRkRLtcompressiont
compress_typet
create_systemt
_UNX_IFREGt
_UNX_IFLNKt
external_attrtextratstructtpacktintRKtwritestr(R.R4RIRURVRWtftype((s6/sys/lib/python2.7/site-packages/mercurial/archival.pyRT�s		cCs|jj�dS(N(RLRX(R.((s6/sys/lib/python2.7/site-packages/mercurial/archival.pyRY�s(R>R?RZtTrueR-RTRY(((s6/sys/lib/python2.7/site-packages/mercurial/archival.pyRc�s	tfileitcBs)eZdZd�Zd�Zd�ZRS(s$write archive as files in directory.cCs"||_tj|j�|_dS(N(tbasedirtscmutiltopener(R.R4RK((s6/sys/lib/python2.7/site-packages/mercurial/archival.pyR-�s	cCsx|r|jj||�dS|j|ddt�}|j|�|j�tjj|j|�}tj	||�dS(NRdt
atomictemp(
RtsymlinkR{R3RXRR	tjoinR}tchmod(R.R4RIRURVtftdestfile((s6/sys/lib/python2.7/site-packages/mercurial/archival.pyRT�s

cCsdS(N((R.((s6/sys/lib/python2.7/site-packages/mercurial/archival.pyRY�s(R>R?RZR-RTRY(((s6/sys/lib/python2.7/site-packages/mercurial/archival.pyR|�s		
tfilescCst||d�S(Ntbz2(R&(R4RK((s6/sys/lib/python2.7/site-packages/mercurial/archival.pyt<lambda>�scCst||d�S(NRA(R&(R4RK((s6/sys/lib/python2.7/site-packages/mercurial/archival.pyR��scCst||t�S(N(RctFalse(R4RK((s6/sys/lib/python2.7/site-packages/mercurial/archival.pyR��stuzipc	s�|dkr-�r?tjtd���q?nt||�������fd�}	|tkrtjtd�|��n���t|||p��j�d���jjddt�r���fd�}
d	}|s�|�r|	|d
t	|
�qn|rEg�j
�j�D]}||�r$|^q$}
n�j
�j�}
t|
�}|rM|
j
��jjtd�ddtd�d
|�x�t|
�D]�\}}�j|�}|	|d|kr�dp�
d|k�|j��jjtd�|dd|dtd�d
|�q�W�jjtd�d�n|r�xZt�j�D]F}�j|�}tj||�}||j�j��|�7}qcWn|dkr�tjtd���n�j�|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.R�s*cannot give prefix when archiving to filescsB|�}�r$�j||�}n�j�||||�dS(N(t
wwritedataRT(R4RIRUtgetdataRV(tarchivertdecodeRtrepo(s6/sys/lib/python2.7/site-packages/mercurial/archival.pyR3�s	sunknown archive type '%s'ituitarchivemetacsd�dj�t��tj�j��f}dj�fd��j�D��}|s�jj�idd6dd6dd6dd	6}t	j
�j�|�j���jj�j
d
�\}}djd�|j
d�D��}|d
|7}n||S(Nsrepo: %s
node: %s
branch: %s
iR@c3s.|]$}�j|�dkrd|VqdS(tglobalstag: %s
N(ttagtype(Rtt(R�(s6/sys/lib/python2.7/site-packages/mercurial/archival.pys	<genexpr>ss{latesttag}
{latesttagdistance}ttemplatetstyletpatchtgits
css|]}d|VqdS(slatesttag: %s
N((RR�((s6/sys/lib/python2.7/site-packages/mercurial/archival.pys	<genexpr>st:slatesttagdistance: %s
(Rtencodingt	fromlocaltbranchR�ttagsR�t
pushbufferR#tcmdutiltshow_changesettshowt	popbuffertsplit(tbaseR�toptstltagstdist(tctxtnodeR�(s6/sys/lib/python2.7/site-packages/mercurial/archival.pytmetadatas/%

"s.hg_archival.txti�t	archivingtunitttotaltxi�tlititems"no files match the archive patternN(RRRRt	archiverstdateR�t
configboolR{R�tmanifesttkeysRtsorttprogresst	enumerateR<RVR#tsortedtsubstatetsubtmatchmodt
narrowmatchertarchiveterrorRY(R�RR�RR�tmatchfnRRKtsubreposR3R�R4R�R�R�RWtfftsubpathR�tsubmatch((R�R�R�R�RR�s6/sys/lib/python2.7/site-packages/mercurial/archival.pyR��sH
#4
+2"&
("ti18nRR�RtmatchR�R�R~RR�RRRRFR*RfRDR+RvR�RrRsRRR%tobjectR&R[RcR|R�R{R#R�R�(((s6/sys/lib/python2.7/site-packages/mercurial/archival.pyt<module>s<$<	



	O/





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.