ok

Mini Shell

Direktori : /opt/cloudlinux/venv/lib/python3.11/site-packages/git/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/git/__pycache__/diff.cpython-311.pyc

�

�܋f�[����ddlZddlmZddlmZddlmZmZddlm	Z	ddl
mZddlm
Z
mZmZmZmZmZmZmZmZmZmZdd	lmZmZer$dd
lmZddlmZddlm Z dd
l!m"Z"ddl#m$Z$ddl%m&Z&edZ'dZ(e)��Z*ej+d��Z,dede-fd�Z.d"de-de/dee-fd�Z0Gd�de)��Z1edd���Z2Gd�d ee2��Z3Gd!�de)��Z4dS)#�N)�handle_process_output)�defenc)�finalize_process�
hex_to_bin�)�Blob)�mode_str_to_int)�Any�Iterator�List�Match�Optional�Tuple�Type�TypeVar�Union�
TYPE_CHECKING�cast)�PathLike�Literal)�Tree)�Commit)�Repo)�IndexObject)�Popen)�Git)�A�D�C�M�R�T�U)�Diffable�	DiffIndex�Diff�	NULL_TREEs\\([0-9]{3})�matchobj�returnc��|�d��}t|d��}tt|f����}|S)Nr�)�group�int�bytes�	bytearray)r(�values  �Y/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/git/diff.py�_octal_replr2;s<���N�N�1���E���q�M�M�E��)�U�H�%�%�&�&�E��L�T�path�
has_ab_prefixc���|dkrdS|�d��ro|�d��rZ|dd��dd���dd���d	d���d
d��}t�t
|��}|r6|�d��s|�d
��sJ�|dd�}|S)Ns	/dev/null�"r���s\n�
s\t�	s\"s\\�\sa/sb/�)�
startswith�endswith�replace�_octal_byte_re�subr2)r4r5s  r1�decode_pathrBBs����|����t����t���v����t�!4�!4�v��A�b�D�z�!�!�&�%�0�0�8�8���G�G�O�O�PV�X\�]�]�e�e�fm�ot�u�u�����k�4�0�0�D������u�%�%�?�����)?�)?�?�?�?��A�B�B�x���Kr3c��eZdZdZdZGd�de��Zdeee	de
defdeee	de
deffd�Zed	d
fdee
ddd
d	e	efdeeeee
edfd	fdededdf
d�Zd	S)r$z�Common interface for all object that can be diffed against another object of compatible type.

    :note:
        Subclasses require a repo member as it is the case for Object instances, for practical
        reasons we do not derive from Object.�c��eZdZdS)�Diffable.IndexN)�__name__�
__module__�__qualname__rDr3r1�IndexrF]s�������r3rJ�argsrFr)c��|S)z�
        :return:
            possibly altered version of the given args list.
            Method is called right before git command execution.
            Subclasses can use it to alter the behaviour of the superclassrD)�selfrKs  r1�_process_diff_argszDiffable._process_diff_args`s	���r3NF�otherrr�paths.�create_patch�kwargsr%c���g}|�d��|�d��t�fd�dD����s|�d��|r|�d��n*|�d��|�d��|�d	��|�t|ttf��s|g}t|d��r|j|_|jjj}||j	ur|�
dd
��n�|tur>|�
dd��|�
dd��|jjj}n?|�=|�
dd��|�
d|��|jjj}|�
d|��|r*|�d��|�
|��d�d<||�|��i���}|rtjntj}||j|��}	|���|	S)aCreates diffs between two items being trees, trees and index or an
        index and the working tree. It will detect renames automatically.

        :param other:
            Is the item to compare us with.
            If None, we will be compared to the working tree.
            If Treeish, it will be compared against the respective tree
            If Index ( type ), it will be compared against the index.
            If git.NULL_TREE, it will compare against the empty tree.
            It defaults to Index to assure the method will not by-default fail
            on bare repositories.

        :param paths:
            is a list of paths or a single path to limit the diff to.
            It will only include at least one of the given path or paths.

        :param create_patch:
            If True, the returned Diff contains a detailed patch that if applied
            makes the self to other. Patches are somewhat costly as blobs have to be read
            and diffed.

        :param kwargs:
            Additional arguments passed to git-diff, such as
            R=True to swap both sides of the diff.

        :return: git.DiffIndex

        :note:
            On a bare repository, 'other' needs to be provided as Index or as
            as Tree/Commit, or a git command error will occurz--abbrev=40z--full-indexc3� �K�|]}|�vV��	dS�NrD)�.0�xrRs  �r1�	<genexpr>z Diffable.diff.<locals>.<genexpr>�s'�����L�L�1�1��;�L�L�L�L�L�Lr3)�find_renames�
no_renamesr z-Mz-pz--rawz-zz
--no-colorN�Has_Reporz--cachedz-rz--rootz--T�
as_process)�append�any�
isinstance�tuple�list�hasattr�repo�git�diffrJ�insertr'�	diff_tree�extendrNr&�_index_from_patch_format�_index_from_raw_format�wait)
rMrOrPrQrRrK�diff_cmd�proc�diff_method�indexs
    `     r1rez
