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__/cmd.cpython-311.pyc

�

�܋f����2�ddlmZddlZddlmZddlZddlZddlZddlZddl	m
Z
mZmZm
Z
ddl	Z	ddlZddlmZddlmZmZmZmZmZddlmZddlmZmZmZmZd	d
lmZm Z m!Z!m"Z"d	dl#m$Z$m%Z%ddl&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6dd
l7m8Z8m9Z9m:Z:e1rddl;m<Z<ddl=m>Z>hd�Z?ej@eA��ZBeB�CejD����dZE			d3d4d!�ZFd5d$�ZGd6d7d+�ZHd6d8d/�ZId0ZJer
eJe	jKzndZLGd1�d2e$��ZMdS)9�)�annotationsN)�contextmanager)�call�Popen�PIPE�DEVNULL)�dedent)�defenc�force_bytes�safe_decode�is_posix�is_win)�CommandError)�
is_cygwin_git�cygpath�expand_path�remove_password_if_present�)�GitCommandError�GitCommandNotFound�UnsafeOptionError�UnsafeProtocolError)�	LazyMixin�stream_copy)�Any�AnyStr�BinaryIO�Callable�Dict�IO�Iterator�List�Mapping�Sequence�
TYPE_CHECKING�TextIO�Tuple�Union�cast�overload)�PathLike�Literal�TBD)�Repo)�	DiffIndex>
�env�shell�istream�
as_process�with_stdout�
output_stream�max_chunk_size�with_exceptions�stdout_as_string�kill_after_timeout�universal_newlines�with_extended_output�strip_newline_in_stdout)�GitT�process�'Git.AutoInterrupt' | Popen�stdout_handler�sUnion[None, Callable[[AnyStr], None], Callable[[List[AnyStr]], None], Callable[[bytes, 'Repo', 'DiffIndex'], None]]�stderr_handler�EUnion[None, Callable[[AnyStr], None], Callable[[List[AnyStr]], None]]�	finalizer�KUnion[None, Callable[[Union[subprocess.Popen, 'Git.AutoInterrupt']], None]]�decode_streams�boolr9�Union[None, float]�return�Nonec	�R�dd
�}t|d��rQtd|��}t|jdd��}|jr|jjnd}|jr|jjnd}	n4tt|��}t|dd��}|j}|j}	t|ttf��s|�
��}g}
|r|
�d||f��|	r|
�d|	|f��g}|
D]Q\}}
}tj
||||
||f���}d|_|���|�|���R|D]�}|�|���|���r�t|t$j��r|���nt+d|�d����|rQd|�d�}|s>t|	t,��r)tt.|��}|���}||����|r||��SdS)a�Registers for notifications to learn that process output is ready to read, and dispatches lines to
    the respective line handlers.
    This function returns once the finalizer returns

    :return: result of finalizer
    :param process: subprocess.Popen instance
    :param stdout_handler: f(stdout_line_string), or None
    :param stderr_handler: f(stderr_line_string), or None
    :param finalizer: f(proc) - wait for proc to finish
    :param decode_streams:
        Assume stdout/stderr streams are binary and decode them before pushing         their contents to handlers.
        Set it to False if `universal_newline == True` (then streams are in text-mode)
        or if decoding must happen later (i.e. for Diffs).
    :param kill_after_timeout:
        float or None, Default = None
        To specify a timeout in seconds for the git command, after which the process
        should be killed.
    �cmdline�	List[str]�name�str�stream�Union[BinaryIO, TextIO]�	is_decoderG�handler�0Union[None, Callable[[Union[bytes, str]], None]]rIrJc	��	|D]N}|rJ|r=t|t��sJ�|�t��}||���C||���On~#t$rq}t
�d|�dt|���d|����dt|��vr&td|�d�gt|��z|��|�Yd}~nd}~wwxYw|�
��dS#|�
��wxYw)NzPumping z of cmd(z) failed due to: zI/O operation on closed file�<z-pump>)�
isinstance�bytes�decoder
�	Exception�log�errorrrOr�close)rLrNrPrRrS�line�line_str�exs        �X/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/git/cmd.py�pump_streamz*handle_process_output.<locals>.pump_stream~sF��	��
&�
&���&� �&�)�$��6�6�6�6�6�#'�;�;�v�#6�#6�����)�)�)�)����
�
�
��
&���	i�	i�	i��I�I�m��m�m�1K�G�1T�1T�m�m�gi�m�m�n�n�n�-�S��W�W�<�<�"�$4��$4�$4�$4�#5�8R�SZ�8[�8[�#[�]_�`�`�fh�h�=�<�<�<�<�����	i����
�L�L�N�N�N�N�N��F�L�L�N�N�N�N���s1�AA�C(�
C�A'C
�C(�
C�C(�(C>�proc�Git.AutoInterrupt�args�N�stdout�stderr)�targetreT)�timeoutzKThread join() timed out in cmd.handle_process_output(). kill_after_timeout=z secondsz?error: process killed because it timed out. kill_after_timeout=)rLrMrNrOrPrQrRrGrSrTrIrJ)�hasattrr)�getattrrcrgrhrrW�tuple�list�split�append�	threading�Thread�daemon�start�join�is_aliver=�
AutoInterrupt�
_terminate�RuntimeErrorrrO�encode)r>r@rBrDrFr9rbrL�p_stdout�p_stderr�pumps�threadsrNrPrS�t�	error_strs                 ra�handle_process_outputr�]s���B����2�w����	"��*�G�4�4��5<�W�\�6�SU�5V�5V��*1�,�@�7�<�&�&�D��*1�,�@�7�<�&�&�D����u�g�&�&���'�6�2�.�.���>���>���g��t�}�-�-�"��-�-�/�/��>@�E��;�
���h��.�9�:�:�:��;�
���h��.�9�:�:�:�&(�G�!&�����f�g���K�w��f�n�^e�6f�g�g�g�����	���	�	�	����q������*�*��	���)��*�*�*��:�:�<�<�	*��'�3�#4�5�5�
��"�"�$�$�$�$�"�H�+=�H�H�H�����

