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__/add.cpython-39.pyc
a

�*�^��@stdZddlmZddlZddlZddlmZmZmZddl	m
Z
Gdd�de�ZGd	d
�d
e�Z
Gdd�de�ZdS)
z3Helper functions for adding files to working trees.�)�absolute_importN�)�errors�osutils�ui)�gettextc@s2eZdZdZd	dd�Zejfdd�Zd
dd�ZdS)�	AddActionz=A class which defines what action to take when adding a file.NcCs.||_|durtj|_d|_|dur*||_dS)a*Initialize an action which prints added files to an output stream.

        :param to_file: The stream to write into. This is expected to take
            Unicode paths. If not supplied, it will default to ``sys.stdout``.
        :param should_print: If False, printing will be suppressed.
        NF)�_to_file�sys�stdout�should_print)�self�to_filer�r�,/usr/lib/python3/dist-packages/breezy/add.py�__init__#szAddAction.__init__cCs|jr|j�d||��dS)z�Add path to inventory.

        The default action does nothing.

        :param inv: The inventory we are working with.
        :param path: The FastPath being added
        :param kind: The kind of the object being added.
        z
adding %s
N)rr	�write)r
�inv�	parent_ie�path�kindZ_quoterrr�__call__1s	zAddAction.__call__cCsdS)a�Test whether the given file should be skipped or not.

        The default action never skips. Note this is only called during
        recursive adds

        :param tree: The tree we are working in
        :param path: The path being added
        :param kind: The kind of object being added.
        :param stat: Stat result for this file, if available already
        :return bool. True if the file should be skipped (not added)
        Fr)r
�treerr�
stat_valuerrr�	skip_file>szAddAction.skip_file)NN)N)	�__name__�
__module__�__qualname__�__doc__rrZquotefnrrrrrrr s

rc@seZdZdZdZddd�ZdS)�AddWithSkipLargeActionzCA class that can decide to skip a file if it's considered too largeNcCs�|dkrdSd}|jdur.|��}|�|�|_|durDtj�|�}n|j}|jdkr~||jkr~tj�	t
d��|||j��dSdS)N�fileFzadd.maximum_file_sizerz+skipping {0} (larger than {1} of {2} bytes)T)�_maxSizeZget_config_stack�get�osr�getsize�st_sizerZ
ui_factoryZshow_warningr�format)r
rrrrZopt_nameZconfig�	file_sizerrrrRs"
��z AddWithSkipLargeAction.skip_file)N)rrrrr!rrrrrrMsrcs6eZdZdZd	�fdd�	Z�fdd�Zdd�Z�ZS)
�AddFromBaseActionz:This class will try to extract file ids from another tree.Ncs$tt|�j||d�||_||_dS)N)rr)�superr(r�	base_tree�	base_path)r
r*r+rr��	__class__rrrhs
�zAddFromBaseAction.__init__csN|�||�\}}|dur4|jrJ|j�d||f�ntt|��||||�}|S)Nzadding %s w/ file id from %s
)�_get_base_file_idrr	rr)r(r)r
rrrr�file_idr+r,rrrns�
�zAddFromBaseAction.__call__cCstz|j�|j�}Wntjy&Yn00t�|t�|��}|j�|�}|durV||fSt�|j	|�}|j�|�|fS)z�Look for a file id in the base branch.

        First, if the base tree has the parent directory,
        we look for a file with the same name in that directory.
        Else, we look for an entry in the base tree with the same path.
        N)
r*Zid2pathr/rZNoSuchIdrZpathjoin�basenameZpath2idr+)r
rr�parent_pathr+Zbase_idZfull_base_pathrrrr.}sz#AddFromBaseAction._get_base_file_id)NN)rrrrrrr.�
__classcell__rrr,rr(esr()rZ
__future__rr
r#�rrrZi18nr�objectrrr(rrrr�<module>s-