Diffable.diffjsP���JQS�����M�"�"�"����N�#�#�#��L�L�L�L�(K�L�L�L�L�L�	��K�K������	��K�K�������K�K�� � � ��K�K�����	
���L�!�!�!���Z���t�}�%E�%E���G�E��4��$�$�	*� $�	�D�I��9�=�%���D�J����K�K��:�&�&�&�&�
�i�
�
��K�K��4� � � ��K�K��8�$�$�$��y�}�.�H�H�
�
��K�K��4� � � ��K�K��5�!�!�!��y�}�.�H����A�t�����	��K�K������K�K����� $��|���x��0�0��6�6�A�&�A�A��7C�d�d�3�3��Id����D�I�t�,�,���	�	�����r3)rGrHrI�__doc__�	__slots__�objectrJrr�strrrNrr�boolr
rerDr3r1r$r$Rs8������1�1��I�
�
�
�
�
��
�
�
����s�J��5E�0F��N�O�P��	
�e�C��T�*:�%;�V�C�D�	E�����LQ�MQ�"�	X�X��T�'�]�F�H�d�C��G�H�X��X�t�H�~�u�X�s�]�/C�T�I�J�X��	X�
�X�
�
X�X�X�X�X�Xr3r$�T_Diffr&)�boundc�2�eZdZdZdZdedeefd�ZdS)r%z�Implements an Index for diffs, allowing a list of Diffs to be queried by
    the diff properties.

    The class improves the diff handling convenience)rrrr!r r"�change_typer)c#�JK�||jvrtd|z���|D]�}|j|kr|V��|dkr|jr|V��$|dkr|jr|V��6|dkr|jr|V��H|dkr|jr|V��Z|dkr"|jr|jr|j|jkr|V���dS)a�
        :return:
            iterator yielding Diff instances that match the given change_type

        :param change_type:
            Member of DiffIndex.change_type, namely:

            * 'A' for added paths
            * 'D' for deleted paths
            * 'R' for renamed paths
            * 'M' for paths with modified data
            * 'T' for changed in the type paths
        zInvalid change type: %srrrr!r N)rx�
ValueError�new_file�deleted_file�copied_file�renamed�a_blob�b_blob)rMrx�diffidxs   r1�iter_change_typezDiffIndex.iter_change_type�s�����d�.�.�.��6��D�E�E�E��	�	�G��"�k�1�1��
�
�
�
���#�#��(8�#��
�
�
�
���#�#��(<�#��
�
�
�
���#�#��(;�#��
�
�
�
���#�#���#��
�
�
�
���#�#���#�7�>�#�g�n�`g�`n�Nn�Nn��
�
�
��	�	r3N)	rGrHrIrprx�Lit_change_typerrur�rDr3r1r%r%�sL������8�8�1�K��O����@P������r3r%c ��eZdZdZejdejejz��ZdZ	dZ
dZdddee
d	ee
d
eee
dfdeee
dfd
ee
edfdee
edfdedededee
dee
deee
dfdeedeeddf d�Zdedefd�Zdedefd�Zdefd�Zdefd�Zedeefd���Zedeefd���Zedeefd ���Zedeefd!���Zedefd"���Zedefd#���Ze d$e
d%e
d&e
dee
fd'���Z!e ddd(ed)de"fd*���Z#e$d+e
ddd,e"ddfd-���Z%e d1d0���Z&dS)2r&a�A Diff contains diff information between two Trees.

    It contains two sides a and b of the diff, members are prefixed with
    "a" and "b" respectively to inidcate that.

    Diffs keep information about the changed blob objects, the file mode, renames,
    deletions and new files.

    There are a few cases where None has to be expected as member variable value:

    ``New File``::

        a_mode is None
        a_blob is None
        a_path is None

    ``Deleted File``::

        b_mode is None
        b_blob is None
        b_path is None

    ``Working Tree Blobs``

        When comparing to working trees, the working tree blob will have a null hexsha
        as a corresponding object does not yet exist. The mode will be null as well.
        But the path will be available though.
        If it is listed in a diff the working tree version of the file must
        be different to the version in the index or tree, and hence has been modified.s
                                ^diff[ ]--git
                                    [ ](?P<a_path_fallback>"?[ab]/.+?"?)[ ](?P<b_path_fallback>"?[ab]/.+?"?)\n
                                (?:^old[ ]mode[ ](?P<old_mode>\d+)\n
                                   ^new[ ]mode[ ](?P<new_mode>\d+)(?:\n|$))?
                                (?:^similarity[ ]index[ ]\d+%\n
                                   ^rename[ ]from[ ](?P<rename_from>.*)\n
                                   ^rename[ ]to[ ](?P<rename_to>.*)(?:\n|$))?
                                (?:^new[ ]file[ ]mode[ ](?P<new_file_mode>.+)(?:\n|$))?
                                (?:^deleted[ ]file[ ]mode[ ](?P<deleted_file_mode>.+)(?:\n|$))?
                                (?:^similarity[ ]index[ ]\d+%\n
                                   ^copy[ ]from[ ].*\n
                                   ^copy[ ]to[ ](?P<copied_file_name>.*)(?:\n|$))?
                                (?:^index[ ](?P<a_blob_id>[0-9A-Fa-f]+)
                                    \.\.(?P<b_blob_id>[0-9A-Fa-f]+)[ ]?(?P<b_mode>.+)?(?:\n|$))?
                                (?:^---[ ](?P<a_path>[^\t\n\r\f\v]*)[\t\r\f\v]*(?:\n|$))?
                                (?:^\+\+\+[ ](?P<b_path>[^\t\n\r\f\v]*)[\t\r\f\v]*(?:\n|$))?
                            �(0000000000000000000000000000000000000000s)rr��a_mode�b_mode�	a_rawpath�	b_rawpathr{r|r}�raw_rename_from�
raw_rename_torerx�scorercrr�r��	a_blob_idN�	b_blob_idr�r�r{r|r}r�r�rerxr�r)c��|�t|t��sJ�|�t|t��sJ�||_||_|rt	|��nd|_|rt	|��nd|_|rZ|rX|jD]P}|j|�	td��kr*|���r|���}n�Q||�||j
krd|_n/t|t!|��|j|j���|_||�||j
krd|_n/t|t!|��|j|j���|_||_|	|_|
|_|�t|t��sJ�|�t|t��sJ�|pd|_|pd|_|
|_||_||_dS)Nr?)�moder4)r_r.r�r�r	r�r��
submodulesr4�decoder�
module_exists�module�NULL_HEX_SHArrr�a_pathr��b_pathr{r|r}r�r�rerxr�)rMrcr�r�r�r�r�r�r{r|r}r�r�rerxr��	submodules                 r1�__init__z
Diff.__init__Cs���&� �J�y�%�$@�$@� � �@�� �J�y�%�$@�$@� � �@�"���"���17�A�o�f�-�-�-�T���17�A�o�f�-�-�-�T����	�I�	�!�_�
�
�	��>�Y�%5�%5�f�i�%H�%H�H�H� �.�.�0�0�2�(�/�/�1�1���E�I�
	
�/���	�T�->� >� >��D�K�K��t�Z�	�%:�%:���SW�S^�_�_�_�D�K��/���	�T�->� >� >��D�K�K��t�Z�	�%:�%:���SW�S^�_�_�_�D�K�&��
�".���!,����&�*�_�e�*L�*L�&�&�L��$�
�=�%�(H�(H�$�$�H�.�6�$���*�2�d�����	�9D�����
�
�
r3rOc�d�|jD]'}t||��t||��krdS�(dS)NFT)rq�getattr)rMrO�names   r1�__eq__zDiff.__eq__�sE���N�	�	�D��t�T�"�"�g�e�T�&:�&:�:�:��u�u�;��tr3c��||kSrUrD)rMrOs  r1�__ne__zDiff.__ne__�s���E�M�"�"r3c�^��tt�fd��jD������S)Nc3�8�K�|]}t�|��V��dSrU)r�)rV�nrMs  �r1rXz Diff.__hash__.<locals>.<genexpr>�s-�����C�C�q�'�$��*�*�C�C�C�C�C�Cr3)�hashr`rq�rMs`r1�__hash__z
Diff.__hash__�s0����E�C�C�C�C�D�N�C�C�C�C�C�D�D�Dr3c���d}|jr||jjz}n|jr||jjz}d}d}d}t|j|jfd��D]A\}}|rd||j|jfz}nd|z}t
t|��|��}||z
}�B|dd|zzz
}|jr|d	z
}|j	r|d
z
}|j
r|d|j�d|j��z
}|j
r
|d
|j
zz
}|jr
|d|jzz
}|jrd|dz
}	|t!|jt"��r|j�t&��n|jz
}n#t($r|dz
}YnwxYw|dz
}||z}|S)Nz%s�r)�lhs�rhsz
%s: %o | %sz	
%s: None�
�=z
file deleted in rhsz
file added in rhsz
file z
 copied from z
file renamed from %rz
file renamed to %rz
---zOMITTED BINARY DATA)rr4r��zipr��hexsha�max�lenr|r{r}r�r��rename_from�	rename_torer_r.r�r�UnicodeDecodeError)rM�h�msg�line�line_length�br��ress        r1�__str__zDiff.__str__�s������;�	"�
���!�!�A�A�
�[�	"�
���!�!�A����������d�k�2�N�C�C�	�	�D�A�q��
(�&�!�Q�V�Q�X�)>�>���#�a�'���c�$�i�i��5�5�K��4�K�C�C�	
�T�C�+�%�
%�%����	+��*�*�C��=�	)��(�(�C���	K��C�����d�k�k�J�J�C���	?��+�d�.>�>�>�C��>�	;��)�D�N�:�:�C��9�	��7�N�C�
-��:�d�i��3O�3O�^�t�y�'�'��/�/�/�UY�U^�^����%�
-�
-�
-��,�,����
-����
�7�N�C�
�#�g���
s�AE�E�Ec�T�|jr |j�td��ndS�Nr?)r�r�rr�s r1r�zDiff.a_path��&��;?�>�S�t�~�$�$�V�Y�7�7�7�t�Sr3c�T�|jr |j�td��ndSr�)r�r�rr�s r1r�zDiff.b_path�r�r3c�T�|jr |j�td��ndSr�)r�r�rr�s r1r�zDiff.rename_from�s)��AE�AU�_�t�#�*�*�6�9�=�=�=�[_�_r3c�T�|jr |j�td��ndSr�)r�r�rr�s r1r�zDiff.rename_to�s)��?C�?Q�[�t�!�(�(���;�;�;�W[�[r3c��|jS)z�:returns: True if the blob of our diff has been renamed
        :note: This property is deprecated, please use ``renamed_file`` instead.
        )�renamed_filer�s r1r~zDiff.renamed�s