*�u�Yk�u�u�u��&�3�*�X�x�*H�*H�3� $�S�)� 4� 4�I� )� 0� 0� 2� 2�I���y�)�)�)�����y��!�!�!��t��stringrOc�.�|�dd��S)N�_�-)�replace)r�s ra�dashifyr��s���>�>�#�s�#�#�#r���self�object�exclude�
Sequence[str]�Dict[str, Any]c�.�����fd��jD��S)Nc�:��i|]}|�v�|t�|����Sr�)rl)�.0�sr�r�s  ��ra�
<dictcomp>z!slots_to_dict.<locals>.<dictcomp>�s/���L�L�L�A�1�G�;K�;K�A�w�t�Q���;K�;K�;Kr�)�	__slots__)r�r�s``ra�
slots_to_dictr��s#����L�L�L�L�L���L�L�L�Lr��d�Mapping[str, Any]�excludedc��|���D]\}}t|||���|D]}t||d���dS�N)�items�setattr)r�r�r��k�vs     ra�$dict_to_slots_and__excluded_are_noner��s`�����	�	�����1���a������
������a�������r�ic
���eZdZdZdZdZejd��Zd�d�Z	d�d
�Z
dZej
�dd
��Zd
ZdZdZdZed�d�d���Zed�d���Zeed�d�d�����Zeed�d�d�����Zed�d�d���Zed�d ���Zed�d$���ZGd%�d&e��ZGd'�d(e��Zd�d��fd*�
Zd�d-�Zd�d/�Z d��fd1�Z!e"d�d2���Z#e"d�d4���Z$ed�d:���Z%ed
d;�d�d>���Z%ed
d
d?�d�dA���Z%ed�dC���Z%ed�dE���Z%dd
dFd
ddFddFd
dde&j'dFf
d�dW�Z%d�dY�Z(d�d[�Z)e*d�d]���Z+d�d`�Z,d�d�da�Z-ed�dd���Z.d�df�Z/ed�di���Z0ed�dk���Z0ed�dm���Z0d�dn�Z0d�dq�Z1d�dt�Z2d�dw�Z3d�dy�Z4d�dz�Z5d�d|�Z6d�d~�Z7d�d�Z8�xZ9S)�r=a�
    The Git class manages communication with the Git binary.

    It provides a convenient interface to calling the Git binary, such as in::

     g = Git( git_dir )
     g.init()                   # calls 'git init' program
     rval = g.ls_files()        # calls 'git ls-files' program

    ``Debugging``
        Set the GIT_PYTHON_TRACE environment variable print each invocation
        of the command to stdout.
        Set its value to 'full' to see details about the returned values.
    )�_working_dir�cat_file_all�cat_file_header�
_version_info�_git_options�_persistent_git_options�_environment)r�r�r�z(.+)::.+rIr�c�.�t||j���S)N)r�)r��
_excluded_�r�s ra�__getstate__zGit.__getstate__s���T�4�?�;�;�;�;r�r�rJc�4�t|||j���dS)N)r�)r�r�)r�r�s  ra�__setstate__zGit.__setstate__s��,�T�1�t��O�O�O�O�O�Or��git�GIT_PYTHON_TRACEF�GIT_PYTHON_GIT_EXECUTABLE�GIT_PYTHON_REFRESHN�path�Union[None, PathLike]rGc	�b�|�?tj�|��}tj�|��}n*tj�|j|j��}|j}||_d}	|���	��d}n#ttf$rYnwxYw|�sytd��|jz}||_|��Htj�|j
d�����}gd�}gd�}gd�}	||vrn�||vs||	vr�td	��||j
d
�|��d
�|��d
�|	��|j
|dfz}||vrt!d|z��nrt#|���td
��|j
d
�|��d
�|��d
�|	��fz}t#|���|j|_ntd|���|S)zWThis gets called by the refresh function (see the top level
        __init__).
        NFTa                Bad git executable.
                The git executable must be specified in one of the following ways:
                    - be included in your $PATH
                    - be set via $%s
                    - explicitly set via git.refresh()
                �raise)�quiet�q�silencer��none�n�0)�warn�w�warning�1)r\�er��r�2a6                        %s
                        All git commands will error until this is rectified.

                        This initial warning can be silenced or aggravated in the future by setting the
                        $%s environment variable. Use one of the following values:
                            - %s: for no warning or exception
                            - %s: for a printed warning
                            - %s: for a raised exception

                        Example:
                            export %s=%s
                        �|rzWARNING: %sag                        %s environment variable has been set but it has been set with an invalid value.

                        Use only the following values:
                            - %s: for no warning or exception
                            - %s: for a printed warning
                            - %s: for a raised exception
                        r�)�osr��
expanduser�abspath�environ�get�_git_exec_env_var�
git_exec_namer��versionr�PermissionErrorr	�_refresh_env_var�lowerru�print�ImportError)
�clsr��new_git�old_git�has_git�err�moder�r�r\s
          ra�refreshzGit.refresh&sf�����g�(�(��.�.�G��g�o�o�g�.�.�G�G��j�n�n�S�%:�C�<M�N�N�G��/��(/��%���	��C�E�E�M�M�O�O�O��G�G��"�O�4�	�	�	��D�	�����b	5������'�	(�
�-4�C�)����z�~�~�c�&:�G�D�D�J�J�L�L��H�H�H��4�4�4��9�9�9���5�=�=���T�\�\�T�U�]�]�����  ��0��H�H�U�O�O��H�H�T�N�N��H�H�U�O�O��0�!�!�H����6�t�|�|��m�c�1�2�2�2�2�)�#�.�.�.���	�	� �0��H�H�U�O�O��H�H�T�N�N��H�H�U�O�O�	���$&�c�*�*�*�14�0A��-�-�)���4�4�4��s�=B�B0�/B0c�*�t|j��Sr�)rr�)r�s ra�	is_cygwinz
Git.is_cygwin�s���S�:�;�;�;r�.�urlrOr��Literal[False]c��dSr�r��r�r�r�s   ra�
polish_urlzGit.polish_url��	��	�r��Union[None, bool]c��dSr�r�r�s   rar�zGit.polish_url�r�r�r+c�R�|�|���}|rt|��}n~	tj�|��}|�d��rtj�|��}|�dd���dd��}|S)N�~z\\�\�/)r�rr�r��
expandvars�
startswithr�r�r�s   rar�zGit.polish_url�s������
�
���I��	?��#�,�,�C�C�
��'�$�$�S�)�)�C��~�~�c�"�"�
.��g�(�(��-�-���+�+�f�d�+�+�3�3�D�#�>�>�C��
r�c��|j�|��}|r(|�d��}td|�d����dS)a�
        Check for unsafe protocols.

        Apart from the usual protocols (http, git, ssh),
        Git allows "remote helpers" that have the form `<transport>::<address>`,
        one of these helpers (`ext::`) can be used to invoke any arbitrary command.

        See:

        - https://git-scm.com/docs/gitremote-helpers
        - https://git-scm.com/docs/git-remote-ext
        rzThe `zM::` protocol looks suspicious, use `allow_unsafe_protocols=True` to allow it.N)�re_unsafe_protocol�match�groupr)r�r�r��protocols    ra�check_unsafe_protocolszGit.check_unsafe_protocols�s[���&�,�,�S�1�1���	��{�{�1�~�~�H�%�o��o�o�o���
�	�	r��optionsrM�unsafe_optionsc��d�|D��}|D]E}t||��D]2\}}|�|��s||krt|�d�����3�FdS)z�
        Check for unsafe options.

        Some options that are passed to `git <command>` can be used to execute
        arbitrary commands, this are blocked by default.
        c�8�g|]}|�d����S)r�)�lstrip)r��options  ra�
<listcomp>z,Git.check_unsafe_options.<locals>.<listcomp>�s4��
�
�
��
�M�M�#���
�
�
r�z= is not allowed, use `allow_unsafe_options=True` to allow it.N)�zipr�r)r�r�r��bare_unsafe_optionsr��
unsafe_option�bare_options       ra�check_unsafe_optionszGit.check_unsafe_options�s���
�
�(�
�
�
���	�	�F�.1�.�BU�.V�.V�
�
�*�
�{��$�$�]�3�3��v��7L�7L�+�(�g�g�g����8M�
�	�	r�c�P�eZdZUdZdZdZded<dd�Zdd
�Zdd�Z	dd�Z
ddd�ZdS)rdabKill/Interrupt the stored process instance once this instance goes out of scope. It is
        used to prevent processes piling up in case iterators stop reading.
        Besides all attributes are wired through to the contained process object.

        The wait method was overridden to perform automatic status code checking
        and possibly raise.�rcre�statusr�int�_status_code_if_terminaterc�Union[None, subprocess.Popen]rerrIrJc�0�||_||_d|_dSr�r�)r�rcres   ra�__init__zGit.AutoInterrupt.__init__s���D�I��D�I�,0�D�K�K�Kr�c�R�|j�dS|j}d|_|jr|j���|jr|j���|jr|j���	|����"|jp|���|_dSn2#t$r%}t�
d|��Yd}~nd}~wwxYwt�ttdd���dS	|�
��|���}|jp||_dS#t$r&}t�
d|��Yd}~dSd}~wt$r4t r)t#dt%|j��zd���YdSYdSwxYw)z Terminate the underlying processNz(Ignored error after process had died: %r�killz"TASKKILL /F /T /PID %s 2>nul 1>nulT)r1)rc�stdinr]rgrh�pollr�r��OSErrorr[�infor�rl�	terminate�wait�AttributeErrorrrrO�pid)r�rcr`r�s    rarxzGit.AutoInterrupt._terminate	s����y� ����9�D��D�I��z�
#��
� � �"�"�"��{�
$���!�!�#�#�#��{�
$���!�!�#�#�#�
I��9�9�;�;�*�"&�"@�"O�D�I�I�K�K�D�K��4�+���
I�
I�
I����C�R�H�H�H�H�H�H�H�H�����
I�����z�W�R���6�6�>��t�
���� � � �������"�<�F��������
I�
I�
I����C�R�H�H�H�H�H�H�H�H�H�����!�	
�	
�	
�
���=��D�H�
�
�M�"�����������	
���s6�94B0�0
C�:C�C�6D:�:
F&�E%�%:F&�%F&c�.�|���dSr�)rxr�s ra�__del__zGit.AutoInterrupt.__del__6s���O�O�����r��attrrOc�,�t|j|��Sr�)rlrc)r�rs  ra�__getattr__zGit.AutoInterrupt.__getattr__9s���4�9�d�+�+�+r�r�rh�Union[None, str, bytes]c�L��|�d�t|d����|j�&|j���}|jj}n	|j}d}d�fd	�}|d
krK||��}t
�d|����tt|j	��||���|S)
a/Wait for the process and return its status code.

            :param stderr: Previously read value of stderr, in case stderr is already closed.
            :warn: may deadlock if output or error pipes are used and not handled separately.
            :raise GitCommandError: if the return status is not 0Nr�zutf-8)�data�encodingrP�Union[IO[bytes], None]rIrXc���|r@	�t|�����zS#ttf$r�pdcYSwxYw�pdS)Nr�)r�readr�
