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/fastimport/processors/__pycache__/info_processor.cpython-39.pyc
a

�r�Z;+�@sjdZddlmZddlmZddlmZmZddlm	Z	m
Z
ddlZGdd	�d	e
j�Z
d
d�Zdd
�ZdS)zFImport processor that dump stats about the input (and doesn't import).�)�absolute_import�)�
reftracker)�invert_dict�invert_dictset)�commands�	processorNc@steZdZdZddd�Zdd�Zdd	�Zdd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)�
InfoProcessora<An import processor that dumps statistics about the input.

    No changes to the current repository are made.

    As well as providing useful information about an import
    stream before importing it, this processor is useful for
    benchmarking the speed at which data can be extracted from
    the source.
    NrcCstjj||||d�dS)N)�outf)r�ImportProcessor�__init__)�self�params�verboser
�r�F/usr/lib/python3/dist-packages/fastimport/processors/info_processor.pyr-s�zInfoProcessor.__init__cCs�i|_tjD]}d|j|<qi|_tjD]}d|j|<q(i|_d|_t�|_d|_	d|_
d|_d|_d|_
i|_dD]}t�|j|<qti|_t��|_i|_i|_i|_dS)NrF)�new�used�unknown�unmarked)�
cmd_countsr�
COMMAND_NAMES�file_cmd_counts�FILE_COMMAND_NAMES�
parent_counts�max_parent_count�set�
committers�separate_authors_found�symlinks_found�executables_found�sha_blob_references�lightweight_tags�blobs�blob_ref_countsrZ
RefTracker�merges�rename_old_paths�copy_source_paths)r
�cmd�fcZusagerrr�pre_process1s,


zInfoProcessor.pre_processcs�tj}tj}��d�fdd�|D�t���d�fdd�|D�t��jd�rVg}t�jd�D]*}|�jvrb�j|}|�	d||f�qbt
�j�}|�	d	|f��j�j
�j�jd
�}��d|t���dt|���t�t�jj�}��d
dd�|��D�dt���d�j��d��jdk�rV��d�j��t
t���d�j��t
t��jd�r��j�rr�jd=��d�j��t
t��j�r�t�j�}	t|	���}
��d|
t
t��jd�r�d�ji}��d|���dS)NzCommand countscs g|]}|�d��j|f�qS��utf-8)�decoder��.0�c�r
rr�
<listcomp>S�z.InfoProcessor.post_process.<locals>.<listcomp>zFile command countscs g|]}|�d��j|f�qSr+)r-rr.r1rrr2Ur3scommit�z
parents-%dztotal revisions merged)zseparate authors foundZexecutablesZsymlinkszblobs referenced by SHAz
Parent countszCommit analysisz
Head analysiscSs.g|]&\}}|�d�d�dd�|D��f�qS)r,�, cSsg|]}|�d��qSr+)r-)r/�mrrrr2lr3z9InfoProcessor.post_process.<locals>.<listcomp>.<listcomp>)r-�join)r/�k�vrrrr2ks��ZMergesrzRename old pathszCopy source pathssblobrzBlob usage trackingzBlob reference countssresetzlightweight tagszReset analysis)rrr�_dump_stats_group�strr�rangerr�append�lenr%rr rr!�sorted�items�_foundrr�heads�_iterable_as_config_listrr&r'r#r$rr")r
Z	cmd_namesZfc_namesZp_items�i�countZmerges_count�flagsrBZblobs_by_countZ
blob_itemsZreset_statsrr1r�post_processNst��


���
�
��
��zInfoProcessor.post_processcCs�|jrp|j�d|f�|D]D\}}|dur4||�}t|�tkrL|�dd�}|j�d||f�q|j�d�nD|j�d|f�|D],\}}|dur�||�}|j�d||f�q�dS)	a�Dump a statistics group.
        
        In verbose mode, do so as a config file so
        that other processors can load the information if they want to.
        :param normal_formatter: the callable to apply to the value
          before displaying it in normal mode
        :param verbose_formatter: the callable to apply to the value
          before displaying it in verbose mode
        z[%s]
N� �-z%s = %s
�
z%s:
z	%s	%s
)rr
�write�typer;�replace)r
�titler@Znormal_formatterZverbose_formatter�name�valuerrrr:�szInfoProcessor._dump_stats_groupcCs|j|jd7<dS)zProcess a ProgressCommand.r4N�rrO�r
r(rrr�progress_handler�szInfoProcessor.progress_handlercCsr|j|jd7<|jdur2|jd�|j�n<|jd�|j�z|jd�|j�WntylYn0dS)zProcess a BlobCommand.r4Nrrr)rrO�markr#�add�id�remove�KeyErrorrRrrr�blob_handler�s
zInfoProcessor.blob_handlercCs|j|jd7<dS)zProcess a CheckpointCommand.r4NrQrRrrr�checkpoint_handler�sz InfoProcessor.checkpoint_handlercCs�|j|jd7<|j�|j�|jdur2d|_|��D]�}|j|jd7<t	|t
j�r�|jd@rnd|_
t�|j�r�d|_|jdur�|jddkr�|�|j�q�d|_q:t	|t
j�r�|j�|jt���|j�q:t	|t
j�r:|j�|jt���|j�q:|j�|�}t|�}z|j |d7<Wn0t!�yXd|j |<||j"k�rT||_"Yn0|j#�r�|j#D]0}||j#v�r�|j#|d7<n
d|j#|<�qhdS)zProcess a CommitCommand.r4NT�Ir�:)$rrOrrUZ	committerZauthorrZ
iter_filesr�
isinstancerZFileModifyCommand�moder �stat�S_ISLNKrZdataref�_track_blobr!ZFileRenameCommandr&�
setdefaultrVrZold_pathZFileCopyCommandr'Zsrc_pathrZtrack_headsr>rrXrr%)r
r(r)�parentsZparent_count�mergerrr�commit_handler�s@




zInfoProcessor.commit_handlercCsP|j|jd7<|j�d�r0|jd7_n|jdurL|j�|j|j�dS)zProcess a ResetCommand.r4z
refs/tags/N)rrO�ref�
startswithr"Zfrom_rZtrack_heads_for_refrRrrr�
reset_handler�s
�zInfoProcessor.reset_handlercCs|j|jd7<dS)zProcess a TagCommand.r4NrQrRrrr�tag_handler�szInfoProcessor.tag_handlercCs8|j|jd7<|j}|tjvr4|�d|f�dS)zProcess a FeatureCommand.r4z.feature %s is not supported - parsing may failN)rrOZfeature_namerZ
FEATURE_NAMESZwarning)r
r(Zfeaturerrr�feature_handler�s
�zInfoProcessor.feature_handlercCs�||jvr|j|d7<nj||jdvrHd|j|<|jd�|�n@||jdvrx|jd�|�|jd�|�n|jd�|�dS)Nr4rrrr)r$r#rWrU)r
rTrrrras

zInfoProcessor._track_blob)NrN)NN)�__name__�
__module__�__qualname__�__doc__rr*rGr:rSrYrZrerhrirjrarrrrr	"s

B�
,
r	cCsddg|S)z#Format a found boolean as a string.Zno�foundr)�brrrrAsrAcCs0t|�}t|�dkr"d|dfSd�|�SdS)z�Format an iterable as a sequence of comma-separated strings.
    
    To match what ConfigObj expects, a single item list has a trailing comma.
    r4z%s,rr5N)r?r>r7)�sr@rrrrCsrC)rnZ
__future__r�rZhelpersrrZ
fastimportrrr_rr	rArCrrrr�<module>sp