��
� � r3c�"�|j|jkS)z7:returns: True if the blob of our diff has been renamed)r�r�r�s r1r�zDiff.renamed_file�s����4�>�1�1r3�
path_match�rename_match�path_fallback_matchc�p�|rt|��S|rt|d���S|rt|��SdS)NF)r5)rB)�clsr�r�r�s    r1�_pick_best_pathzDiff._pick_best_path�sP���	+��z�*�*�*��	B��|�5�A�A�A�A��	4��2�3�3�3��tr3rm)rzGit.AutoInterruptc��g}t||jdtd���d�|��}t	��}d}d}d\}}	d\}
}|j�|��D�]n}|���\}
}}}}}}}}}}}}}	t|��t|��t|��}}}|�	|||
��}|�	|	||��}	|�9||�
��|����|d_|p	|p|o|p|p|}
|p|p|p|	o|
}|�t|||	|o|�t��|o|�t��|
o|
�t��|o|�t��|||||ddd����|}|}��p|r)|r'||�
��d�|d_|S)aCreate a new DiffIndex from the given text which must be in patch format
        :param repo: is the repository we are operating on - it is required
        :param stream: result of 'git diff' as a stream (supporting file protocol)
        :return: git.DiffIndexNF��decode_streamsr3)NNr8)rr]r�joinr%�	re_header�finditer�groupsrtr��end�startrer&r�r)r�rcrm�	text_list�textro�previous_header�headerr�r�r�r��_header�a_path_fallback�b_path_fallback�old_mode�new_moder�r��
new_file_mode�deleted_file_mode�copied_file_namer�r�r{r|r}s                           r1rizDiff._index_from_patch_format�s^��"$�	��d�I�$4�d�<L�]b�c�c�c�c��x�x�	�"�"��&�[�[��59��,0��#����#�����}�-�-�d�3�3�:	�:	�G� ��� � �
��������!� �������]�#�#��&�'�'��%�&�&�%0�l�H��(�(���o�N�N�F��(�(���O�L�L�F��*�!%�o�&9�&9�&;�&;�g�m�m�o�o�&M�!N��b�	��
�h�!2�h�v�7g�6�Cf�X�Cf�Yf�F��O�x�O�=�O�V�=N��F��L�L������:�)�"2�"2�6�":�":��:�)�"2�"2�6�":�":��4�v�}�}�V�4�4��4�v�}�}�V�4�4�� ���������
�
�
�(&�O��F�F��	2�V�	2�!�&�*�*�,�,�.�.�1�E�"�I�N��r3�lines_bytesroc��|�t��}|�d��\}}}|�d��D�]�}|s�|�d��\}}}|�d��}|�dd��\}}	}
}}tt|d��}
d�|dd���}|���rt|��nd}|�
��}|�t��}|�t��}d}d}d}d}d}|
d	krd}d
}n�|
dkrd}
d
}n�|
dkrPd
}|�dd��\}}|�t��}|�t��}n_|
d
krR|�dd��\}}|�t��}|�t��}||}}n|
dkr	t||||
|||	|||||d|
|��}|�
|�����dS)N�:z:��rr�rFrTrrr!r")r�r�	partition�split�rstriprr�r��isdigitr-�strip�encoder&r])r�rcro�lines�_r��metar4r�r�r�r��_change_typerx�	score_strr�r�r�r|r{r}r�r��
a_path_str�
b_path_strres                          r1�_handle_diff_linezDiff._handle_diff_line<s}���"�"�6�*�*���o�o�c�*�*���1�e��K�K��(�(�A	�A	�D��
�� �N�N�6�2�2�M�D�!�T��;�;�v�&�&�D�FJ�Z�Z�PT�VW�EX�EX�B�H�h�	�9�l�
,0���a��+Q�+Q�K�����Q�R�R� 0�1�1�I�&/�&7�&7�&9�&9�C�C�	�N�N�N�t�E��:�:�<�<�D��[�[��(�(�F��[�[��(�(�F� �L��H��K��K��I��c�!�!� �	�#�����#�#� �	������#�#�"��)-���F�A�)>�)>�&�
�J�#�*�*�6�2�2��#�*�*�6�2�2�����#�#�)-���F�A�)>�)>�&�
�J�#�*�*�6�2�2��#�*�*�6�2�2��)/��Y�����#�#��������������������D�"
�L�L������CA	�A	r3rr%c�d����t���t|���fd�dtd����S)zhCreate a new DiffIndex from the given stream which must be in raw format.
        :return: git.DiffIndexc�2����|����SrU)r�)�bytr�rorcs ���r1�<lambda>z-Diff._index_from_raw_format.<locals>.<lambda>�s����-�-�c�4��?�?�r3NFr�)r%rr)r�rcrmros`` @r1rjzDiff._index_from_raw_format�sL�����'�[�[����?�?�?�?�?�?��� �	
�	
�	
�	
��r3)rcrrmrr)r%)'rGrHrIrp�re�compile�VERBOSE�	MULTILINEr�r��NULL_BIN_SHArqrr.rrsrtr�r-r�rrr�r�r�r��propertyr�r�r�r�r~r��classmethodr�r%ri�staticmethodr�rjrDr3r1r&r&�s�������Z�Z�>��
�	 �$	�
�R�\�!�'��I�,�L��L��I�"<��<��E�?�<��E�?�	<�
��e�T�)�*�<���e�T�)�*�
<��e�S�$�&�'�<��e�S�$�&�'�<��<��<��<�"�%��<� ���<��C���$�%�<��o�.�<� ��}�!<�"
�#<�<�<�<�|�F��t�����#�F�#�t�#�#�#�#�E�#�E�E�E�E�/��/�/�/�/�b�T���
�T�T�T��X�T��T���
�T�T�T��X�T��`�X�c�]�`�`�`��X�`��\�8�C�=�\�\�\��X�\��!��!�!�!��X�!��2�d�2�2�2��X�2��
��
�e�
�Z_�
�dl�mr�ds�
�
�
��[�
��Q�F�Q�%�@\�:]�Q�bk�Q�Q�Q��[�Q�f�G�u�G�F�G�9�G�QU�G�G�G��\�G�R�����[���r3)T)5r��git.cmdr�
git.compatr�git.utilrr�objects.blobr�objects.utilr	�typingr
rrr
rrrrrrr�	git.typesrr�objects.treer�objectsr�
git.repo.baser�git.objects.baser�
subprocessrrdrr��__all__rrr'r�r@r.r2rtrBr$rur%r&rDr3r1�<module>r
s���
�	�	�	�)�)�)�)�)�)�������1�1�1�1�1�1�1�1�������)�)�)�)�)�)�
��������������������������(�'�'�'�'�'�'�'���"�"�"�"�"�"�������"�"�"�"�"�"�,�,�,�,�,�,� � � � � � ��������;�<��9��
�F�H�H�	����-�.�.���%��E�����
�
�e�
�D�
�H�U�O�
�
�
�
� p�p�p�p�p�v�p�p�p�f
����	(�	(�	(��,�,�,�,�,��V��,�,�,�`^�^�^�^�^�6�^�^�^�^�^r3

Zerion Mini Shell 1.0