ValueError)rP�stderr_bs �ra�$read_all_from_possibly_closed_streamzDGit.AutoInterrupt.wait.<locals>.read_all_from_possibly_closed_streamNsg����+�/�'�+�f�k�k�m�m�*D�*D�D�D��#�Z�0�/�/�/�'��3�.�.�.�/����$�?�s�*s�#)�A�ArzAutoInterrupt wait stderr: )rPrrIrX)
rrcr	rhr�r[�debugrrre)r�rhr�r|r�errstrrs      @rar	zGit.AutoInterrupt.wait=s�����~���"���A�A�A�H��y�$�����)�)���9�+��������
+�
+�
+�
+�
+�
+���{�{�=�=�h�G�G���	�	�	�V�V�E�F�F�F�%�&@���&K�&K�V�U[�\�\�\��Mr�N)rcr�rerrIrJ�rIrJ)rrOrIr)r�)rhrrIr�)�__name__�
__module__�__qualname__�__doc__r�r��__annotations__rrxr
rr	r�r�rarwzGit.AutoInterrupt�s��������	�	�/�	�*+�!�*�*�*�*�	1�	1�	1�	1�
*	�*	�*	�*	�Z	�	�	�	�	,�	,�	,�	,� 	� 	� 	� 	� 	� 	� 	r�rwc�d�eZdZUdZdZded<dd�Zddd�Zddd�Zddd�Z	dd�Z
dd�ZeZdd�Z
dS)�Git.CatFileContentStreamasObject representing a sized read-only stream returning the contents of
        an object.
        It behaves like a stream, but counts the data read and simulates an empty
        stream once our sized content region is empty.
        If not all data is read to the end of the objects's lifetime, we read the
        rest to assure the underlying stream continues to work)�_stream�_nbr�_sizezTuple[str, ...]r��sizer�rP�	IO[bytes]rIrJc�j�||_||_d|_|dkr|�d��dSdS)Nrr)r%r'r&r)r�r(rPs   rarz!Git.CatFileContentStream.__init__ls<��!�D�L��D�J��D�I��q�y�y����A�������yr����rXc�.�|j|jz
}|dkrdS|dkrt||��}n|}|j�|��}|xjt|��z
c_|j|jz
dkr|j�d��|S)Nrr�r+r)r'r&�minr%r�len�r�r(�
bytes_leftrs    rarzGit.CatFileContentStream.readws�����d�i�/�J��Q����s��b�y�y��:�t�,�,���"���<�$�$�T�*�*�D��I�I��T���"�I�I��z�D�I�%��*�*���!�!�!�$�$�$��Kr�c�B�|j|jkrdS|j|jz
}|dkrt||��}n|}|j�|��}|xjt|��z
c_|j|jz
dkr|j�d��|S)Nr�r+rr)r&r'r-r%�readliner.rr/s    rar2z!Git.CatFileContentStream.readline�s����y�D�J�&�&��s���d�i�/�J��b�y�y��:�t�,�,���!���<�(�(��.�.�D��I�I��T���"�I�I��z�D�I�%��*�*���!�!�!�$�$�$��Kr��List[bytes]c���|j|jkrgSg}d}	|���}|sn5|�|��|dkr|t	|��z
}||krn�L|S)NrTr+)r&r'r2rpr.)r�r(�out�nbrr^s     ra�	readlinesz"Git.CatFileContentStream.readlines�s����y�D�J�&�&��	��C��C�
��}�}��������
�
�4� � � ��"�9�9��3�t�9�9�$�C��T�z�z��
��Jr��'Git.CatFileContentStream'c��|Sr�r�r�s ra�__iter__z!Git.CatFileContentStream.__iter__�s���Kr�c�@�|���}|st�|Sr�)r2�
StopIteration)r�r^s  ra�__next__z!Git.CatFileContentStream.__next__�s"���=�=�?�?�D��
$�#�#��Kr�c�f�|j|jz
}|r|j�|dz��dSdS)Nr)r'r&r%r)r�r0s  rar
z Git.CatFileContentStream.__del__�sD����d�i�/�J��
2���!�!�*�q�.�1�1�1�1�1�
2�
2r�N)r(r�rPr)rIrJ)r+)r(r�rIrX)r(r�rIr3)rIr8)rIrXr)rrr r!r�r"rrr2r7r:r=�nextr
r�r�ra�CatFileContentStreamr$as��������	B�	B�&B�	�A�A�A�A�	�	�	�	�	�	�	�	�	�(	�	�	�	�	�,	�	�	�	�	�*	�	�	�	�	�	�	�	���	2�	2�	2�	2�	2�	2r�r@�working_dirc����tt|�����t|��|_d|_g|_i|_d|_d|_	dS)aDInitialize this instance with:

        :param working_dir:
           Git directory we should work in. If None, we always work in the current
           directory as returned by os.getcwd().
           It is meant to be the working tree directory if available, or the
           .git directory in case of bare repositories.r�N)
