Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/lib64/python3.9/site-packages/mercurial/__pycache__/ |
Upload File : |
a �+�bpC � @ s� d dl mZ ddlmZ ddlmZmZmZ ddlm Z dd� Z dd � ZG d d� de�Z dd � Zdd� Zdd� Zdd� Zd&dd�Zdd� Zdd� Zdd� ZG d d!� d!e�Zd'd$d%�ZdS )(� )�absolute_import� )�_)�error�mdiff�pycompat)� stringutilc C sd | d | d ksJ �|d |d ks(J �t | d |d �}t| d |d �}||k r\||fS dS dS )a Given 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) r r N)�max�min)Zra�rbZsaZsb� r �;/usr/lib64/python3.9/site-packages/mercurial/simplemerge.py� intersect s r c C sR || || krdS t t�||�t�||��D ]\}}| | || kr. dS q.dS )z:Compare a[astart:aend] == b[bstart:bend], without slicing.FTN)�zipr Zxrange)�aZastart�aend�bZbstart�bend�ia�ibr r r � compare_range5 s �r c @ s2 e Zd ZdZddd�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.Nc C s^ || _ || _|| _|d u r$t�|�}|d u r6t�|�}|d u rHt�|�}|| _|| _|| _d S �N)�basetext�atext�btextr Z splitnewlines�baser r )�selfr r r r r r r r r �__init__H s zMerge3Text.__init__c c s� | � � D ]�}|d }|dkr:|| j|d |d � fV q|dksJ|dkrh|| j|d |d � fV q|dkr�|| j|d |d � fV q|dkr�|| j|d |d � | j|d |d � | j|d |d � ffV qt|��qd 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 r r � ValueError)r �t�whatr r r �merge_groupsV s �� zMerge3Text.merge_groupsc c s� d } }}| � � D �]�}|\}}}}} } || }|dks>J �||| ksNJ �|| | ks^J �|| }| | } || }|dks�J �| dks�J �|dks�J �|s�| �r^t| j||| j||�}t| j|| | j||�}t| j||| j|| �}|r�d||fV n^|�r|�sd|| fV nD|�r,|�s,d||fV n*|�sN|�sNd|||||| fV ntd��|}| }|}|dkr||k�sxJ �|| k�s�J �||k�s�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. r r"