AlkantarClanX12

Your IP : 3.145.112.23


Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/git/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/git/__pycache__/util.cpython-311.pyc

�

�܋f›�	�P�UddlmZddlmZddlmZddlZddlm	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlmZddlZddlmZmZddlZddlmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+ddl,Z,e*rdd	l-m.Z.dd
l/m0Z0ddl1m2Z2m3Z3ddl4m5Z5dd
l6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?e'de(dd���Z@ddlAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJgd�ZKejLeM��ZNeoejO�Pdd��ZQeoejO�Pdd��ZRe'd��ZSdedeSfdedeSffd�ZTejUde;dee;ddffd���ZVde;ddfd�ZWde;ddfd�ZXdjd!ed"ed#eYdeYfd$�ZZd%e;d&e;de;fd'�Z[er(de;de;fd(�Z\de;de]fd)�Z^eK�_d*��e\Z`n
de;de]fd+�Z^e^Z`d%e;d&e;de;fd,�Zadkde;d.ebdebfd/�Zcde%e]fd0�Zddld1e]de#e;de"e]fd2�Zed3e#e]de]de]fd4�Zfejgd5��d6�d-fejgd7��efd-fejgd8��efd-fejgd9ejh��d:�dfejgd;��d<�d-ffZie&e&e$e]eebfdfejd=<de]de]fd>�Zkejgd?��Zlde;de]fd@�ZmiZnee]e#ebfejdA<e+dBdde7d-fdC���Zoe+dBe;debfdD���ZodBe(de;fdebfdE�Zode]fdF�ZpdGe(ejqdHfdIeddfdJ�Zre+dmd&ddKebddfdL���Zse+dmd&e;dKebde]fdM���Zsdnd&e(de;fdKebde#e;fdN�ZsdOe%e]de"e]fdP�ZtGdQ�dReu��ZvGdS�dTev��ZwGdU�dVeu��ZxGdW�dXeu��ZyGdY�dZeu��ZzGd[�d\eu��Z{Gd]�d^e{��Z|Gd_�d`e"e@��Z}Gda�dbe~��ZGdc�dde�e��Z�e:Gdf�dge9����Z�Gdh�diej���Z�dS)o�)�abstractmethodN�)�is_win)�wraps)�maxsize)�urlsplit�
urlunsplit)�Any�AnyStr�BinaryIO�Callable�Dict�	Generator�IO�Iterator�List�Optional�Pattern�Sequence�Tuple�TypeVar�Union�cast�
TYPE_CHECKING�overload)�Remote)�Repo)�GitConfigParser�SectionConstraint)�Git)	�Literal�
SupportsIndex�Protocol�runtime_checkable�PathLike�HSH_TD�Total_TD�Files_TD�Has_id_attribute�
T_IterableObj)�IterableObjr)T)�bound�	covariant)	�make_sha�LockedFD�file_contents_ro�file_contents_ro_filepath�	LazyMixin�
to_hex_sha�
to_bin_sha�
bin_to_hex�
hex_to_bin)�stream_copy�	join_path�to_native_path_linux�join_path_native�Stats�IndexFileSHA1Writerr+�IterableList�BlockingLockFile�LockFile�Actor�get_user_id�assure_directory_exists�RemoteProgress�CallableRemoteProgress�rmtree�unbare_repo�HIDE_WINDOWS_KNOWN_ERRORSrG�HIDE_WINDOWS_FREEZE_ERRORS�T�func.�returnc	�|���ddlm�t���dddtdtdtf��fd���}|S)	zqMethods with this decorator raise :class:`.exc.InvalidGitRepositoryError` if they
    encounter a bare repositoryr)�InvalidGitRepositoryError�selfr�args�kwargsrKc�Z��|jjr�d�jz����|g|�Ri|��S)Nz/Method '%s' cannot operate on bare repositories)�repo�bare�__name__)rNrOrPrMrJs   ���Y/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/git/util.py�wrapperzunbare_repo.<locals>.wrapper�sK����9�>�	o�+�+�,]�`d�`m�,m�n�n�n��t�D�*�4�*�*�*�6�*�*�*�)�excrMrr
rI)rJrVrMs` @rUrFrF�sn����/�.�.�.�.�.�
�4�[�[�+�h�+�s�+�c�+�a�+�+�+�+�+�+��[�+��NrW�new_dirc#�K�tj��}tj|��	|V�tj|��dS#tj|��wxYw�N)�os�getcwd�chdir)rY�old_dirs  rU�cwdr`�s[�����i�k�k�G��H�W������
�
�
�
������������������s�A�A�pathc�d�dtdtdtddfd�}tj|d|��S)z�Remove the given recursively.

    :note: we use shutil rmtree but adjust its behaviour to see whether files that
        couldn't be deleted are read-only. Windows will not remove them in that caserJra�exc_inforKNc���tj|tj��	||��dS#t$r2}t
r%ddlm}|d�|����|��d}~wwxYw)Nr)�SkipTestz'FIXME: fails with: PermissionError
  {})	r\�chmod�stat�S_IWUSR�	ExceptionrG�unittestre�format)rJrarc�exres     rU�onerrorzrmtree.<locals>.onerror�s���
���t�|�$�$�$�	��D��J�J�J�J�J���	�	�	�(�
^�-�-�-�-�-�-��h�I�P�P�QS�T�T�U�U�[]�]������	���s�.�
A*�-A%�%A*F)r
r%�str�shutilrE)rarms  rUrErE�sH���h��h��#��$������=��u�g�.�.�.rWc��tj|��r2trtj|d��tj|��dSdS)zSEnsure file deleted also on *Windows* where read-only files need special treatment.i�N)�osp�isfilerr\rf�remove�ras rU�rmfileru�sI��
�z�$�����	"��H�T�5�!�!�!�
�	�$�������rW��source�destination�
chunk_sizec��d}	|�|��}|�|��|t|��z
}t|��|krn�Q|S)z�Copy all data from the source stream into the destination stream in chunks
    of size chunk_size

    :return: amount of bytes writtenr)�read�write�len)rwrxry�br�chunks     rUr7r7�sc��

�B�����J�'�'�����%� � � �
�c�%�j�j����u�:�:�
�"�"����IrW�a�pc���t|��}|D]`}t|��}|s�|�d��r||dd�z
}�7|dks|�d��r||z
}�X|d|zz
}�a|S)zhJoin path tokens together similar to osp.join, but always use
    '/' instead of possibly '' on windows.�/rN�)rn�
startswith�endswith)r�r�ra�bs    rUr8r8�s����q�6�6�D�
�	�	����F�F���	���<�<����	��A�a�b�b�E�M�D�D�
�R�Z�Z�4�=�=��-�-�Z��A�I�D�D��C�!�G�O�D�D��KrWc�L�t|��}|�dd��S)Nr��\�rn�replacerts rU�to_native_path_windowsr��s!���4�y�y���|�|�C��&�&�&rWc�L�t|��}|�dd��S)Nr�r�r�rts rUr9r9�s!���4�y�y���|�|�D�#�&�&�&rWr�c� �t|��Sr[)rnrts rUr9r9�s���4�y�y�rWc�6�tt|g|�R���S)z�
    As join path, but makes sure an OS native path is returned. This is only
        needed to play it safe on my dear windows and to assure nice paths that only
        use '')�to_native_pathr8)r�r�s  rUr:r:�s"��
�)�A�*��*�*�*�+�+�+rWF�is_filec��|rtj|��}tj|��stj|d���dSdS)z�Assure that the directory pointed to by path exists.

    :param is_file: If True, path is assumed to be a file and handled correctly.
        Otherwise it must be a directory
    :return: True if the directory was created, False if it already existedT)�exist_okF)rq�dirname�isdirr\�makedirs)rar�s  rUrBrB�sJ���!��{�4� � ���9�T�?�?��
��D�4�(�(�(�(��t��5rWc���tj�dd��}|r6td�|�tj��D����n
trdndS)N�PATHEXTc3�>K�|]}|���V��dSr[)�upper)�.0r�s  rU�	<genexpr>z&_get_exe_extensions.<locals>.<genexpr>s*����
;�
;�A�a�g�g�i�i�
;�
;�
;�
;�
;�
;rW)z.BAT�COMz.EXEr�)r\�environ�get�tuple�split�pathsepr)r�s rU�_get_exe_extensionsr�s[���j�n�n�Y��-�-�G�?F�w��
;�
;����r�z�!:�!:�
;�
;�
;�;�;�;�gm�Lw�Lc�Lc�tv�rW�programc����t���dtdtf�fd�}g}|stjd}t|���tj��D]c}|�d��}|rJtj	||����g�fd��D��zD]"}||��r|�
|���#�d|S)N�fpathrKc�����tj���oLtj�tj��o-tjdkp�pt
�fd��D����S)N�ntc3�f�K�|]+}�����|��V��,dSr[)r�r�)r��extr�s  �rUr�z,py_where.<locals>.is_exec.<locals>.<genexpr>s;�����;p�;p�\_�E�K�K�M�M�<R�<R�SV�<W�<W�;p�;p�;p�;p�;p�;prW)rqrrr\�access�X_OK�name�any)r��winprog_extss`�rU�is_execzpy_where.<locals>.is_execsg�����J�u���
r��	�%���)�)�
r���D��p��$4�p��;p�;p�;p�;p�co�;p�;p�;p�8p�8p�	
rW�PATH�"c���g|]}��|����	S�r�)r��e�exe_paths  �rU�
<listcomp>zpy_where.<locals>.<listcomp>%s"���"P�"P�"P�a�X�X�q�q�#9�"P�"P�"PrW)r�rn�boolr\r�r�r��striprq�join�append)r�rar��progs�folder�fr�r�s      @@rU�py_wherer�s�����&�(�(�L�
�s�
�t�
�
�
�
�
�
�
�E��"��z�&�!���d�)�)�/�/�"�*�-�-�$�$�����c�"�"���	$��x���0�0�H��Z�"P�"P�"P�"P�<�"P�"P�"P�P�
$�
$���7�1�:�:�$��L�L��O�O�O����LrW�drivec�|�tj|��r|s|}n|o7tjtjtj|������}tj|��r|r|}n,t|��}n|rd|����d|��}t|��}|�dd��S)Nz/proc/cygdrive/r�r�)	rq�isabs�normpath�
expandvars�
expanduser�cygpath�lowerrnr�)r�rar��p_strs    rU�
_cygexpathr�+s���
�y����
<�u�
<�
����G�S�\�#�.����1E�1E�"F�"F�G�G���9�Q�<�<�	<��
�����A�J�J���
�	<�	<�*/�+�+�-�-�-�-���;�A���F�F�E��=�=��s�#�#�#rWz*\\\\\?\\UNC\\([^\\]+)\\([^\\]+)(?:\\(.*))?c	�@�d|�d|�d|�dd����S)N�//r�r�)r�)�server�share�	rest_paths   rU�<lambda>r�Cs,���&�&�&�%�%�%��IZ�IZ�[_�ad�Ie�Ie�Ie�*f�rWz\\\\\?\\(\w):[/\\](.*)z(\w):[/\\](.*)z	file:(.*)c��|Sr[r�)r�s rUr�r�Hs��	�rWz(\w{2,}:.*)c��|Sr[r�)�urls rUr�r�Is��c�rW�_cygpath_parsersc��t|��}|�d��s_tD]G\}}}|�|��}|r*||����}|rt|��}n�Ht
d|��}|S)zLUse :meth:`git.cmd.Git.polish_url()` instead, that works on any environment.)z	/cygdriver�z/proc/cygdriveN)rnr�r��match�groupsr�r�)ra�regex�parser�recurser�s     rUr�r�Ms����t�9�9�D��?�?�@�A�A�	*�&6�	*�	*�"�E�6�7��K�K��%�%�E��
��v�u�|�|�~�~�.���)�"�4�=�=�D���	
��d�D�)�)�D��KrWz(?:/proc)?/cygdrive/(\w)(/.*)?c���t|��}t�|��}|r2|���\}}|����d|pd��}|�dd��S)N�:r�r�r�)rn�_decygpath_regexr�r�r�r�)ra�mr�r�s    rU�	decygpathr�bsj���t�9�9�D����t�$�$�A��:��8�8�:�:���y��+�+�-�-�-�-���b��9���<�<��T�"�"�"rW�_is_cygwin_cache�git_executablec��dSr[r��r�s rU�
is_cygwin_gitr�q����CrWc��dSr[r�r�s rUr�r�vr�rWc� �trdS|�dSt|��}t�|��}|��d}	t	j|��}|s-t
|��}|rt	j|d��nd}t	j|d��}tj	|gtj
d���}|���\}}d|v}n2#t$r%}t�d|��Yd}~nd}~wwxYw|t|<|S)	NFrr��unameT)�stdout�universal_newlines�CYGWINz/Failed checking if running in CYGWIN due to: %r)rrnr�r�rqr�r�r��
subprocess�Popen�PIPE�communicateri�log�debug)	r��	is_cygwin�git_dir�res�	uname_cmd�process�	uname_out�_rls	         rUr�r�{s6��
���u����u���(�(�N� �$�$�^�4�4�I����	�
	M��k�.�1�1�G��
=��~�.�.��14�<�#�+�c�!�f�-�-�-�"�����'�2�2�I� �&�	�{�:�?�_c�d�d�d�G�"�.�.�0�0�L�I�q� �I�-�I�I���	M�	M�	M��I�I�G��L�L�L�L�L�L�L�L�����	M����+4���(��s�BC�
D�C<�<Dc�T�tj���dtj����S)zI:return: string identifying the currently active system user as name@node�@)�getpass�getuser�platform�noder�rWrUrArA�s#���o�'�'�'�'������9�9rW�proczGit.AutoInterruptrPc� �|jdi|��dS)zSWait for the process (clone, fetch, pull or push) and handle its errors accordinglyNr�)�wait)r�rPs  rU�finalize_processr�s"���D�I��������rW�expand_varsc��dSr[r��r�rs  rU�expand_pathr�r�rWc��dSr[r�rs  rUrr�s	���CrWc�"�t|tj��r|���S	t	j|��}|rt	j|��}t	jt	j|����S#t$rYdSwxYwr[)
�
isinstance�pathlib�Path�resolverqr�r�r��abspathrirs  rUrr�s����!�W�\�"�"���y�y�{�{����N�1�����	"���q�!�!�A��|�C�K��N�N�+�+�+�������t�t����s�AB�
B�
B�cmdlinec���g}t|��D]�\}}|�|��	t|��}|j�|j��9|j�4|�|j�|jd�����}|j�4|�|j�|jd�����}t|��||<��#t$rY��wxYw|S)a8
    Parse any command line argument and if on of the element is an URL with a
    username and/or password, replace them by stars (in-place).

    If nothing found just returns the command line as-is.

    This should be used for every log line that print a command line, as well as
    exception messages.
    Nz*****)�netloc)