�superr=rrr�r�r�r�r�r�)r�rA�	__class__s  �rarzGit.__init__�sc���	�c�4���!�!�#�#�#�'��4�4���?A���24��$�-/���26���.2����r�rNrc�T����ddkrtj����S��fd�S)z�A convenience method as it allows to call the command as if it was
        an object.

        :return: Callable object that will execute call _call_process with your arguments.rr�c�&���j�g|�Ri|��Sr�)�
_call_process)re�kwargsrNr�s  ��ra�<lambda>z!Git.__getattr__.<locals>.<lambda>�s%���'9�t�'9�$�'P��'P�'P�'P��'P�'P�r�)rr)r�rNs``rarzGit.__getattr__�s8����
��7�c�>�>��(��t�4�4�4�P�P�P�P�P�Pr�rHc�.�|jdddi|��|_dS)a<Specify command line options to the git executable
        for subsequent subcommand calls

        :param kwargs:
            is a dict of keyword arguments.
            these arguments are passed as in _call_process
            but will be passed to the git command rather than
            the subcommand.
        �split_single_char_optionsTNr�)�transform_kwargsr��r�rHs  ra�set_persistent_git_optionszGit.set_persistent_git_options�s,��(=�t�'<�'f�'f�W[�'f�_e�'f�'f��$�$�$r�rc	���|dkr�|�d��}|�d��d}ttttttftd�|�d��dd�D������|_dStt|���	|��dS)Nr�r�� �c3�\K�|]'}|����t|��V��(dSr�)�isdigitr�)r�r�s  ra�	<genexpr>z"Git._set_cache_.<locals>.<genexpr>�s5����T�T���	�	���T�c�!�f�f�T�T�T�T�T�Tr��.�)
rGror)r'r�rmr�rCr=�_set_cache_)r�r�process_version�version_numbersrDs    �rarWzGit._set_cache_�s�����?�"�"�"�0�0��;�;�O�-�3�3�C�8�8��;�O�!%��c�3��S�(�)��T�T�o�&;�&;�C�&@�&@��!��&D�T�T�T�T�T�"�"�D����

�#�t���(�(��.�.�.�.�.r�c��|jS)z(:return: Git directory we are working on)r�r�s rarAzGit.working_dirs
��� � r��Tuple[int, int, int, int]c��|jS)z�
        :return: tuple(int, int, int, int) tuple with integers representing the major, minor
            and additional version numbers as parsed from git version.
            This value is generated on demand and is cached)r�r�s ra�version_infozGit.version_infos
