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

�*�^G�@stddlmZddlmZmZddlmZddlmZGdd�de	�Z
dd
d�ZGdd
�d
e	�Zdd�Z
ddd�ZdS)�)�absolute_import)�osutils�trace�)�StringIO)�
TreeChangec@sBeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
d�Z	dS)�	TreeDeltaa�Describes changes from one tree to another.

    Contains seven lists with TreeChange objects.

    added
    removed
    renamed
    copied
    kind_changed
    modified
    unchanged
    unversioned

    Each id is listed only once.

    Files that are both modified and renamed or copied are listed only in
    renamed or copied, with the text_modified flag true. The text_modified
    applies either to the content of the file or the target of the
    symbolic link, depending of the kind of file.

    Files are only considered renamed if their name has changed or
    their parent directory has changed.  Renaming a directory
    does not count as renaming all its contents.

    The lists are normally sorted when the delta is created.
    cCs:g|_g|_g|_g|_g|_g|_g|_g|_g|_dS�N)	�added�removed�renamed�copied�kind_changed�modified�	unchanged�unversioned�missing��self�r�./usr/lib/python3/dist-packages/breezy/delta.py�__init__9szTreeDelta.__init__cCsnt|t�sdS|j|jkol|j|jkol|j|jkol|j|jkol|j|jkol|j|jkol|j|jkol|j	|j	kS)NF)
�
isinstancerr
rrr
rrrr�r�otherrrr�__eq__Ds"

�
�
�
�
�
�
�zTreeDelta.__eq__cCs
||kSr	rrrrr�__ne__PszTreeDelta.__ne__c	Cs(d|j|j|j|j|j|j|j|jfS)NzrTreeDelta(added=%r, removed=%r, renamed=%r, copied=%r, kind_changed=%r, modified=%r, unchanged=%r, unversioned=%r))r
rrr
rrrrrrrr�__repr__Ss��zTreeDelta.__repr__cCs(t|jp$|jp$|jp$|jp$|jp$|j�Sr	)�boolrr
rrr
rrrrr�has_changed[s�����zTreeDelta.has_changedFcCst�}t|||||�|��Sr	)r�report_delta�getvalue)r�show_ids�show_unchanged�short_status�outputrrr�get_changes_as_textcszTreeDelta.get_changes_as_textN)FFF)
�__name__�
__module__�__qualname__�__doc__rrrrrr&rrrrrs�rNFcst�}|j||||||d�D�]r��jdkr:|j���q|sJd�jkrJqt�fdd�td�D��}	|	d|	dkr�|	dd	ur�|j���n:�j	dd
kr�|�
�s�t�d�j
df�n|j���q|	ddur�|j���q�jd�jdk�s�jd�jdk�r4�j�r&|j���n|j���q�j	d�j	dk�rX|j���q�j�sv�jd�jdk�r�|j���q|j���qd
d�}
|jj|
d�|jj|
d�|jj|
d�|jj|
d�|jj|
d�|jj|
d�|jj|
d�|jj|
d�|S)z2Worker function that implements Tree.changes_from.)�extra_trees�require_versioned�want_unversioned�FF)NNc3s&|]}�j|o�j|duVqdSr	)�	versioned�kind)�.0�x��changerr�	<genexpr>zs�z!_compare_trees.<locals>.<genexpr>�rrT�symlinkz?Ignoring "%s" as symlinks are not supported on this filesystem.FcSs.|jddur|jd}n
|jd}||jfS�Nrr)�path�file_id�r4r9rrr�
change_key�s
z"_compare_trees.<locals>.change_key��key)rZiter_changesr/r�append�	parent_id�tuple�ranger
r0Zsupports_symlinksrZwarningr9rr�namer
rr�changed_content�
executablerr�sort)Zold_treeZnew_treeZwant_unchangedZspecific_filesZinclude_rootr+r,r-�deltaZ
fully_presentr<rr3r�_compare_treesjsZ�
�
��,rHc@s"eZdZdZddd�Zdd�ZdS)	�_ChangeReporterz Report changes between two treesNTcs��dur$|durtd���fdd�}||_|jdurHddlm}|j|_||_ddd	d
ddd
�|_ddddd�|_||_|r�t	j
|_
n
dd�|_
|dur�d|_g|_n&|d|_|d|_|�d|jf�dS)a;Constructor

        :param output: a function with the signature of trace.note, i.e.
            accepts a format and parameters.
        :param supress_root_add: If true, adding the root will be ignored
            (i.e. when a tree has just been initted)
        :param output_file: If supplied, a file-like object to write to.
            Only one of output and output_file may be supplied.
        :param unversioned_filter: A filter function to be called on
            unversioned files. This should return True to ignore a path.
            By default, no filtering takes place.
        :param view_info: A tuple of view_name,view_files if only
            items inside a view are to be reported on, or None for
            no view filtering.
        :param classify: Add special symbols to indicate file kind.
        Nz*Cannot specify both output and output_filecs��||d�dS)N�
��write)Zfmt�args��output_filerrr%�sz(_ChangeReporter.__init__.<locals>.outputr)r�K� �N�M�D�!)�kind changedr�createdr�deletedr�+�-�?)r
rrrcSsdS)N�r)r0rrr�<lambda>��z*_ChangeReporter.__init__.<locals>.<lambda>rz8Operating on whole tree but only reporting on '%s' view.)
ZBzrErrorr%r\rZnote�suppress_root_add�modified_map�
versioned_map�unversioned_filterr�kind_markerZ	view_name�
view_files)rr%r_rOrbZ	view_info�classifyrrrNrr�sB
��



�z_ChangeReporter.__init__cCs�t��rdS|ddkr*|dkr*|jr*dS|jrFt�|j|d�sFdS|dkrn|jdurj|�|d�rjdSd}|dkr�|s�|s�|dkr�|s�|r�|\}}	n|d|d}}	|ddur�||�|d�7}|d	7}n"|d
kr�d}|d}	nd}|d}	|�rd}
n|�rd}
n
|j|}
|d
k�r4|	|�|d�7}	n |ddu�rT|	|�|d�7}	|�r`d}nd}|�	d|
|j
||||	�dS)aQReport one change to a file

        :param path: The old and new paths as generated by Tree.iter_changes.
        :param versioned: may be 'added', 'removed', 'unchanged', or
            'unversioned.
        :param renamed: may be True or False
        :param copied: may be True or False
        :param modified: may be 'created', 'deleted', 'kind changed',
            'modified' or 'unchanged'.
        :param exe_change: True if the execute bit has changed
        :param kind: A pair of file kinds, as generated by Tree.iter_changes.
            None indicates no file present.
        Nrr\r
rrrVrz => r�R�CrX�*rQz%s%s%s %s%s)rZis_quietr_rdrZ
is_inside_anyrbrcrar%r`)r�pathsr/rr
r�
exe_changer0Zold_pathr9�renameZexerrr�report�s\�
���




�z_ChangeReporter.report)NTNNNT)r'r(r)r*rrlrrrrrI�s�
8rIc

Cs>ddddd�}dd�}t||d�D�]}d	}d
|jvr�d
|jvr�|jd|jdksh|jd|jdkr�|jrxd
}d	}q�d
}d	}nd	}d	}|jd|jdkr�|jdd
ur�d}n|jdd
ur�d}nd}nH|jr�d}n|jdd
ur�d}nd}|jddk�r|jd|jdk}||j}	|�|j	|	|||||j�q"d
S)a�Report the changes from a change iterator.

    This is essentially a translation from low-level to medium-level changes.
    Further processing may be required to produce a human-readable output.
    Unfortunately, some tree-changing operations are very complex
    :change_iterator: an iterator or sequence of changes in the format
        generated by Tree.iter_changes
    :param reporter: The _ChangeReporter that will report the changes.
    rrr
r))TT)TF)FTr.cSs.|jddur|jd}n
|jd}t�|�Sr8)r9rZ	splitpathr;rrr�path_keyCs
z report_changes.<locals>.path_keyr=FNrrTrWrXrVrr�file)
�sortedrCr@r
r0rDrEr/rlr9)
Zchange_iteratorZreporterZversioned_change_maprmr4rjr
rrZversioned_changerrr�report_changes2sJ���
�rpr\Tcs�d!�fdd�	����fdd�}�fdd�}	���fdd	��d"������fdd
�	}
|
|jdd�|
|jdd�|
|jdd�g�|
|jddd
|d�|
|jddd
|d�|
|jddd
|	d�|
|j�dd�|r�|
|jdd�|
|jdd �dS)#awOutput this delta in status-like form to to_file.

    :param to_file: A file-like object where the output is displayed.

    :param delta: A TreeDelta containing the changes to be displayed

    :param short_status: Single-line status if True.

    :param show_ids: Output the file ids if True.

    :param show_unchanged: Output the unchanged files if True.

    :param indent: Added at the beginning of all output lines (for merged
        revisions).

    :param predicate: A callable receiving a path returning True if the path
        should be displayed.

    :param classify: Add special symbols to indicate file kind.
    Ncs:�s|S|dkr|d7}n|dkr*|d7}|r6|d7}|S)NZ	directory�/r7�@rhr)r9r0�
meta_modified)rerr�
decorate_path�s
z#report_delta.<locals>.decorate_pathcs��|jd|jd|���}��d|�|js8|��r���t|j|jd|jdf|j|j|j	d|j	df|j
d|j
df|jd|jdf|j��dS)Nrz => %s)r9r0rsrLrDr?rr:r/r@rCrE)�itemZdec_new_path)rt�extra_modified�to_filerr�show_more_renamed�s�z'report_delta.<locals>.show_more_renamedcs"��d|jd|jdf�dS)Nz (%s => %s)rr)rLr0)ru)rwrr�show_more_kind_changed�sz,report_delta.<locals>.show_more_kind_changedcs2�|||�}�r ��||�n��||�dSr	rK)r9r0rs�default_format�with_file_id_formatZdec_path)rtr"rwrr�	show_path�szreport_delta.<locals>.show_path�%s�%-30scs�|r�d}�r|}nd}�|d}|D]�}|jddurN|jd}	|jd}
n|jd}	|jd}
�durt�|	�stq&|s��s����|d�d}��|��|	|
|��||�|dur�||��r�t|dd�r��d	|j�d
����d�q&dS)NFr\z  rrz:
Tr:z %szutf-8rJ)r9r0rLrs�getattrr:�decode)�filesZlong_status_nameZshort_status_letterrzr{�	show_moreZheader_shown�prefixrur9r0)�indent�	predicater$r"r|rwrr�	show_list�s4



�zreport_delta.<locals>.show_listrrTr
�ArrUrrf)r{r�r
rgrVrPrrSr�S�unknownrQ)N)r}r~N)	rr
rrr
rrrr)rwrGr$r"r#r�r�rerxryr�r)	rertrvr�r�r$r"r|rwrr ms2
	� ��
�r )NFF)FFFr\NT)Z
__future__rZbreezyrrZsixishrZtreer�objectrrHrIrpr rrrr�<module>sN�
C;