§
    cÌc<  ã                   ó”   — d Z ddlmZ ddlmZ ddlZddlZddlZddlm	Z	m
Z
 ddlmZ dd„Zdd„Zdd„Zdd„Z	 dd„Zdd„Z	 	 dd„ZdS )zExport a tree to a tarball.é    )Úclosing)ÚBytesIONé   )ÚerrorsÚosutils)Ú_export_iter_entriesc                 óØ  — t          j        ||¦  «        }t          j        |¦  «        }|�||_        n|                      |¦  «        |_        |j        dk    rnt          j        |_        |  	                    |¦  «        rd|_
        nd|_
        |                      |¦  «        }t          |¦  «        |_        t          |¦  «        }	n¡|j        dv r2t          j        |_        |xj        dz  c_        d|_        d|_
        d}	nf|j        dk    r<t          j        |_        d|_        d|_
        |                      |¦  «        |_        d}	nt)          j        d	|›d
|j        ›�¦  «        ‚||	fS )aR  Prepare a tarball item for exporting

    :param tree: Tree to export
    :param final_path: Final path to place item
    :param tree_path: Path for the entry in the tree
    :param entry: Entry to export
    :param force_mtime: Option mtime to force, instead of using tree
        timestamps.

    Returns a (tarinfo, fileobj) tuple
    NÚfileií  i¤  )Ú	directoryztree-referenceú/r   Úsymlinkzdon't know how to export {z
} of kind )r   ÚpathjoinÚtarfileÚTarInfoÚmtimeÚget_file_mtimeÚkindÚREGTYPEÚtypeÚis_executableÚmodeÚget_file_textÚlenÚsizer   ÚDIRTYPEÚnameÚSYMTYPEÚget_symlink_targetÚlinknamer   ÚBzrError)
ÚtreeÚrootÚ
final_pathÚ	tree_pathÚentryÚforce_mtimeÚfilenameÚitemÚcontentÚfileobjs
             ú4/usr/lib/python3/dist-packages/breezy/archive/tar.pyÚprepare_tarball_itemr,       sd  € õ Ô  jÑ1Ô1€HÝŒ?˜8Ñ$Ô$€DØÐØ ˆŒ
ˆ
à×(Ò(¨Ñ3Ô3ˆŒ
Ø„z�VÒÐÝ”OˆŒ	Ø×Ò˜iÑ(Ô(ð 	ØˆDŒIˆIàˆDŒIð
 ×$Ò$ YÑ/Ô/ˆÝ˜‘L”LˆŒ	Ý˜'Ñ"Ô"ˆˆØ	ŒÐ6Ð	6Ð	6Ý”OˆŒ	Øˆ	Œ	�SÑˆ	Œ	ØˆŒ	ØˆŒ	ØˆˆØ	Œ�yÒ	 Ð	 Ý”OˆŒ	ØˆŒ	ØˆŒ	Ø×/Ò/°	Ñ:Ô:ˆŒØˆˆåŒoˆoØ!+  ¨U¬Z¨Zð9ñ :ô :ð 	:à�'ˆ?Ðó    Ú Fc              #   ó4  K  — t          ¦   «         }t          t          j        dd|z  |¦  «        ¦  «        5 }|                      ¦   «         5  t          | ||¬¦  «        D ]s\  }}	}
t          | |||	|
|¦  «        \  }}|                     ||¦  «         |                     ¦   «         V — | 	                    d¦  «         | 
                    d¦  «         Œt	 ddd¦  «         n# 1 swxY w Y   ddd¦  «         n# 1 swxY w Y   |                     ¦   «         V — dS )a  Export tree contents to a tarball.

    Args:
      tree: Tree to export
      subdir: Sub directory to export
      force_mtime: Option mtime to force, instead of using tree
        timestamps.
    Returns: A generator that will produce file content chunks.
    Nzw:%s©Úrecurse_nestedr   )r   r   r   ÚopenÚ	lock_readr   r,   ÚaddfileÚgetvalueÚtruncateÚseek)r!   r"   Úsubdirr&   Úformatr1   ÚbufÚballr#   r$   r%   r(   r*   s                r+   Útarball_generatorr<   Q   sž  è è € õ ‰)Œ)€CÝ	•”˜d F¨V¡O°SÑ9Ô9Ñ	:Ô	:ð 	¸dÀDÇNÂNÑDTÔDTð 	ð 	Ý,@Ø�f¨^ð-=ñ -=ô -=ð 	ð 	Ñ(ˆJ˜	 5å2Ø�d˜J¨	°5¸+ñGô G‰OˆT�7à�LŠL˜˜wÑ'Ô'Ð'à—,’,‘.”.Ð Ð Ð Ø�LŠL˜‰OŒOˆOØ�HŠH�Q‰KŒKˆKˆKð	ð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	ð 	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	ð �,Š,‰.Œ.ÐÐÐÐÐs6   ·C7ÁBC ÃC7Ã C$	Ã$C7Ã'C$	Ã(C7Ã7C;Ã>C;c              #   ó<  K  — |                       ¦   «         5  ddl}|�|}nƒt          | dd¦  «        rEt          | dd¦  «        r4| j                             |                      ¦   «         ¦  «        }|j        }n-|                      d¦  «        r|                      d¦  «        }nd}d}	d}
t          j
                             |¦  «        }