���!�!r��command�Union[str, Sequence[Any]]r3�
Literal[True]�'AutoInterrupt'c��dSr�r�)r�r^r3s   ra�executezGit.execute����r�)r3r8� Union[str, Tuple[int, str, str]]c��dSr�r��r�r^r3r8s    rarczGit.execute�	��	�r�)r3r8�$Union[bytes, Tuple[int, bytes, str]]c��dSr�r�rgs    rarczGit.executerhr�r;c��dSr�r��r�r^r;r3r8s     rarczGit.execute'�	��	�r�rXc��dSr�r�rls     rarczGit.execute2rmr�Tr2�Union[None, BinaryIO]r7r5r9rHr4r:r1r0�Union[None, Mapping[str, str]]r6r�r<�subprocess_kwargs�DUnion[str, bytes, Tuple[int, Union[str, bytes], str], AutoInterrupt]c�
�� �t|��}|jr:|jdks|r-t�d�|����	|jpt
j��}t
jt|��tj
��sd}n#t$rd}YnwxYw|}tj�
��}d|d<d|d<|�|j��|�|�|��t rt"}|�t%|d���nt}|	rt&n/t)t*dd��pt-tjd	��}d
}|rd}t�d|||
||��	t3|f||d
|pt4t&||dur|p|jt8|
t:d�
|��}t=t>|j ��|_ t=t>|j!��|_!n#|$r}tE||��|�d}~wwxYw|r|�#||��Sd � fd�}|�0tIj%��� tIj&|||j'f���}d}d}d}|
rdnd}	���|�|�(��|�)��\}}|�^|�*��� �+��r6dd�|��|fz}|
s|�,tZ��}|�.|��r|r
|dd
�}|�.|��r
|dd
�}|j/}n�|
r|
dkr|
nt`j1}
te|j �|
��|j �3��}|j!�3��}|�.|��r
|dd
�}|�4��}|j �5��|j!�5��n7#|j �5��|j!�5��wxYw|jdkr�d�|��}d!�fd�}|r5t�d||||��tm|����nE|r't�d||||����nt�d||��|r|dkrt%||||���to|tp��r|rtm|��}|r||tm|��fS|S)"a�Handles executing the command on the shell and consumes and returns
        the returned information (stdout)

        :param command:
            The command argument list to execute.
            It should be a string, or a sequence of program arguments. The
            program to execute is the first item in the args sequence or string.

        :param istream:
            Standard input filehandle passed to subprocess.Popen.

        :param with_extended_output:
            Whether to return a (status, stdout, stderr) tuple.

        :param with_exceptions:
            Whether to raise an exception when git returns a non-zero status.

        :param as_process:
            Whether to return the created process instance directly from which
            streams can be read on demand. This will render with_extended_output and
            with_exceptions ineffective - the caller will have
            to deal with the details himself.
            It is important to note that the process will be placed into an AutoInterrupt
            wrapper that will interrupt the process once it goes out of scope. If you
            use the command in iterators, you should pass the whole process instance
            instead of a single stream.

        :param output_stream:
            If set to a file-like object, data produced by the git command will be
            output to the given stream directly.
            This feature only has any effect if as_process is False. Processes will
            always be created with a pipe due to issues with subprocess.
            This merely is a workaround as data will be copied from the
            output pipe to the given output stream directly.
            Judging from the implementation, you shouldn't use this flag !

        :param stdout_as_string:
            if False, the commands standard output will be bytes. Otherwise, it will be
            decoded into a string using the default encoding (usually utf-8).
            The latter can fail, if the output contains binary data.

        :param env:
            A dictionary of environment variables to be passed to `subprocess.Popen`.

        :param max_chunk_size:
            Maximum number of bytes in one chunk of data passed to the output_stream in
            one invocation of write() method. If the given number is not positive then
            the default value is used.

        :param subprocess_kwargs:
            Keyword arguments to be passed to subprocess.Popen. Please note that
            some of the valid kwargs are already set by this method, the ones you
            specify may not be the same ones.

        :param with_stdout: If True, default True, we open stdout on the created process
        :param universal_newlines:
            if True, pipes will be opened as text, and lines are split at
            all known line endings.
        :param shell:
            Whether to invoke commands through a shell (see `Popen(..., shell=True)`).
            It overrides :attr:`USE_SHELL` if it is not `None`.
        :param kill_after_timeout:
            To specify a timeout in seconds for the git command, after which the process
            should be killed. This will have no effect if as_process is set to True. It is
            set to None by default and will let the process run until the timeout is
            explicitly specified. This feature is not supported on Windows. It's also worth
            noting that kill_after_timeout uses SIGKILL, which can have negative side
            effects on a repository. For example, stale locks in case of git gc could
            render the repository incapable of accepting changes until the lock is manually
            removed.
        :param strip_newline_in_stdout:
            Whether to strip the trailing ``\n`` of the command stdout.
        :return:
            * str(output) if extended_output = False (Default)
            * tuple(int(status), str(stdout), str(stderr)) if extended_output = True

            if output_stream is True, the stdout value will be your output stream:
            * output_stream if extended_output = False
            * tuple(int(status), output_stream, str(stderr)) if extended_output = True

            Note git is executed with LC_MESSAGES="C" to ensure consistent
            output regardless of system language.

        :raise GitCommandError:

        :note:
           If you add additional keyword arguments to the signature of this method,
           you must update the execute_kwargs tuple housed in this module.�fullrPN�C�LANGUAGE�LC_ALLz9"kill_after_timeout" feature is not supported on Windows.r�wbrJz<valid stream>z>Popen(%s, cwd=%s, universal_newlines=%s, shell=%s, istream=%s)r+)
r0�cwd�bufsizerrhrgr1�	close_fdsr:�
creationflagsrr�rIc�|��tddt|��gtt���}g}|j�|jD]w}t|�����dkrP|���d}|���r"|�t|�����x	ttdtj��}tj||��|D](}	tj||���#t$rY�%wxYw����n#t$rYnwxYwdS)z"Callback method to kill a process.�psz--ppid)rgr|Nr�SIGKILL)rrOr�PROC_CREATIONFLAGSrgr.rorSrpr�rl�signal�SIGTERMr�rr�set)r�p�
child_pidsr^�	local_pid�sig�	child_pid�
kill_checks       �ra�
_kill_processz"Git.execute.<locals>._kill_process�sX�����x��S���*��0����A�
�J��x�#��H�>�>�D��4�:�:�<�<�(�(�1�,�,�%)�Z�Z�\�\�1�$5�	�$�,�,�.�.�>�&�-�-�c�)�n�n�=�=�=��

��f�i���@�@�����S�!�!�!�!+���I����	�3�/�/�/�/��"������������� � � � ���
�
�
���
����
�Fs6�79D,�1D�D,�
D�D,�D�D,�,
D9�8D9)rerr��
�
z6Timeout: the command "%s" did not complete in %d secs.�stdout_value�Union[bytes, str]rOc�,���rt|��pdS)Nz<OUTPUT_STREAM>)r)r�r5s �ra�as_textzGit.execute.<locals>.as_textAs���(�(�F�[��-F�-F�[�J[�[r�z$%s -> %d; stdout: '%s'; stderr: '%s'z%s -> %d; stdout: '%s'z%s -> %d)rr�rIrJ)r�r�rIrO)9rr�r[rrur�r��getcwd�accessrO�X_OK�FileNotFoundErrorr��copy�updater�rrrrrl�
subprocess�open�devnullrrr�	USE_SHELLr
r�r)rrgrhrrwrq�Event�Timerrrt�communicate�cancel�is_setrzr
�endswith�
returncode�io�DEFAULT_BUFFER_SIZErrr	r]rrWrX)!r�r^r2r;r7r3r5r8r9r4r:r1r0r6r<rq�redacted_commandry�
inline_env�cmd_not_found_exception�stdout_sink�
istream_okrcr�r��watchdogr�r��stderr_value�newline�cmdstrr�r�s!      `                         @rarczGit.execute=s#����V6�g�>�>��� �	1�d�&;�v�&E�&E��&E��H�H�S�X�X�.�/�/�0�0�0�	��#�2�r�y�{�{�C��9�S��X�X�r�w�/�/�
����� �	�	�	��C�C�C�	�����
��j�o�o����
��J����H�
��
�
�4�$�%�%�%��!��J�J�z�"�"�"��	8�&-�#�!�-�%�$�O����.�'8�#�*�m�d�d�w�z�9�d�/S�/S�/m�W[�\^�\f�hl�Wm�Wm���
��	*�)�J��	�	�L������
	
