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

�*�^��@sHddlmZddlmZee�d�Gdd�de�ZGdd�de�Zd	S)
�)�absolute_import�)�lazy_importz
import patiencediff
c@sdeZdZdZdZdZdZeeefdd�Zdd�Zd	d
�Z	dd�Z
ddd�Zddd�Ze
dd��ZdS)�	TextMergeaBase class for text-mergers
    Subclasses must implement _merge_struct.

    Many methods produce or consume structured merge information.
    This is an iterable of tuples of lists of lines.
    Each tuple may have a length of 1 - 3, depending on whether the region it
    represents is conflicted.

    Unconflicted region tuples have length 1.
    Conflicted region tuples have length 2 or 3.  Index 1 is text_a, e.g. THIS.
    Index 1 is text_b, e.g. OTHER.  Index 2 is optional.  If present, it
    represents BASE.
    s	<<<<<<< 
s	>>>>>>> 
s=======
cCs||_||_||_dS�N)�a_marker�b_marker�split_marker)�selfrrr	�r�2/usr/lib/python3/dist-packages/breezy/textmerge.py�__init__0szTextMerge.__init__cCstd��dS)z�Return structured merge info.  Must be implemented by subclasses.
        See TextMerge docstring for details on the format.
        z_merge_struct is abstractN)�NotImplementedError)r
rrr�
_merge_struct6szTextMerge._merge_structccsp|D]f}t|�dkr*|dD]
}|Vqq|jV|dD]
}|Vq:|jV|dD]
}|VqV|jVqdS)z$Convert merge result tuples to linesrrN)�lenrr	r)r
�struct_iter�lines�linerrr�struct_to_lines<s
zTextMerge.struct_to_linesccsH|D]>}t|d�dkr |Vqt|�dkrt|d�dkr|VqdS)z2Iterate through input tuples, skipping empty ones.rrN)r)r
r�grouprrr�iter_usefulKs
zTextMerge.iter_usefulFcCs@g}d}|�|�D]}|�|�t|�dkrd}q|�|�|fS)aProduce an iterable of lines, suitable for writing to a file
        Returns a tuple of (line iterable, conflict indicator)
        If reprocess is True, a two-way merge will be performed on the
        intermediate structure, to reduce conflict regions.
        FrT)�merge_struct�appendrr)r
�	reprocessZstructZ	conflictsrrrr�merge_linesSs
zTextMerge.merge_linescCs(|�|���}|dur |�|�S|SdS)zProduce structured merge infoTN)rr�reprocess_struct)r
rrrrrras
zTextMerge.merge_structccsD|D]:}t|�dkr|Vqt|d|d���D]
}|Vq2qdS)aA Perform a two-way merge on structural merge info.
        This reduces the size of conflict regions, but breaks the connection
        between the BASE text and the conflict region.

        This process may split a single conflict region into several smaller
        ones, but will not introduce new conflicts.
        rrN)r�Merge2r)rrZnewgrouprrrris
	zTextMerge.reprocess_structN)F)F)�__name__�
__module__�__qualname__�__doc__�A_MARKER�B_MARKER�SPLIT_MARKERr
rrrrr�staticmethodrrrrrrs�


rc@s.eZdZdZejejejfdd�Zdd�Z	dS)rz� Two-way merge.
    In a two way merge, common regions are shown as unconflicting, and uncommon
    regions produce conflicts.
    cCs t�||||�||_||_dSr)rr
�lines_a�lines_b)r
r%r&rrr	rrrr
�szMerge2.__init__ccs�t�d|j|j�}d}d}|��D]N\}}}|j||�|j||�fV|j|||�fV||}||}q"|j|d�|j|d�fVdS)zGReturn structured merge info.
        See TextMerge docstring.
        Nr���)ZpatiencediffZPatienceSequenceMatcherr%r&Zget_matching_blocks)r
ZsmZpos_aZpos_bZaiZbi�lrrrr�s
�
zMerge2._merge_structN)
rrrr rr!r"r#r
rrrrrrzs�
rN)Z
__future__rr�globals�objectrrrrrr�<module>s^