HEX
Server: Apache
System: Linux infong-uk86 4.4.400-icpu-106 #2 SMP Mon Sep 15 08:23:40 UTC 2025 x86_64
User: u44115835 (4976590)
PHP: 8.4.17
Disabled: NONE
Upload Files
File: //kunden/lib/python3/dist-packages/breezy/__pycache__/export.cpython-39.pyc
a

�*�^t!�@s|dZddlmZddlZddlZddlZddlZddlmZm	Z	m
Z
mZddd�Zdd
d�Z
dd
�Zddd�Zddd�ZdS)zEExport trees to tarballs, non-controlled directories, zipfiles, etc.
�)�absolute_importN�)�archive�errors�osutils�traceFc	Cs�|dur|durt|�}|dur(t|�}|snt��}t|dd�rrz|j�|���j}Wqrtj	yjYqr0nd}t
�d|�|dkr�|���&t
|||||�D]}q�Wd�n1s�0YdS|����|j|||||d�}	|dk�r|	D]}
ttjdtj��|
�q�nd|du�r4|	D]}
|�|
��q nBt|d��&}|	D]}
|�|
��qDWd�n1�sl0YWd�n1�s�0YdS)	anExport the given Tree to the specific destination.

    :param tree: A Tree (such as RevisionTree) to export
    :param dest: The destination where the files,etc should be put
    :param format: The format (dir, zip, etc), if None, it will check the
                   extension on dest, looking for a match
    :param root: The root location inside the format.
                 It is common practise to have zipfiles and tarballs
                 extract into a subdirectory, rather than into the
                 current working directory.
                 If root is None, the default root will be
                 selected as the destination without its
                 extension.
    :param subdir: A starting directory within the tree. None means to export
        the entire tree, and anything else should specify the relative path to
        a directory to start exporting from.
    :param per_file_timestamps: Whether to use the timestamp stored in the
        tree rather than now(). This will do a revision lookup
        for every file so will be significantly slower.
    :param fileobj: Optional file object to use
    N�_repositoryzexport version %r�dir)�root�subdir�force_mtime�-�buffer�wb)�guess_format�
get_root_name�time�getattrrZget_revisionZget_revision_idZ	timestamprZNoSuchRevisionrZmutterZ	lock_read�dir_exporter_generatorr�sys�stdout�write�open)�tree�dest�formatr
rZper_file_timestamps�fileobjrZunused�chunks�chunk�f�r �//usr/lib/python3/dist-packages/breezy/export.py�export#sF�


� 

�

r"r	cCstj�|�}|dur|}|S)z�Guess the export format based on a file name.

    :param filename: Filename to guess from
    :param default: Default format to fall back to
    :return: format name
    N)r�format_registryZget_format_from_filename)�filename�defaultrr r r!rgsrcCsJ|dkrdStj�|�}tjjD]$}|�|�r |dt|��Sq |S)z+Get just the root name for an export.

    r
�N)�os�path�basenamerr#�
extensions�endswith�len)rZextr r r!rts
rTccs�|dkrd}|dur|�d�}|��}|D]�\}}|dkr<q*|rL|�d�rLq*||krh|jdkr`q*|j}n4|dur�|�|d�r*|t|�dd�}q�q*n|}|�|�s�q*|||fVq*dS)aGIter the entries for tree suitable for exporting.

    :param tree: A tree object.
    :param subdir: None or the path of an entry to start exporting from.
    :param skip_special: Whether to skip .bzr files.
    :return: iterator over tuples with final path, tree path and inventory
        entry for each entry to export
    r&N�/z.bzr�	directoryr)�rstripZiter_entries_by_dir�
startswith�kind�namer,Zhas_filename)rrZskip_special�entriesr(�entryZ
final_pathr r r!�_export_iter_entries�s,	


r5ccszt�|�WnLtyZ}z4|jtjkrDt�|�gkrFt�d��n�WYd}~n
d}~00g}t||�D]�\}}	}
t	|
dd�}t
�||�}|
jdkr�|�
|	||	|ff�n�|
jdvr�t�|�nx|
jdk�r&z|�|	�}
t�|
|�Wn:t�y"}z t�d||
|f��WYd}~n
d}~00nt�d|	|
jf��dVqjtjtjBtjBt	td	d
�B}|�|�D]�\\}}}}t
�||�}d}|�|��r�d}t�t�|||�d
��}|�|�Wd�n1�s�0Y|du�r�|}n
|�|�}t�|||f�dV�qjdS)a\Return a generator that exports this tree to a new directory.

    `dest` should either not exist or should be empty. If it does not exist it
    will be created holding the contents of this tree.

    :note: If the export fails, the destination directory will be
           left in an incompletely exported state: export is not transactional.
    z)Can't export tree to non-empty directory.N�file_id�file)r.ztree-reference�symlinkz,Failed to create symlink %r -> %r, error: %sz(don't know how to export {%s} of kind %rZO_BINARYri�i�r)r'�mkdir�OSError�errnoZEEXIST�listdirrZBzrErrorr5rrZpathjoinr1�appendZget_symlink_targetr8�O_CREAT�O_TRUNC�O_WRONLYZiter_files_bytesZ
is_executable�fdopenr�
writelinesZget_file_mtime�utime)rrr
rrr�eZto_fetchZdp�tpZier6�fullpathZsymlink_target�flags�relpathZtreepathr�mode�out�mtimer r r!r�sX
�


���*

r)NNNFN)r	)T)NNN)�__doc__Z
__future__rr;r'rrr&rrrrr"rrr5rr r r r!�<module>s�
D


'