�	
�	
�	6���
�����(���"��4�'�1�E�C�T�^�"�#5�0�
�
�$�
�
�D�&�x���5�5�D�K��x���5�5�D�K�K��'�	E�	E�	E�$�%5�s�;�;��D�����	E�����	5��%�%�d�G�4�4�4�	�	�	�	�	�	�@�)�"��*�*�J� ��'9�=�PT�PX�{�[�[�[�H���*-��*-��,�7�$�$�%��!	 ��$�%�1��N�N�$�$�$�-1�-=�-=�-?�-?�*��l�%�1��O�O�%�%�%�!�(�(�*�*�G�'b��H�H�%5�6�6�.�f�(�� 2�G�+7�+>�+>�v�+F�+F�L��(�(��1�1�5�6M�5�#/����#4�L��(�(��1�1�5�#/����#4�L�����3A�!t�n�WX�FX�FX���^`�^t���D�K���G�G�G�#�{�/�/�1�1��#�{�/�/�1�1���(�(��1�1�5�#/����#4�L�������
�K�������K��������
�K�������K����������� �F�*�*��X�X�.�/�/�F�
\�
\�
\�
\�
\�
\�
�
5����:����G�L�)�)���-�-������
5����1�6�6�7�7�<�CX�CX�Y�Y�Y�Y�����V�V�4�4�4��	X�v��{�{�!�"2�F�L�,�W�W�W��l�E�*�*�	5�/?�	5�&�|�4�4�L� �	 ��L�+�l�*C�*C�D�D��s8�AB�B,�+B,�9H	�	H$�H�H$�E(P�4Q�Dict[str, str]c��|jSr�)r�r�s ra�environmentzGit.environment`s��� � r��Dict[str, Union[str, None]]c���i}|���D]P\}}|�(|j�|��||<||j|<�/||jvr|j|||<|j|=�Q|S)a�
        Set environment variables for future git invocations. Return all changed
        values in a format that can be passed back into this function to revert
        the changes:

        ``Examples``::

            old_env = self.update_environment(PWD='/tmp')
            self.update_environment(**old_env)

        :param kwargs: environment variables to use for git processes
        :return: dict that maps environment variables to their old values
        )r�r�r�)r�rH�old_env�key�values     ra�update_environmentzGit.update_environmentcs����� �,�,�.�.�	+�	+�J�C��� �#�0�4�4�S�9�9����).��!�#�&�&���)�)�)�#�0��5�����%�c�*���r��Iterator[None]c+�lK�|jdi|��}	dV�|jdi|��dS#|jdi|��wxYw)a[
        A context manager around the above ``update_environment`` method to restore the
        environment back to its previous state after operation.

        ``Examples``::

            with self.custom_environment(GIT_SSH='/bin/ssh_wrapper'):
                repo.remotes.origin.fetch()

        :param kwargs: see update_environment
        Nr�)r�)r�rHr�s   ra�custom_environmentzGit.custom_environment}sm����*�$�)�3�3�F�3�3��	/��E�E�E�#�D�#�.�.�g�.�.�.�.�.��#�D�#�.�.�g�.�.�.�.���s�$�3r�rKc���t|��dkr#|durd|zgS|dvr|r
d|zd|zgSd|�|��gSn3|durdt|��zgS|dur|�d	t|���d
|��gSgS)NrTz-%s)FNz%sr�z--%sFz--�=)r.r�)r�rNr�rKs    ra�transform_kwargzGit.transform_kwarg�s����t�9�9��>�>���}�}����~�%��m�+�+�,�5�!�D�L�$��,�7�7�5�(,�t�U�U�3�4�4�	,���}�}������.�/�/��e�#�#��(9�(9�%,�T�]�]�]�]�E�E�:�;�;��	r�c���g}|���D][\}}t|ttf��r |D]}||�|||��z
}��A||�|||��z
}�\|S)z=Transforms Python style kwargs into git command line options.)r�rWrnrmr�)r�rKrHrer�r�r�s       rarLzGit.transform_kwargs�s������L�L�N�N�	N�	N�D�A�q��!�d�E�]�+�+�
N��V�V�E��D�0�0��E�;T�U�U�U�D�D�V���,�,�Q��3L�M�M�M����r��arg_listr�c���g}t|ttf��r.|D]*}|�|�|�����+n"|�t
|����|Sr�)rWrnrm�extend�_unpack_argsrprO)r�r��outlist�args    rar�zGit._unpack_args�su�����h��u�
�.�.�	*��
6�
6�����s�/�/��4�4�5�5�5�5�
6�
�N�N�3�x�=�=�)�)�)��r��'Git'c�.�|jdddi|��|_|S)anSpecify command line options to the git executable
        for a subcommand call

        :param kwargs:
            is a dict of keyword arguments.
            these arguments are passed as in _call_process
            but will be passed to the git command rather than
            the subcommand.

        ``Examples``::
            git(work_tree='/tmp').difftool()rKTr�)rLr�rMs  ra�__call__zGit.__call__�s*��2�D�1�[�[�D�[�TZ�[�[����r��methodrec��dSr�r��r�r�rerHs    rarGzGit._call_process�rdr��'Git.AutoInterrupt'c��dSr�r�)r�r�r2r3rerHs      rarGzGit._call_process�rmr��JUnion[str, bytes, Tuple[int, Union[str, bytes], str], 'Git.AutoInterrupt']c��dSr�r�r�s    rarGzGit._call_process�s	��	�r�c	���d�|���D��}d�|���D��}|�dd��}|jd
i|��}|�d�|D����}|�||z}	nk	|�|��}
n6#t
$r)}td|�dt
|���d���|�d}~wwxYw|d|
d	z�|z||
d	zd�z}	|jg}|j|j	��|j|j
��d
|_
|jt|����|j|	��|j
|fi|��S)a�Run the given git command with the specified arguments and return
        the result as a String

        :param method:
            is the command. Contained "_" characters will be converted to dashes,
            such as in 'ls_files' to call 'ls-files'.

        :param args:
            is the list of arguments. If None is included, it will be pruned.
            This allows your commands to call git more conveniently as None
            is realized as non-existent

        :param kwargs:
            It contains key-values for the following:
            - the :meth:`execute()` kwds, as listed in :var:`execute_kwargs`;
            - "command options" to be converted by :meth:`transform_kwargs()`;
            - the `'insert_kwargs_after'` key which its value must match one of ``*args``
            and any cmd-options will be appended after the matched arg.

        Examples::

            git.rev_list('master', max_count=10, header=True)

        turns into::

           git rev-list max-count 10 --header master

        :return: Same as ``execute``
                 if no args given used execute default (esp. as_process = False, stdout_as_string = True)
                 and return strc�,�i|]\}}|tv�||��Sr���execute_kwargs�r�r�r�s   rar�z%Git._call_process.<locals>.<dictcomp>�s(��N�N�N���1�!�~�:M�:M�q�!�:M�:M�:Mr�c�,�i|]\}}|tv�||��Sr�r�r�s   rar�z%Git._call_process.<locals>.<dictcomp>�s(��R�R�R���1�!�>�:Q�:Q�q�!�:Q�:Q�:Qr��insert_kwargs_afterNc��g|]}|�|��Sr�r�)r��as  rar�z%Git._call_process.<locals>.<listcomp>s��%G�%G�%G�A���a���r�zCouldn't find argument 'z
