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/dulwich/__pycache__/fastexport.cpython-39.pyc
a

�~�_C"�@svdZddlmZddlmZmZmZmZddlm	Z	m
ZmZm
Z
ddlZdd�ZGdd	�d	e�ZGd
d�de
j�ZdS)z!Fast export/import functionality.�)�commit_tree)�Blob�Commit�Tag�ZERO_SHA)�commands�errors�parser�	processorNcCs|�dd�\}}||�d�fS)N� <��>)�rsplit�rstrip)�text�nameZemail�r�4/usr/lib/python3/dist-packages/dulwich/fastexport.py�split_email+src@sTeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	ddd�Z
ddd�ZdS)�GitFastExporterz5Generate a fast-export output stream for Git objects.cCs||_||_i|_d|_dS)Nr)�outf�store�markers�_marker_idx)�selfrrrrr�__init__3szGitFastExporter.__init__cCs |j�t|d|j��d�dS)N�	__bytes__�
)r�write�getattr�__repr__�r�cmdrrr�	print_cmd9szGitFastExporter.print_cmdcCs |jd7_d|jf�d�S)Nrz%d�ascii)r�encode)rrrr�_allocate_marker<sz GitFastExporter._allocate_markercCs&|��}|j|j|<t�||j�|fS�N)r&�idrrZBlobCommand�data)r�blob�markerrrr�_export_blob@szGitFastExporter._export_blobcCs|�|�\}}|�|�|Sr')r,r#)rr*r"r+rrr�	emit_blobEs
zGitFastExporter.emit_blobccs�|j�||�D]�\\}}\}}\}}|dur:t�|�Vqt�|�sX|j|}	|�|	�}
||krv|durvt�||�V||ks�||krd|
}t�|||d�VqdS)N�:)	rZtree_changesrZFileDeleteCommand�stat�S_ISDIRr-ZFileRenameCommandZFileModifyCommand)r�	base_treeZnew_tree�old_path�new_pathZold_modeZnew_modeZ
old_hexshaZ
new_hexshar*r+Zprefixed_markerrrr�_iter_filesJs �


�zGitFastExporter._iter_filesNc

Cs�t|�||j��}|��}|jr:|jd}|jdd�}nd}g}t|j�\}}	t|j�\}
}t�	||||	|j
|jf|
||j|j
f|j|||�}||fS)Nrr)�listr4�treer&�parentsr�author�	committerrZ
CommitCommand�author_time�author_timezone�commit_time�commit_timezone�message)
r�commit�refr1Z	file_cmdsr+�from_�mergesr8�author_emailr9�committer_emailr"rrr�_export_commit\s$
�
�zGitFastExporter._export_commitcCs |�|||�\}}|�|�|Sr')rEr#)rr?r@r1r"r+rrr�emit_commitos
zGitFastExporter.emit_commit)N)N)�__name__�
__module__�__qualname__�__doc__rr#r&r,r-r4rErFrrrrr0s
rc@sjeZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�GitImportProcessorzKAn import processor that imports into a Git repository using Dulwich.

    NFcCs,tj�|||�||_t|_i|_i|_dSr')r
�ImportProcessorr�repor�last_commitr�	_contents)rrM�params�verboserrrrr{s
zGitImportProcessor.__init__cCs |�d�r|j|dd�S|S)Nr.r)�
startswithr)rZ	objectishrrr�
lookup_object�s
z GitImportProcessor.lookup_objectcCst�|�}|�|j�|jSr')r	ZImportParserZprocessZ
iter_commandsr)r�stream�prrr�
import_stream�s
z GitImportProcessor.import_streamcCs2t�|j�}|jj�|�|jr.|j|j|j<dS)zProcess a BlobCommand.N)	r�from_stringr)rM�object_store�
add_object�markr(r)rr"r*rrr�blob_handler�szGitImportProcessor.blob_handlercCsdS)zProcess a CheckpointCommand.Nrr!rrr�checkpoint_handler�sz%GitImportProcessor.checkpoint_handlercCs0t�}|jdur|j}n|j}|\}}}}|j\}}	}
}|d|d|_||_t|�|_|d|	d|_||_t|
�|_|j|_g|_	|j
r�|�|j
�|_
|�|j
�|�
�D]�}|jdk�r|jdur�t�|j�}
|jj�|
�|
j}n|�|j�}|j|f|j|j<q�|jdk�r&|j|j=q�|jdk�rH|j|j|j|j<q�|jdk�rt|j|j|j|j<|j|j=q�|jdk�r�i|_q�td	|j��q�t|jjd
d�|j� �D��|_!|j"t#k�r�|j	�$|j"�|j%D]}|j	�$|�|���q�|jj�&|�|j|j|j'<|j|_"|j(�r,|j|j)|j(<dS)zProcess a CommitCommand.Nrr
s
filemodifys
filedeletesfilecopys
filerenames
filedeleteallzCommand %s not supportedcss |]\}\}}|||fVqdSr'r)�.0�path�mode�hexsharrr�	<genexpr>��z4GitImportProcessor.commit_handler.<locals>.<genexpr>)*rr8r9r;�intr:r=r<r>r7rArS�_reset_baseZ
iter_filesrr)rrWrMrX�addr(Zdatarefr_rOr^Zsrc_pathZ	dest_pathr2r3�	Exceptionr�itemsr6rNr�appendrBrYr@rZr)rr"r?r8Zauthor_namerCZauthor_timestampr;Zcommitter_namerDZcommit_timestampr=Zfilecmdr*Zblob_id�mergerrr�commit_handler�sp
�


����
z!GitImportProcessor.commit_handlercCsdS)zProcess a ProgressCommand.Nrr!rrr�progress_handler�sz#GitImportProcessor.progress_handlercCsZ|j|krdSi|_||_|tkrV|j|j}|jj�|�D]\}}}||f|j|<q<dSr')rNrOrrMr6rXZiter_tree_contents)rZ	commit_idZtree_idr^r_r`rrrrd�s
�zGitImportProcessor._reset_basecCs8|jdurt}n|�|j�}|�|�||jj|j<dS)zProcess a ResetCommand.N)rArrSrdrM�refsr@)rr"rArrr�
reset_handler�s


z GitImportProcessor.reset_handlercCsBt�}|j|_|j|_|j|_|j�|�|j|jjd|j<dS)zProcess a TagCommand.z
refs/tags/N)	rZtaggerr>�tagrrMrYr(rl)rr"rnrrr�tag_handler�szGitImportProcessor.tag_handlercCst�|j��dS)zProcess a FeatureCommand.N)�fastimport_errorsZUnknownFeatureZfeature_namer!rrr�feature_handler�sz"GitImportProcessor.feature_handler)NFN)rGrHrIrJrrSrVr[r\rjrkrdrmrorqrrrrrKus
9		rK)rJZ
dulwich.indexrZdulwich.objectsrrrrZ
fastimportrrrpr	r
r/r�objectrrLrKrrrr�<module>sE