�	enumerater�r�password�username�_replacerr�r	�
ValueError)r
�new_cmdline�index�to_parser�s     rU�remove_password_if_presentr�s����K�$�W�-�-�����x����8�$�$�$�
	��8�$�$�C��|�#���(<���|�'��l�l�#�*�*<�*<�S�\�7�*S�*S�l�T�T���|�'��l�l�#�*�*<�*<�S�\�7�*S�*S�l�T�T��!+�C���K������	�	�	��H�	�����s�C�BC�
C!� C!c�F�eZdZUdZdZeed<d�ee��D��\	ZZ	Z
ZZZ
ZZZee	zZeZdZdZdZejd��Zejd	��Zdd�Zd
ed
dfd�Zd
eegdffd�Zd
ed
dfd�Z 		ddede!ee"fde!ee"dfded
df
d�Z#dS)rCz�
    Handler providing an interface to parse progress information emitted by git-push
    and git-fetch and to dispatch callbacks allowing subclasses to react to the progress.
    �	�
_num_op_codesc��g|]}d|z��S)rr�)r��xs  rUr�zRemoteProgress.<listcomp>�s��.�.�.�A��a��.�.�.rWzdone.z, )�	_cur_line�	_seen_ops�error_lines�other_linesz%(remote: )?([\w\s]+):\s+()(\d+)()(.*)z2(remote: )?([\w\s]+):\s+(\d+)% \((\d+)/(\d+)\)(.*)rKNc�>�g|_d|_g|_g|_dSr[)rrr r!�rNs rU�__init__zRemoteProgress.__init__s&��$&���(,���&(���&(����rW�linec�|�t|t��r|�d��}n|}||_|j�d��r!|j�|j��dSd}tt|����D]\}}t|��dkr|dz
}�|�
|d|�}|�
��}d\}}|j�|��}|�|j
�|��}|s1|�|��|j�|��dSd}	|���\}
}}}}}
|dkr|	|jz}	n}|d	kr|	|jz}	nl|d
kr|	|jz}	n[|dkr|	|jz}	nJ|dkr|	|jz}	n9|d
kr|	|jz}	n(|dkr|	|jz}	n|�|��dS|	|jvr$|j�|	��|	|jz}	|
�d}
|
���}
|
�|j��r'|	|jz}	|
dt=|j���}
|
�|j��}
|� |	|otC|��|otC|��|
��dS)a3Parse progress information from the given line as retrieved by git-push
        or git-fetch.

        - Lines that do not contain progress info are stored in :attr:`other_lines`.
        - Lines that seem to contain an error (i.e. start with error: or fatal:) are stored
            in :attr:`error_lines`.zutf-8)zerror:zfatal:N� r)NNrzCounting objectszCompressing objectszWriting objectszReceiving objectszResolving deltaszFinding sourceszChecking out filesr�)"r�bytes�decoderr�r r�r�reversed�ord�rstrip�re_op_relativer��re_op_absolute�line_droppedr!r��COUNTING�COMPRESSING�WRITING�	RECEIVING�	RESOLVING�FINDING_SOURCES�CHECKING_OUTr�BEGINr�r��
DONE_TOKEN�ENDr}�TOKEN_SEPARATOR�update�float)rNr%�line_str�last_valid_index�i�c�	cur_count�	max_countr��op_code�_remote�op_name�_percent�messages              rU�_parse_progress_linez#RemoteProgress._parse_progress_lines.���d�E�"�"�	��{�{�7�+�+�H�H��H�!����>�$�$�%9�:�:�	���#�#�D�N�3�3�3��F� ���h�x�0�0�1�1�	*�	*�D�A�q��1�v�v��{�{�$%�2��6� ���'�� 1�!1� 1�2�H��?�?�$�$��)��	�9��#�)�)�(�3�3���=��'�-�-�h�7�7�E��	����h�'�'�'���#�#�H�-�-�-��F���DI�L�L�N�N�A���(�I�y�'��(�(�(��t�}�$�G�G�
�-�
-�
-��t�'�'�G�G�
�)�
)�
)��t�|�#�G�G�
�+�
+�
+��t�~�%�G�G�
�*�
*�
*��t�~�%�G�G�
�)�
)�
)��t�+�+�G�G�
�,�
,�
,��t�(�(�G�G�
���h�'�'�'��4��$�.�(�(��N�!�!�'�*�*�*��t�z�!�G��?��G��-�-�/�/�����D�O�,�,�	7��t�x��G��5��T�_�!5�!5� 5�5�6�G��-�-�� 4�5�5�������*�%�	�*�*��*�%�	�*�*��		
�	
�	
�	
�	
rWc�&��dtddf�fd�}|S)z�
        :return:
            a progress handler suitable for handle_process_output(), passing lines on to this Progress
            handler in a suitable formatr%rKNc�R����|�����Sr[)rHr,)r%rNs �rU�handlerz3RemoteProgress.new_message_handler.<locals>.handlerss����,�,�T�[�[�]�]�;�;�;rW)r)rNrKs` rU�new_message_handlerz"RemoteProgress.new_message_handlerms6���	<�&�	<�T�	<�	<�	<�	<�	<�	<��rWc��dS)zICalled whenever a line could not be understood and was therefore dropped.Nr�)rNr%s  rUr/zRemoteProgress.line_droppedys���rWr�rCrArBrGc��dS)a2Called whenever the progress changes

        :param op_code:
            Integer allowing to be compared against Operation IDs and stage IDs.

            Stage IDs are BEGIN and END. BEGIN will only be set once for each Operation
            ID as well as END. It may be that BEGIN and END are set at once in case only
            one progress message was emitted due to the speed of the operation.
            Between BEGIN and END, none of these flags will be set

            Operation IDs are all held within the OP_MASK. Only one Operation ID will
            be active per call.
        :param cur_count: Current absolute count of items

        :param max_count:
            The maximum count of items we expect. It may be None in case there is
            no maximum number of items or if it is (yet) unknown.

        :param message:
            In case of the 'WRITING' operation, it contains the amount of bytes
            transferred. It may possibly be used for other purposes as well.

        You may read the contents of the current line in self._cur_lineNr�)rNrCrArBrGs     rUr;zRemoteProgress.update}s	��<	
�rW�rKN�Nr�)$rT�
__module__�__qualname__�__doc__r�int�__annotations__�ranger7r9r0r1r2r3r4r5r6�
STAGE_MASK�OP_MASKr8r:�	__slots__�re�compiler.r-r$rrHr
rnrLr/rr<r;r�rWrUrCrC�s����������
�M�3����	/�.���}�-�-�.�.�.�
�
������������J��k�G��J��O��I� �R�Z� H�I�I�N��R�Z� U�V�V�N�)�)�)�)�d
��d
�D�d
�d
�d
�d
�L
�X�s�e�T�k�%:�
�
�
�
�
��
��
�
�
�
�.2��
�
��
���e��$�
���e�T�)�*�	
�
�
�
�

�
�
�
�
�
rWrCc�D��eZdZdZdZdeddf�fd�Zdededdfd	�Z�xZ	S)
rDz4An implementation forwarding updates to any callable�	_callable�fnrKNc�d��||_tt|�����dSr[)r]�superrDr$)rNr^�	__class__s  �rUr$zCallableRemoteProgress.__init__�s-������
�$�d�+�+�4�4�6�6�6�6�6rWrOrPc� �|j|i|��dSr[)r])rNrOrPs   rUr;zCallableRemoteProgress.update�s������'��'�'�'�'�'rW)
rTrQrRrSrYr
r$r
r;�
__classcell__�ras@rUrDrD�s�������>�>��I�7�8�7��7�7�7�7�7�7�(�C�(�3�(�4�(�(�(�(�(�(�(�(rWrDc
��eZdZdZejd��Zejd��ZdZdZ	dZ
dZdZd	Z
d
Zdeed	eeddfd
�Zdedefd�Zdedefd�Zdefd�Zdefd�Zdefd�Zededdfd���Ze	ddedededddfd���Zeddedddfd���Zeddedddfd���ZdS)r@z�Actors hold information about a person acting on the repository. They
    can be committers and authors or anything with a name and an email as
    mentioned in the git log entries.z<(.*)>z(.*) <(.*?)>�GIT_AUTHOR_NAME�GIT_AUTHOR_EMAIL�GIT_COMMITTER_NAME�GIT_COMMITTER_EMAILr��email�r�rjrKNc�"�||_||_dSr[rk)rNr�rjs   rUr$zActor.__init__�s����	���
�
�
rW�otherc�B�|j|jko|j|jkSr[rk�rNrms  rU�__eq__zActor.__eq__�s���y�E�J�&�D�4�:���+D�DrWc��||kSr[r�ros  rU�__ne__zActor.__ne__�s���E�M�"�"rWc�8�t|j|jf��Sr[)�hashr�rjr#s rU�__hash__zActor.__hash__�s���T�Y��
�+�,�,�,rWc�"�|jr|jndSrP)r�r#s rU�__str__z
Actor.__str__�s�� �I�-�t�y�y�2�-rWc�(�d|j�d|j�d�S)Nz<git.Actor "z <z>">rkr#s rU�__repr__zActor.__repr__�s���*.�)�)�)�T�Z�Z�Z�@�@rW�stringc�&�|j�|��}|r'|���\}}t||��S|j�|��}|r#t|�d��d��St|d��S)z�Create an Actor from a string.
        :param string: is the string, which is expected to be in regular git format

                John Doe <jdoe@example.com>

        :return: ActorrN)�name_email_regex�searchr�r@�name_only_regex�group)�clsrzr�r�rjs     rU�_from_stringzActor._from_string�s���
� �'�'��/�/���	'��(�(�*�*�K�D�%���u�%�%�%��#�*�*�6�2�2�A��
/��Q�W�W�Q�Z�Z��.�.�.����&�&�&rW�env_name�	env_email�
config_reader)Nrrc�����tdd��}d�dtf�fd��dtf�fd�}d||j|fd||j�ffD]�\}}}}		tj|}
t
|||
���,#t$rq|�C	|�d|��}
n#t$r
|	��}
YnwxYwt
|||
��t||��st
|||	����Y��wxYw|S)Nr�rKc�(���st����Sr[)rA)�user_ids�rU�
default_emailz(Actor._main_actor.<locals>.default_email�s����
(�%�-�-���NrWc�J������d��dS)Nr�r)r�)r�s�rU�default_namez'Actor._main_actor.<locals>.default_name�s"��� �=�?�?�(�(��-�-�a�0�0rWr�rj�user)r@rn�	conf_name�
conf_emailr\r��setattr�KeyErrorr�ri�getattr)
r�r�r�r��actorr��attr�evar�cvar�default�valr�r�s
           @@rU�_main_actorzActor._main_actor�sl�����b�"�
�
����	�s�	�	�	�	�	�	�	1�c�	1�	1�	1�	1�	1�	1��X�s�}�l�;�
�i����?�*
�	4�	4�%�D�$��g�
4��j��&����t�S�)�)�)�)���	
4�	
4�	
4� �,�(�+�/�/���=�=����$�(�(�(�%�g�i�i����(�����E�4��-�-�-��u�d�+�+�4��E�4�����3�3�3���	
4�����s6�
#A1�1C,�>B�C,�B,�)C,�+B,�,=C,�+C,c�D�|�|j|j|��S)a�
        :return: Actor instance corresponding to the configured committer. It behaves
            similar to the git implementation, such that the environment will override
            configuration values of config_reader. If no value is set at all, it will be
            generated
        :param config_reader: ConfigReader to use to retrieve the values from in case
            they are not set in the environment)r��env_committer_name�env_committer_email�r�r�s  rU�	committerzActor.committers!�����s�5�s�7N�P]�^�^�^rWc�D�|�|j|j|��S)zSame as committer(), but defines the main author. It may be specified in the environment,
        but defaults to the committer)r��env_author_name�env_author_emailr�s  rU�authorzActor.authors �����s�2�C�4H�-�X�X�XrWr[) rTrQrRrSrZr[r~r|r�r�r�r�r�r�rYrrnr$r
r�rprrrTrurwry�classmethodr�rr�r�r�r�rWrUr@r@�sI������)�)�
!�b�j��+�+�O�!�r�z�/�2�2��(�O�)��-��/���I��J�!�I��X�c�]��8�C�=��T�����E�C�E�D�E�E�E�E�#�C�#�D�#�#�#�#�-�#�-�-�-�-�.��.�.�.�.�A�#�A�A�A�A��'�#�'�'�'�'�'��[�'�(�
NR�	%�%��%��%��I�J�	%�

�%�%�%��[�%�N�_�_�e�,X�&Y�_�el�_�_�_��[�_��Y�Y�5�)U�#V�Y�bi�Y�Y�Y��[�Y�Y�YrWr@c�Z�eZdZdZdZdedeeeffd�Z	e
ddded	dfd
���ZdS)r;a�
    Represents stat information as presented by git at the end of a merge. It is
    created from the output of a diff operation.

    ``Example``::

     c = Commit( sha1 )
     s = c.stats
     s.total         # full-stat-dict
     s.files         # dict( filepath : stat-dict )

    ``stat-dict``

    A dictionary with the following keys and values::

      deletions = number of deleted lines as int
      insertions = number of inserted lines as int
      lines = total number of lines changed as int, or deletions + insertions

    ``full-stat-dict``

    In addition to the items in the stat-dict, it features additional information::

     files = number of changed files as int��total�filesr�r�c�"�||_||_dSr[r�)rNr�r�s   rUr$zStats.__init__@s����
���
�
�
rWrRr�textrKc��ddddd�id�}|���D]�}|�d��\}}}|dkrt|��pd}|dkrt|��pd}	|ddxx|z
cc<|ddxx|	z
cc<|dd	xx||	zz
cc<|dd
xxdz
cc<||	||	zd�}
|
|d
|���<��t	|d|d
��S)
zRCreate a Stat object from output retrieved by git-diff.

        :return: git.Statr)�
insertions�	deletions�linesr�r��	�-r�r�r�r�r�r)r�r�r�)�
splitlinesr�rTr�r;)r�rRr��hshr%�raw_insertions�
raw_deletions�filenamer�r��
files_dicts           rU�_list_from_stringzStats._list_from_stringDsa��%&�A��A�N�N��
�
���O�O�%�%�
	8�
	8�D�8<�
�
�4�8H�8H�5�^�]�H�'�3�.�F�3�~�3F�3F�K�!�J�%��,�C��]�1C�1C�H�q�I���L��&�&�&�*�4�&�&�&���L��%�%�%��2�%�%�%���L��!�!�!�Z�)�%;�;�!�!�!���L��!�!�!�Q�&�!�!�!�(�&�#�i�/�$�$�J�
.8�C��L����)�)�*�*��S��\�3�w�<�0�0�0rWN)
rTrQrRrSrYr'rr%r(r$r�rnr�r�rWrUr;r;#s�������/�/�2#�I��h��t�H�h�4F�/G������1�V�1�3�1�7�1�1�1��[�1�1�1rWr;c�Z�eZdZdZdZdeddfd�Zdedefd�Z	de
fd	�Zde
fd
�Zdefd�Z
dS)r<aWrapper around a file-like object that remembers the SHA1 of
    the data written to it. It will write a sha when the stream is closed
    or if the asked for explicitly using write_sha.

    Only useful to the indexfile

    :note: Based on the dulwich project)r��sha1r�rKNc�<�||_td��|_dS)NrW)r�r.r�)rNr�s  rUr$zIndexFileSHA1Writer.__init__ks������S�M�M��	�	�	rW�datac�j�|j�|��|j�|��Sr[)r�r;r�r|)rNr�s  rUr|zIndexFileSHA1Writer.writeos,���	��������v�|�|�D�!�!�!rWc�l�|j���}|j�|��|Sr[)r��digestr�r|�rN�shas  rU�	write_shazIndexFileSHA1Writer.write_shass.���i��� � ������S�����
rWc�`�|���}|j���|Sr[)r�r��closer�s  rUr�zIndexFileSHA1Writer.closexs%���n�n������������
rWc�4�|j���Sr[)r��tellr#s rUr�zIndexFileSHA1Writer.tell}s���v�{�{�}�}�rW)rTrQrRrSrYrr$rrTr|r(r�r�r�r�rWrUr<r<_s�������+�+��I�"�"�"��"�"�"�"�"�&�"�S�"�"�"�"��5�����
�u�����
�c������rWr<c�^�eZdZdZdZdeddfd�Zd
d�Zdefd�Z	de
fd	�Zd
d
�Zd
d�Z
d
d�ZdS)r?aProvides methods to obtain, check for, and release a file based lock which
    should be used to handle concurrent access to the same file.

    As we are a utility class to be derived from, we only use protected methods.

    Locks will automatically be released on destruction��
_file_path�
_owns_lock�	file_pathrKNc�"�||_d|_dS)NFr�)rNr�s  rUr$zLockFile.__init__�s��#�������rWc�.�|���dSr[)�
_release_lockr#s rU�__del__zLockFile.__del__�s���������rWc��d|jzS)z:return: Path to lockfilez%s.lock)r�r#s rU�_lock_file_pathzLockFile._lock_file_path�s���D�O�,�,rWc��|jS)z:return: True if we have a lock and if the lockfile still exists
        :raise AssertionError: if our lock-file does not exist)r�r#s rU�	_has_lockzLockFile._has_lock�s����rWc���|���rdS|���}tj|��rt	d|j�d|�d����	tjtjztj	z}tr|tjz}t
j||d��}t
j
|��n/#t$r"}t	t|����|�d}~wwxYwd|_dS)z�Create a lock file as flag for other instances, mark our instance as lock-holder

        :raise IOError: if a lock was already present or a lock file could not be writtenNzLock for file z did already exist, delete z in case the lock is illegalrT)r�r�rqrr�IOErrorr�r\�O_WRONLY�O_CREAT�O_EXCLr�
O_SHORT_LIVED�openr��OSErrorrnr�)rN�	lock_file�flags�fdr�s     rU�_obtain_lock_or_raisezLockFile._obtain_lock_or_raise�s����>�>���	��F��(�(�*�*�	��:�i� � �	��'��?�?�?�I�I�I�/���
�
	)��K�"�*�,�r�y�8�E��
*���)�)�����E�1�-�-�B��H�R�L�L�L�L���	)�	)�	)��#�a�&�&�/�/�q�(�����	)��������s�A&C�
C.�C)�)C.c�*�|���S)z�The default implementation will raise if a lock cannot be obtained.
        Subclasses may override this method to provide a different implementation)r�r#s rU�_obtain_lockzLockFile._obtain_lock�s���)�)�+�+�+rWc��|���sdS|���}	t|��n#t$rYnwxYwd|_dS)zRelease our lock if we have oneNF)r�r�rur�r�)rN�lfps  rUr�zLockFile._release_lock�si���~�~���	��F��"�"�$�$��	��3�K�K�K�K���	�	�	��D�	��������s�<�
A	�A	rO)rTrQrRrSrYr%r$r�rnr�r�r�r�r�r�r�rWrUr?r?�s�������;�;�-�I� �(� �t� � � � �����-��-�-�-�-��4�����
����0,�,�,�,�
 � � � � � rWr?c	�J��eZdZdZdZdefdedededdf�fd	�
Z	d�fd
�Z
�xZS)r>aThe lock file will block until a lock could be obtained, or fail after
    a specified timeout.

    :note: If the directory containing the lock was removed, an exception will
        be raised during the blocking period, preventing hangs as the lock
        can never be obtained.)�_check_interval�_max_block_timeg333333�?r��check_interval_s�max_block_time_srKNc�t��tt|���|��||_||_dS)aConfigure the instance

        :param check_interval_s:
            Period of time to sleep until the lock is checked the next time.
            By default, it waits a nearly unlimited time

        :param max_block_time_s: Maximum amount of seconds we may lockN)r`r>r$r�r�)rNr�r�r�ras    �rUr$zBlockingLockFile.__init__�s:���	���%�%�.�.�y�9�9�9�/���/����rWc�d��tj��}|t|j��z}		tt|�����dS#t$r�}tj��}tjtj	|�
������s,d|�
��||z
fz}t
|��|�||kr,d||z
|�
��fz}t
|��|�tj|j��Yd}~nd}~wwxYw��)z�This method blocks until it obtained the lock, or raises IOError if
        it ran out of time or if the parent directory was not available anymore.
        If this method returns, you are guaranteed to own the lockTzVDirectory containing the lockfile %r was not readable anymore after waiting %g secondsz Waited %g seconds for lock at %rN)
�timer<r�r`r>r�r�rqr�r�r��sleepr�)rN�	starttime�maxtimer��curtime�msgras      �rUr�zBlockingLockFile._obtain_lock�sK����I�K�K�	��e�D�$8�9�9�9��	�
��&��-�-�:�:�<�<�<�,���+�
1�
1�
1��)�+�+���y���T�-A�-A�-C�-C�!D�!D�E�E�.�r��,�,�.�.��)�+�v��C�"�#�,�,�A�-��g�%�%�<��)�+��,�,�.�.�@��C�"�#�,�,�A�-��
�4�/�0�0�0�0�0�0�0�0�����'
1����	s�'A�
D-�!CD(�(D-rO)rTrQrRrSrYrr%r<rTr$r�rcrds@rUr>r>�s��������"�"�7�I�
#&� '�	0�0��0� �0��	0�

�0�0�0�0�0�0�"���������rWr>c���eZdZdZdZddededdf�fd�
Zddededd	fd
�Zdede	fd�Z
dedefd
�Zde
eeeefdefd�Zde
eeeefdd	fd�Z�xZS)r=as
    List of iterable objects allowing to query an object by id or by named index::

     heads = repo.heads
     heads.master
     heads['master']
     heads[0]

    Iterable parent objects = [Commit, SubModule, Reference, FetchInfo, PushInfo]
    Iterable via inheritance = [Head, TagReference, RemoteReference]
    ]
    It requires an id_attribute name to be set which will be queried from its
    contained items to have a means for comparison.

    A prefix can be specified which is to be used in case the id returned by the
    items always contains a prefix that does not matter to the user, so it
    can be left out.��_id_attr�_prefixr��id_attr�prefixrKzIterableList[IterableObj]c�T��tt|���|��Sr[)r`r=�__new__)r�r�r�ras   �rUr�zIterableList.__new__s!����\�3�'�'�/�/��4�4�4rWNc�"�||_||_dSr[r�)rNr�r�s   rUr$zIterableList.__init__s����
�����rWr�c���	t�||��}|r|Sn#ttf$rYnwxYw	t	|tt|����dS#ttf$rYdSwxYw)NTF)�list�__contains__�AttributeError�	TypeErrorr�rrn)rNr��rvals   rUr�zIterableList.__contains__#s���	��$�$�T�4�0�0�D��
���
���	�*�	�	�	��D�	����
	��D�$�s�D�/�/�*�*�*��4���	�*�	�	�	��5�5�	���s�"�6�6�#A�A4�3A4c��|j|z}|D]}t||j��|kr|cS� t�||��Sr[)r�r�r�r��__getattribute__)rNr��items   rU�__getattr__zIterableList.__getattr__5sZ���|�d�"���	�	�D��t�T�]�+�+�t�3�3�����4��$�$�T�4�0�0�0rWrc�~�t|tttf��s
Jd���t|t��rt�||��St|t��rt
d���	t||��S#t$r }td|j
|zz��|�d}~wwxYw)N�-Index of IterableList should be an int or strzIndex should be an int or strzNo item found with id %r)rrTrn�slicer��__getitem__rr�r��
IndexErrorr�)rNrr�s   rUrzIterableList.__getitem__=s����%�#�s�E�!2�3�3�d�d�5d�d�d�3��e�S�!�!�	]��#�#�D�%�0�0�0�
��u�
%�
%�	]��<�=�=�=�
]��t�U�+�+�+��!�
]�
]�
]� �!;�t�|�e�?S�!T�U�U�[\�\�����
]���s�B�
B<�B7�7B<c��t|ttf��s
Jd���tt|��}t|t��sVd}|j|z}t|��D]"\}}t
||j��|kr|}n�#|dkrtd|z���t�
||��dS)Nr���zItem with name %s not found)rrTrnrr�rr�r�rr��__delitem__)rNr�delindexr�r?r�s      rUrzIterableList.__delitem__Ls����%�#�s��,�,�]�]�.]�]�]�,���U�#�#���%��%�%�
	G��H��<�%�'�D�$�T�?�?�
�
���4��4���/�/�4�7�7� �H��E�8�
�2�~�~� �!>��!E�F�F�F�	
����x�(�(�(�(�(rW)r�)rTrQrRrSrYrnr�r$�objectr�r�r*r�rr"rTrrrrcrds@rUr=r=sA���������$(�I�5�5�c�5�3�5�8S�5�5�5�5�5�5�����S��$��������D�����$1��1�
�1�1�1�1�]��}�c�5�#�'E�!F�]�=�]�]�]�]�)��}�c�5�#�'E�!F�)�4�)�)�)�)�)�)�)�)rWr=c�*�eZdZdZdedededdfd�ZdS)�IterableClassWatcherzMetaclass that watchesr��bases�clsdictrKNc��|D]:}t|��tkr tjd|�d�td����;dS)Nz!GitPython Iterable subclassed by zs. Iterable is deprecated due to naming clash since v3.1.18 and will be removed in 3.1.20, Use IterableObj instead 
�)�
stacklevel)�typer�warnings�warn�DeprecationWarning)r�r�rr
�bases     rUr$zIterableClassWatcher.__init__dse���		�		�D��D�z�z�1�1�1��
�1��1�1�1�'� �
�����		�		rW)rTrQrRrSrnrrr$r�rWrUrrasJ������ � �
�C�
��
��
��
�
�
�
�
�
rWrc	�j�eZdZdZdZdZedddededefd	���Zedddededefd
���Z	dS)�Iterablez�Defines an interface for iterable items which is to assure a uniform
    way to retrieve and iterate items within the git repositoryr�z5attribute that most suitably identifies your instancerRrrOrPrKc�v�t|j��}|�|j|g|�Ri|����|S)am
        Deprecated, use IterableObj instead.
        Find all items of this type - subclasses can specify args and kwargs differently.
        If no args are given, subclasses are obliged to return all items if no additional
        arguments arg given.

        :note: Favor the iter_items method as it will

        :return: list(Item,...) list of item instances�r=�_id_attribute_�extend�
iter_items�r�rRrOrP�out_lists     rU�
list_itemszIterable.list_itemsysG��%�S�%7�8�8��������t�=�d�=�=�=�f�=�=�>�>�>��rWc� �td����zbFor more information about the arguments, see list_items
        :return:  iterator yielding ItemszTo be implemented by Subclass��NotImplementedError�r�rRrOrPs    rUrzIterable.iter_items�s��
"�"A�B�B�BrWN)
rTrQrRrSrYrr�r
rrr�rWrUrrqs�������C�C��I�L�N���f��S��C��C�����[���C�f�C�S�C�C�C�C�C�C�C��[�C�C�CrWr)�	metaclassc��eZdZUdZdZeed<edddedede	e
fd	���Zeedddedede
e
fd
�����ZdS)r+z�Defines an interface for iterable items which is to assure a uniform
    way to retrieve and iterate items within the git repository

    Subclasses = [Submodule, Commit, Reference, PushInfo, FetchInfo, Remote]r�rrRrrOrPrKc�v�t|j��}|�|j|g|�Ri|����|S)a@
        Find all items of this type - subclasses can specify args and kwargs differently.
        If no args are given, subclasses are obliged to return all items if no additional
        arguments arg given.

        :note: Favor the iter_items method as it will

        :return: list(Item,...) list of item instancesrrs     rUrzIterableObj.list_items�sG��".�c�.@�!A�!A��������t�=�d�=�=�=�f�=�=�>�>�>��rWc� �td���r!r"r$s    rUrzIterableObj.iter_items�s��"�"A�B�B�BrWN)rTrQrRrSrYrnrUr�r
r=r*rrrrr�rWrUr+r+�s��������P�P�
�I�������f��S��C��L�Q^�D_�����[����C�f�C�S�C�C�C�H�]�D[�C�C�C��^��[�C�C�CrWr+c��eZdZdeddfd�ZdS)�NullHandler�recordrKNc��dSr[r�)rNr+s  rU�emitzNullHandler.emit�s���rW)rTrQrRr	r-r�rWrUr*r*�s6������
�6�
�d�
�
�
�
�
�
rWr*)rv)Fr[).)T)��abcr�os.pathrarq�compatr�
contextlib�	functoolsrr��loggingr\r�r�rZrorg�sysrr��urllib.parserr	r�typingr
rrr
rrrrrrrrrrrrrrr	�
git.remoter�
git.repo.baser�
git.configrr�gitr �typesr!r"r#r$r%r&r'r(r)r*�
gitdb.utilr.r/r0r1r2r3r4r5r6�__all__�	getLoggerrTr�r�r�rGrHrIrF�contextmanagerr`rErurTr7r8r�rnr9r�r�r:r�rBr�r�r�r[�Ir�rUr�r�r�r�r�rAr�rrrr	rCrDr@r;r<r?r>r=rrrr+�Handlerr*r�rWrU�<module>rBsH���������������������������������������	�	�	�	���������	�	�	�	�
�
�
�
���������������-�-�-�-�-�-�-�-���������������������������������������������*������!�!�!�!�!�!�"�"�"�"�"�"�=�=�=�=�=�=�=�=�������

�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
����u�5V�/W�cg�h�h�h�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�"����*�g���!�!��#�X�r�z�~�~�6Q�SW�'X�'X��#�Z��
���7S�UY�(Z�(Z���G�C�L�L���h�s�A�v�&��8�C��F�+;�����$�����i��$��(<�=�������/��/�d�/�/�/�/�,���d�����
�
��
�x�
�S�
�Z]�
�
�
�
� ���x��H�����$
�*�'�X�'�(�'�'�'�'�'�8�'��'�'�'�'��N�N�+�,�,�,�+�N�N��8�������*�N�,��,�h�,�8�,�,�,�,���(��T��d������X�c�]�������c���(�!3��t�C�y�����0$�h�s�m�$�3�$�3�$�$�$�$�.	��
�@�A�A�	f�	f�
��
�R�Z�)�*�*�Z�%�@��R�Z�!�"�"�Z�%�8��R�Z��b�d�#�#�&A�&A�D�I��R�Z����/�/�E�:�E��%��g�c�l�H�d�:�;�S�@�A�����#��#�����$�2�:�?�@�@��#�H�#��#�#�#�#�/1��$�s�H�T�N�*�+�0�0�0�
��$��7�5�>����
���
��(��t����
����%��h��"7��D�����@:�S�:�:�:�:�
�5��!1�3F�!F�G��SV��[_�����
���4��d��T����
���
���8��$������
���
	�	�5��x��(�	�t�	�x�PX�GY�	�	�	�	����
��$�s�)�����F{
�{
�{
�{
�{
�V�{
�{
�{
�|
(�
(�
(�
(�
(�^�
(�
(�
(�uY�uY�uY�uY�uY�F�uY�uY�uY�p91�91�91�91�91�F�91�91�91�x�����&����DD �D �D �D �D �v�D �D �D �N:�:�:�:�:�x�:�:�:�|X)�X)�X)�X)�X)�4�
�&�X)�X)�X)�v
�
�
�
�
�4�
�
�
� C�C�C�C�C�-�C�C�C�C�>�C�C�C�C�C�(�C�C���C�F
�
�
�
�
�'�/�
�
�
�
�
rW