t          ¦   «         }|                     |
d||¬¦  «        }t          | ||||¬	¦  «        D ]W}|                     |¦  «         |                     ¦   «         V — |                     d¦  «         |                     d¦  «         ŒX|                     ¦   «          |                     ¦   «         V — ddd¦  «         dS # 1 swxY w Y   dS )
ú«Export this tree to a new tar file.

    `dest` will be created holding the contents of this tree; if it
    already exists, it will be clobbered, like with "tar -c".
    r   NÚ
repositoryÚget_revision_idr.   FÚw)r*   r   r0   )r3   ÚgzipÚgetattrr?   Úget_revisionr@   Ú	timestampÚis_versionedr   ÚosÚpathÚbasenamer   ÚGzipFiler<   Úwriter5   r6   r7   Úclose)r!   Údestr"   r8   r&   r1   rB   Ú
root_mtimeÚrevÚ	is_stdoutrI   r:   Ú	zipstreamÚchunks                 r+   Útgz_generatorrS   i   sù  è è € ð 
�ŠÑ	Ô	ð !ð !ØˆˆˆØÐ"Ø$ˆJˆJÝ�d˜L¨$Ñ/Ô/ð 	Ý�dÐ-¨tÑ4Ô4ð	ð ”/×.Ò.¨t×/CÒ/CÑ/EÔ/EÑFÔFˆCØœˆJˆJØ×Ò˜rÑ"Ô"ð 	Ø×,Ò,¨RÑ0Ô0ˆJˆJàˆJàˆ	Øˆõ ”7×#Ò# DÑ)Ô)ˆÝ‰iŒiˆØ—M’M (¨C¸Ø(2ð "ñ 4ô 4ˆ	å&Ø�d˜F KØ-ð/ñ /ô /ð 	ð 	ˆEð �OŠO˜EÑ"Ô"Ð"à—,’,‘.”.Ð Ð Ð Ø�LŠL˜‰OŒOˆOØ�HŠH�Q‰KŒKˆKˆKà�ŠÑÔÐØ�lŠl‰nŒnÐÐÐðC!ð !ð !ñ !ô !ð !ð !ð !ð !ð !ð !ð !øøøð !ð !ð !ð !ð !ð !s   —E-FÆFÆFc                 ó,   — t          | |||d|¬¦  «        S )r>   Úbz2©r9   r1   ©r<   ©r!   rM   r"   r8   r&   r1   s         r+   Útbz_generatorrY   “   s)   € õ Øˆd�F˜K°Ø%ð'ñ 'ô 'ð 'r-   c                 ó,   — t          | |||d|¬¦  «        S )r>   r.   rV   rW   rX   s         r+   Úplain_tar_generatorr[   ž   s)   € õ Øˆd�F˜K°Ø%ð'ñ 'ô 'ð 'r-   c           	      ó.   — t          | ||||d|¬¦  «        S )NÚxzr0   )Útar_lzma_generatorrX   s         r+   Útar_xz_generatorr_   ª   s)   € ÝØˆd�D˜& +¨tØ%ð'ñ 'ô 'ð 'r-   Úalonec              #   óV  K  — 	 ddl }n-# t          $ r }t          j        dt          ¦  «        |‚d}~ww xY w|                     |j        |j        |j        dœ|         ¬¦  «        }	t          | ||||¬¦  «        D ]}
|	 
                    |
¦  «        V — Œ|	                     ¦   «         V — dS )z±Export this tree to a new .tar.lzma file.

    `dest` will be created holding the contents of this tree; if it
    already exists, it will be clobbered, like with "tar -c".
    r   NÚlzma)r]   Úrawr`   )r9   )r&   r1   )rb   ÚModuleNotFoundErrorr   ÚDependencyNotPresentÚeÚLZMACompressorÚ	FORMAT_XZÚ
FORMAT_RAWÚFORMAT_ALONEr<   ÚcompressÚflush)r!   rM   r"   r8   r&   Úcompression_formatr1   rb   ÚexcÚ
compressorrR   s              r+   r^   r^   °   só   è è € ð>ØˆˆˆˆøÝð >ð >ð >ÝÔ)¨&µ!Ñ4Ô4¸#Ð=øøøøð>øøøð ×$Ò$à”.Ø”?ØÔ&ðð ð !ô	"ð %ñ #ô #€Jõ #Ø�$˜¨KØ)ð+ñ +ô +ð )ð )ˆð ×!Ò! %Ñ(Ô(Ð(Ð(Ð(Ð(à
×
Ò
Ñ
Ô
ÐÐÐÐÐs   „	 ‰
3“.®3)N)NNr.   F)NF)Nr`   F)Ú__doc__Ú
contextlibr   Úior   rG   Úsysr   r.   r   r   Úexportr   r,   r<   rS   rY   r[   r_   r^   © r-   r+   ú<module>rv      s.  ðð" "Ð !à Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø 	€	€	€	Ø 
€
€
€
Ø €€€ðð ð ð ð ð ð ð ð *Ð )Ð )Ð )Ð )Ð )ð.ð .ð .ð .ðbð ð ð ð0'ð 'ð 'ð 'ðT'ð 'ð 'ð 'ð :?ð	'ð 	'ð 	'ð 	'ð'ð 'ð 'ð 'ð >BØBGðð ð ð ð ð r-   