https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/mercurial/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/mercurial/__pycache__/simplemerge.cpython-310.pyc
o

�]LbpC�@s�ddlmZddlmZddlmZmZmZddlm	Z	dd�Z
dd	�ZGd
d�de�Z
dd
�Zdd�Zdd�Zdd�Z					d&dd�Zdd�Zdd�Zdd�ZGd d!�d!e�Z	"	#d'd$d%�ZdS)(�)�absolute_import�)�_)�error�mdiff�pycompat)�
stringutilcCs`|d|dks
J�|d|dksJ�t|d|d�}t|d|d�}||kr.||fSdS)aGiven two ranges return the range where they intersect or None.

    >>> intersect((0, 10), (0, 6))
    (0, 6)
    >>> intersect((0, 10), (5, 15))
    (5, 10)
    >>> intersect((0, 10), (10, 15))
    >>> intersect((0, 9), (10, 15))
    >>> intersect((0, 9), (7, 15))
    (7, 9)
    rrN)�max�min)�ra�rb�sa�sb�r�7/usr/lib/python3/dist-packages/mercurial/simplemerge.py�	intersectsrcCsR||||kr
dStt�||�t�||��D]\}}||||kr&dSqdS)z:Compare a[astart:aend] == b[bstart:bend], without slicing.FT)�zipr�xrange)�a�astart�aend�b�bstart�bend�ia�ibrrr�
compare_range5s��rc@s2eZdZdZddd�Zdd�Zdd�Zd	d
�ZdS)�
Merge3Textz�3-way merge of texts.

    Given strings BASE, OTHER, THIS, tries to produce a combined text
    incorporating the changes from both BASE->OTHER and BASE->THIS.NcCs^||_||_||_|durt�|�}|durt�|�}|dur$t�|�}||_||_||_dS�N)�basetext�atext�btextr�
splitnewlines�baserr)�selfrr r!r#rrrrr�__init__Hs



zMerge3Text.__init__ccs��|��D]n}|d}|dkr||j|d|d�fVq|dks&|dkr5||j|d|d�fVq|dkrH||j|d|d�fVq|dkrp||j|d|d�|j|d	|d
�|j|d|d�ffVqt|��d
S)a�Yield sequence of line groups.  Each one is a tuple:

        'unchanged', lines
             Lines unchanged from base

        'a', lines
             Lines taken from a

        'same', lines
             Lines taken from a (and equal to b)

        'b', lines
             Lines taken from b

        'conflict', (base_lines, a_lines, b_lines)
             Lines from base were changed to either a or b and conflict.
        r�	unchangedr��a�same�b�conflict����N)�
merge_regionsr#rr�
ValueError)r$�t�whatrrr�merge_groupsVs$���	�zMerge3Text.merge_groupsccs��d}}}|��D]�}|\}}}}}	}
||}|dksJ�|||ks'J�||
|	ks/J�||}|	|}
||}|dksAJ�|
dksGJ�|dksMJ�|sQ|
r�t|j|||j||�}t|j||	|j||�}t|j|||j||	�}|r{d||fVn)|r�|s�d||	fVn|r�|s�d||fVn|s�|s�d||||||	fVntd��|}|	}|}|dkr�||ks�J�||	ks�J�||ks�J�d||fV|}|}|
}qdS)	a�Return sequences of matching and conflicting regions.

        This returns tuples, where the first value says what kind we
        have:

        'unchanged', start, end
             Take a region of base[start:end]

        'same', astart, aend
             b and a are different from base but give the same result

        'a', start, end
             Non-clashing insertion from a[start:end]

        'conflict', zstart, zend, astart, aend, bstart, bend
            Conflict between a and b, with z as common ancestor

        Method is as follows:

        The two sequences align only on regions which match the base
        and both descendants.  These are found by doing a two-way diff
        of each one against the base, and then finding the
        intersections between those regions.  These "sync regions"
        are by definition unchanged in both and easily dealt with.

        The regions in between can be in any of three cases:
        conflicted, or changed on only one side.
        rr)r*r(r+s#can't handle a=b=base but unmatchedr&N)�find_sync_regionsrrr#r�AssertionError)r$�izrr�region�zmatch�zend�amatchr�bmatchr�matchlen�len_a�len_b�len_base�equal_a�equal_b�samerrrr0|sX�����zMerge3Text.merge_regionscCs�d}}t�|j|j�}t�|j|j�}t|�}t|�}g}||kr�||kr�||\}}	}
||\}}}
t|||
f|||
f�}|r�|d}|d}||}||
ksUJ�||
ks[J�||ksaJ�||ksgJ�|	||}|||}||}||}|j||�|j||�ks�J|j||�|j||�f��|j||�|j	||�ks�J�|�
||||||f�||
||
kr�|d7}n|d7}||kr�||ks&t|j�}t|j�}t|j	�}|�
||||||f�|S)z�Return a list of sync regions, where both descendants match the base.

        Generates a list of (base1, base2, a1, a2, b1, b2).  There is
        always a zero-length sync region at the end of all the files.
        rr)r�get_matching_blocksrr r!�lenrr#rr�append)r$rr�amatches�bmatchesr>r?�sl�abaser;�alen�bbaser<�blen�i�intbase�intend�intlen�asub�bsubrrrrrr5�sJ� 
�
'

zMerge3Text.find_sync_regions)NNN)�__name__�
__module__�__qualname__�__doc__r%r4r0r5rrrrrBs
&YrcCs.t�|���rtd�|j��}t�|��dS)zUverifies that text is non-binary (unless opts[text] is passed,
    then we just warn)s%s looks like a binary file.N)r�binary�textr�fctx�pathr�Abort)�input�msgrrr�_verifytexts
�r_cGsttdd�|D��}g}|D]*}|jr2|jr%|jd�|d�d|j}n|j}|�t�|d��q
|�d�q
|S)Ncss$�|]
}|jrt|j�ndVqdS)rN)�labelrE)�.0r]rrr�	<genexpr>s�"z!_format_labels.<locals>.<genexpr>�:r� �H)r	r`�label_detail�ljustrFr�ellipsis)�inputs�pad�labelsr]r`rrr�_format_labelss���rlcCs:t|j�dkr|jd�d�rdS|jd�d�rdSdS)Nrs
�
�
)rEr�endswith)�m3rrr�_detect_newline/srqcCst|�}t|�}d}||kr.||kr.||||kr.|d7}||kr.||kr.||||ks|}d}||krb||krb||d||dkrb|d7}||krb||krb||d||dksH|}|d|�}||||�}||||�}	|||d�}
|||	|
fS)z�Trim conflict regions of lines where A and B sides match.

    Lines where both A and B have made the same changes at the beginning
    or the end of each merge region are eliminated from the conflict
    region and are instead considered the same.
    rrN)rE)�a_lines�b_linesrKrM�ii�startmatches�
endmatches�lines_before�new_a_lines�new_b_lines�lines_afterrrr�	_minimize8s"  �,,�r{N�<<<<<<<�=======�>>>>>>>cCs�t|�}d}|r|d|}|r|d|}|��}g}	|D]I\}
}|
dkrbd}|\}}
}t|
|�}|\}}
}}|	�|�|	�||�|	�|
�|	�||�|	�|�|	�||�|	�|�q|	�|�q|	|fS)zReturn merge in cvs-like form.Frdr+T)rqr4r{�extendrF)rp�name_a�name_b�start_marker�
mid_marker�
end_marker�newline�	conflictsr4�linesr3�group_lines�
base_linesrrrs�	minimizedrwrzrrr�render_minimizedUs.	




r�cCs�t|�}d}g}|��D]F\}}|dkrM|\}	}
}d}|�d||�|�|
�|�d||�|�|	�|�d|�|�|�|�d||�q|�|�q||fS)z+Render conflicts as 3-way conflict markers.Fr+Ts<<<<<<< s||||||| r}s>>>>>>> )rqr4rFr)rpr�r��	name_baser�r�r�r3r�r�rrrsrrr�
render_merge3xs 



r�cCspt|�}g}d}|��D]�\}}|dkr�|\}	}
}d�|	�}ttj|d�|�|	|d��}
ttj|d�|
�|	|d��}dd�}dd�}|�d	|�||�||
�kr{|�d
||�|�|
�|�d||�|�d||�|�||
|	|��n)|�d||�|�d||�|�|||	|
��|�d
||�|�|�|�d
|�d}q|�|�q||fS)zDRender conflicts as conflict markers with one snapshot and one diff.Fr+�)�lines1�lines2cSstdd�|D��S)Ncss,�|]\}}|dkr|d|dVqdS)�=rrNr)ra�block�kindrrrrb�s���z;render_mergediff.<locals>.matching_lines.<locals>.<genexpr>)�sum)�blocksrrr�matching_lines�s�z(render_mergediff.<locals>.matching_linescss��|D]?\}}|dkr||d|d�D]}d|Vqq||d|d�D]}d|Vq(||d|d�D]}d|Vq:qdS)	Nr�rrrd�-r'r,�+r)r�r�r�r�r��linerrr�
diff_lines�s����z$render_mergediff.<locals>.diff_linesr|s======= s------- s+++++++ r~T)rqr4�join�listr�	allblocksrFr)rpr�r�r�r�r�r�r3r�r�rrrs�	base_text�b_blocks�a_blocksr�r�rrr�render_mergediff�sR

����	

r�cCsFg}|��D]\}}|dkr|D]	}|�||�qq|�|�q|S)Nr+)r4r)rp�sidesr�r3r��siderrr�_resolve�s�r�c@seZdZddd�Zdd�ZdS)�
MergeInputNcCs||_||_||_d|_dSr)rZr`rf�_text)r$rZr`rfrrrr%�s
zMergeInput.__init__cCs|jdur|j��|_|jSr)r�rZ�decodeddata)r$rrrrY�s
zMergeInput.text)NN)rTrUrVr%rYrrrrr��s
	r��mergeFc
Cs�|st|�t|�t|�t|��|��|���}d}|dkr&t|d�}nM|dkr0t|d�}nC|dkr:t|d�}n9|dkrOt|||�}t|g|�R�\}}n$|d	krdt|||�}t|g|�R�\}}nt||�}t|g|�R�\}}d
�|�}	|	|fS)z[Performs the simplemerge algorithm.

    The merged result is written into `localctx`.
    Fsunion)rr'slocal)rsother)r's	mergediffsmerge3r�)	r_rrYr�rlr�r�r�r�)
�localr#�other�mode�allow_binaryrpr�r�rk�
mergedtextrrr�simplemerge�s,

r�)NNr|r}r~)r�F)�
__future__r�i18nr�rrr�utilsrrr�objectrr_rlrqr{r�r�r�r�r�r�rrrr�<module>s2
R	
�#@�

https://t.me/RX1948 - 2025