' in args z to insert cmd options afterrr�)r��poprLr��indexrrOr�r�r�r�rpr�rc)
r�r�rerH�exec_kwargs�opts_kwargs�insert_after_this_arg�opt_args�ext_args�	args_listr�r�rs
             rarGzGit._call_process�s���FO�N������N�N�N��R�R������R�R�R�� +���0E�t� L� L��)�4�(�7�7�;�7�7���$�$�%G�%G��%G�%G�%G�H�H�� �(� �8�+�I�I�
� ���'<�=�=�����
�
�
� �j�,�,�,�c�(�m�m�m�m�=���������
����!��5�1�9��-��8�8�E�A�I�K�K�;P�P�I��.�/��	���D�0�1�1�1�	���D�%�&�&�&�������G�F�O�O�$�$�$����I�����t�|�D�0�0�K�0�0�0s�B�
C�($C�C�header_line�Tuple[str, str, int]c��|���}t|��dkrS|s$td|���z���td|d�d|��������t|d��dkrtd|z���|d|dt	|d	��fS)
z�
        :param header_line:
            <hex_sha> type_string size_as_int

        :return: (hex_sha, type_string, size_as_int)

        :raise ValueError: if the header contains indication for an error due to
            incorrect input sha�z+SHA could not be resolved, git returned: %rzSHA rz& could not be resolved, git returned: �(zFailed to parse header: %rrrQ)ror.r�stripr�)r�r��tokenss   ra�_parse_object_headerzGit._parse_object_header%s����"�"�$�$���v�;�;�!����
v� �!N�R]�Rc�Rc�Re�Re�!f�g�g�g� �j�U[�\]�U^�U^�U^�`k�`q�`q�`s�`s�`s�!t�u�u�u��v�a�y�>�>�R����9�K�G�H�H�H��q�	�6�!�9�c�&��)�n�n�5�5r��refrc��t|t��r|�d��}n't|t��st|��}n|}|�d��s|dz
}|�t��S)N�asciir�)rWrXrYrOr�rzr
)r�r��refstrs   ra�_prepare_refzGit._prepare_ref;sz���c�5�!�!�	��*�*�W�-�-�F�F��C��%�%�	���X�X�F�F��F����t�$�$�	��d�N�F��}�}�V�$�$�$r��	attr_name�cmd_namec���t||��}|�|Stdd�}|�|��|j|g|�Ri|��}t	|||��td|��}|S)NT)r2r3rd)rlrr�rGr�r))r�r�r�rerH�cur_valr��cmds        ra�_get_persistent_cmdzGit._get_persistent_cmdIs����$�	�*�*�����N�"�$�7�7�����v���� �d� ��<�D�<�<�<�G�<�<����i��%�%�%��&��,�,���
r�r�c� �|jry|jrr|j�|�|����|j���|�|j�����Std���)Nzcmd stdin was empty)rrg�writer��flushr�r2r)r�r�r�s   ra�__get_object_headerzGit.__get_object_headerVsz���9�	4���	4��I�O�O�D�-�-�c�2�2�3�3�3��I�O�O�����,�,�S�Z�-@�-@�-B�-B�C�C�C��2�3�3�3r�c�^�|�ddd���}|�||��S)a#Use this method to quickly examine the type and size of the object behind
        the given ref.

        :note: The method will only suffer from the costs of command invocation
            once and reuses the command in subsequent calls.

        :return: (hexsha, type_string, size_as_int)r��cat_fileT)�batch_check)r��_Git__get_object_header)r�r�r�s   ra�get_object_headerzGit.get_object_header^s6���&�&�'8�*�RV�&�W�W���'�'��S�1�1�1r��Tuple[str, str, int, bytes]c�n�|�|��\}}}}|�|��}~||||fS)z�As get_object_header, but returns object data as well

        :return: (hexsha, type_string, size_as_int, data_string)
        :note: not threadsafe)�stream_object_datar)r�r��hexsha�typenamer(rPrs       ra�get_object_datazGit.get_object_dataisC��
*.�)@�)@��)E�)E�&���$���{�{�4� � �����$��-�-r��0Tuple[str, str, int, 'Git.CatFileContentStream']c���|�ddd���}|�||��\}}}|j�|jntj��}||||�||��fS)z�As get_object_header, but returns the data as a stream

        :return: (hexsha, type_string, size_as_int, stream)
        :note: This method is not threadsafe, you need one independent Command instance per thread to be safe !r�r�T)�batch)r�r�rgr��BytesIOr@)r�r�r�r�r�r(�
cmd_stdouts       rar�zGit.stream_object_datassq��
�&�&�~�z��&�N�N��!%�!9�!9�#�s�!C�!C����$�#&�:�#9�S�Z�Z�r�z�|�|�
���$��(A�(A�$�
�(S�(S�T�Tr�c�p�|j|jfD]}|r|����d|_d|_|S)z�Clear all kinds of internal caches to release resources.

        Currently persistent commands will be interrupted.

        :return: selfN)r�r�r
)r�r�s  ra�clear_cachezGit.clear_cache}sI���%�t�';�<�	�	�C��
����
�
�
�� ���#����r�)rIr�)r�r�rIrJr�)r�r�rIrG)rIrG).)r�rOr�r�rIrO)r�rOr�r�rIrO)r�rOr�r�rIr+)r�rOrIrJ)r�rMr�rMrIrJ)rAr�)rNrOrIr)rHrrIrJ)rrOrIrJ)rIr�)rIr[)r^r_r3r`rIra)r^r_r3r�r8r`rIre)r^r_r3r�r8r�rIri)
r^r_r;r�r3r�r8r`rIrO)
r^r_r;r�r3r�r8r�rIrX) r^r_r2ror;rGr7rGr3rGr5ror8rGr9rHr4rGr:rGr1r�r0rpr6r�r<rGrqrrIrr)rIr�)rHrrIr�)rHrrIr�)rNrOr�rrKrGrIrM)T)rKrGrHrrIrM)r�r�rIrM)rHrrIr�)r�rOrerJrHrJrIrO)r�rOr2r�r3r`rerrHrrIr�)r�rOrerrHrrIr�)r�rOrIr�)r�rrIrX)
r�rOr�rOrerrHrrIr�)r�r�r�rrIr�)r�rOrIr�)r�rOrIr�)r�rOrIr)rIr�):rrr r!r�r��re�compiler�r�r�r�r�r�r�r�r�r�r�r��classmethodr�r�r*r�r�r�r�rwr@rrrNrW�propertyrAr]rcr�r�r�r�rr�r�rLr�r�rGr�r�r�r�r�r�r�r�
__classcell__)rDs@rar=r=�s��������
�
��I�F�J�#���J�/�/��<�<�<�<�P�P�P�P�
�M��z�~�~�&8�%�@�@���I�4��+�� $���A�A�A�A��[�A�F�<�<�<��[�<��������[��X���������[��X��������[��&�����[��(�����[��(g�g�g�g�g��g�g�g�Vf2�f2�f2�f2�f2�v�f2�f2�f2�R3�3�3�3�3�3�3�(Q�Q�Q�Q�g�g�g�g�/�/�/�/�/�/��!�!�!��X�!��"�"�"��X�"������X���
&+�	������X���
&+�+0�������X�������X�������X��*.�%*� $� �/3�!%�15� �#(�#'�.2� �4�(,�a �a �a �a �a �F	!�!�!�!�����4�/�/�/��^�/�$���� 	�	�	�	�	��	�	�	��[�	�
�
�
�
������X�������X�������X��
H1�H1�H1�H1�T6�6�6�6�,%�%�%�%�����4�4�4�4�	2�	2�	2�	2�.�.�.�.�U�U�U�U��������r�r=)NTN)r>r?r@rArBrCrDrErFrGr9rHrIrJ)r�rOrIrO)r�)r�r�r�r�rIr�)r�r�r�r�r�r�rIrJ)N�
__future__rr�
contextlibrr��loggingr�r�r�rrrrrq�textwrapr	�
git.compatr
rrr
r�git.excr�git.utilrrrr�excrrrr�utilrr�typingrrrrrr r!r"r#r$r%r&r'r(r)r*�	git.typesr+r,r-�
git.repo.baser.�git.diffr/r��	getLoggerrr[�
addHandler�NullHandler�__all__r�r�r�r��CREATE_NO_WINDOW�CREATE_NEW_PROCESS_GROUPr�r=r�r�ra�<module>rs���#�"�"�"�"�"�	�	�	�	�%�%�%�%�%�%�	�	�	�	�����	�	�	�	�
�
�
�
�1�1�1�1�1�1�1�1�1�1�1�1�����������������������������!� � � � � �T�T�T�T�T�T�T�T�T�T�T�T�\�\�\�\�\�\�\�\�\�\�\�\���������������������������������������������&-�,�,�,�,�,�,�,�,�,��#�"�"�"�"�"�"�"�"�"�"�"�"�
���� �g���!�!�����"�w�"�$�$�%�%�%�
��&^b��-1�q�q�q�q�q�h$�$�$�$�M�M�M�M�M��������
?E�K��z�:�:�:�!��
\�\�\�\�\�)�\�\�\�\�\r�

Zerion Mini Shell 1.0