Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/site-packages/pip/_internal/vcs/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/site-packages/pip/_internal/vcs/__pycache__/git.cpython-312.pyc

�

4ΜgG����ddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZmZm
Z
ddlmZmZddlmZmZmZddlmZddlmZmZmZmZmZmZmZej>j@Z ej>jBZ!ejDe#�Z$ejJd�Z&ejJd	�Z'ejJd
ejP�Z)de*de+fd
�Z,Gd�de�Z-ej\e-�y)�N)�replace)�List�Optional�Tuple)�
BadCommand�InstallationError)�
HiddenText�display_path�hide_url)�make_command)�AuthInfo�RemoteNotFoundError�RemoteNotValidError�
RevOptions�VersionControl�(find_path_to_project_root_from_repo_root�vcsz(^git version (\d+)\.(\d+)(?:\.(\d+))?.*$z^[a-fA-F0-9]{40}$a/^
    # Optional user, e.g. 'git@'
    (\w+@)?
    # Server, e.g. 'github.com'.
    ([^/:]+):
    # The server-side path. e.g. 'user/project.git'. Must start with an
    # alphanumeric character so as not to be confusable with a Windows paths
    # like 'C:/foo/bar' or 'C:\foo\bar'.
    (\w[^:]*)
    $�sha�returnc�>�ttj|��S�N)�bool�
HASH_REGEX�match)rs �@/usr/local/lib/python3.12/site-packages/pip/_internal/vcs/git.py�looks_like_hashr8s���
� � ��%�&�&�c
���eZdZdZdZdZdZdZdZe	de
dee
fd	��Zd
e
de
de
fd�Zdeed
ffd�Zede
dee
fd��Zede
de
deee
e
ffd��Zede
de
de
fd��Zede
d
ededefd��Zede
dee
de
fd��Zde
d
edededdf
d�Zde
d
ededdfd�Zde
d
ededdfd�Zede
de
fd��Ze	d
e
de
fd��Zede
de
de
fd��Z ed&de
dee
de
fd��Z!ede
dee
fd ��Z"ed
e
dee
ee
e#ff�fd!��Z$ede
ddfd"��Z%ede
dee
f�fd#��Z&e	d$e
de
fd%��Z'�xZ(S)'�Git�gitz.git�clone)zgit+httpz	git+httpszgit+sshzgit+gitzgit+file)�GIT_DIR�
GIT_WORK_TREE�HEAD�revrc��|gSr��r%s r�get_base_rev_argszGit.get_base_rev_argsLs	���u�r�url�destc���|jt|��\}}|jsy|j||j�syt	|j||j�d�}|S)NFr)�get_url_rev_optionsrr%�is_commit_id_equalr�get_revision_sha)�selfr*r+�_�rev_options�is_tag_or_branchs      r�is_immutable_rev_checkoutzGit.is_immutable_rev_checkoutPsi���1�1�(�3�-�@���;������&�&�t�[�_�_�=�� �� 5� 5�d�K�O�O� L�Q� O�P��#�#�#r.c���|jdgddd��}tj|�}|stj	d|�yt|j
d��t|j
d	��fS)
N�versionzgit versionFT)�command_desc�show_stdout�stdout_onlyzCan't parse git version: %sr'��)�run_command�GIT_VERSION_REGEXr�logger�warning�int�group)r0r6rs   r�get_git_versionzGit.get_git_version^sq���"�"�
�K�&���	#�
��"�'�'��0����N�N�8�'�B���E�K�K��N�#�S����Q��%8�9�9r�locationc��gd�}|j|ddd|��}|j�}|jd�r|td�dSy)zl
        Return the current branch, or None if HEAD isn't at a branch
        (e.g. detached HEAD).
        )zsymbolic-ref�-qr$�r:FT��extra_ok_returncodesr8r9�cwdzrefs/heads/N)r<�strip�
startswith�len)�clsrC�args�output�refs     r�get_current_branchzGit.get_current_branchksZ��.������!%����!�
���l�l�n���>�>�-�(��s�=�)�+�,�,�rc��|jd|g|ddd��}i}|j�jd�D]2}|jd�}|s�	|jdd	�
�\}}|||<�4d|��}d
|��}	|j|�}
|
�|
dfS|j|	�}
|
dfS#t$rt	d|����wxYw)z�
        Return (sha_or_none, is_branch), where sha_or_none is a commit hash
        if the revision names a remote branch or tag, otherwise None.

        Args:
          dest: the repository directory.
          rev: the revision name.
        zshow-refFT�ignore)rIr8r9�
on_returncode�
�
� r;)�maxsplitzunexpected show-ref line: zrefs/remotes/origin/z
refs/tags/)r<rJ�split�rstrip�
ValueError�get)rMr+r%rO�refs�line�ref_sha�ref_name�
branch_ref�tag_refrs           rr/zGit.get_revision_sha�s�����
������"�!�
�����L�L�N�(�(��.�D��;�;�t�$�D���
H�$(�J�J�s�Q�J�$?�!���%�D��N�/�,�C�5�1�
��s�e�$���h�h�z�"���?���;���h�h�w����U�|���!�
H�!�#=�d�X�!F�G�G�
H�s�B%�%B=c�f�|jd�ryt|�sy|j||�ryy)a$
        Return true if rev is a ref or is a commit that we don't have locally.

        Branches and tags are not considered in this method because they are
        assumed to be always available locally (which is a normal outcome of
        ``git clone`` and ``git fetch --tags``).
        zrefs/TF)rKr�
has_commit)rMr+r%s   r�
_should_fetchzGit._should_fetch�s2���>�>�'�"���s�#���>�>�$��$��rr2c	��|j}|�J�|j||�\}}|�$|j|�}t||r|nd��}|St	|�st
j
d|�|j||�s|S|jtdd||j��|��|j|d��}|j|�}|S)	z�
        Resolve a revision to a new RevOptions object with the SHA1 of the
        branch, tag, or ref if found.

        Args:
          rev_options: a RevOptions object.
        N)�branch_namez:Did not find branch or tag '%s', assuming revision or ref.�fetchrE�rI�
FETCH_HEADr()�arg_revr/�make_newrrr>r?rer<r�to_args�get_revision)rMr+r*r2r%r�	is_branchs       r�resolve_revisionzGit.resolve_revision�s����!�!�������-�-�d�C�8���Y��?�%�.�.�s�3�K�!�+�9�C�RV�X�K����s�#��N�N�L��
�
� � ��s�+���	�����$��[�-@�-@�-B�C��	�	
�
���t���6��!�*�*�3�/���r�namec�0�|sy|j|�|k(S)z�
        Return whether the current commit hash equals the given name.

        Args:
          dest: the repository directory.
          name: a string name.
        F)rn)rMr+rqs   rr.zGit.is_commit_id_equal�s ��������%��-�-r�	verbosityNc�`�|j�}tjd||t|��|dkrd}n
|dk(rd}nd}|j	�dk\r!|jt
dd	g|�|�|����n|jt
dg|�|�|����|jr�|j|||�}t|d
d�}tjd||�|�K|j||j�s�t
dd
|j��}|j||��nV|j|�|k7rBd|��}	dd|d|	g}|j||��n"|j|�}
|j|
�}tjd||j�|j!|�y)NzCloning %s%s to %sr)z--quietr:r')z	--verbosez
--progress)r;�r!z--filter=blob:nonergzRev options %s, branch_name %s�checkoutrErizorigin/z-bz--trackzResolved %s to commit %s)�
to_displayr>�infor
rBr<rr%rp�getattr�debugr.rmrQrnrl�update_submodules)r0r+r*r2rs�rev_display�flagsrg�cmd_args�track_branchrs           r�	fetch_newz
Git.fetch_news���"�,�,�.�����(�#�{�L��<N�O���>�%1�E�
�!�^��E�/�E����!�W�,�
�����(�����	�
��
�
���\�'�E�E�E�3�E��E�F��?�?��/�/��c�;�G�K�!�+�}�d�C�K��L�L�9�;��T��"��.�.�t�[�_�_�E�+�"��#�+�+�-� �H�
�$�$�X�4�$�8��(�(��.�+�=�")��
�6������ ���� � ��t� �4��#�#�D�)�C�%�.�.�s�3�K����.��[�_�_�E�	
���t�$rc��|jtdd|�|��tdd|j��}|j||��|j|�y)N�configzremote.origin.urlrirvrE)r<rrmr{�r0r+r*r2r~s     r�switchz
Git.switchEs_�������#6��<��	�	
� �
�D�+�2E�2E�2G�H������t��,����t�$rc�&�|j�dk\r|jgd�|��n|jddg|��|j|||�}tddd|j	��}|j||��|j|�y)N)r:�	)rhrEz--tagsrirhrE�resetz--hard)rBr<rprrmr{r�s     r�updatez
Git.updateOs������!�V�+����6�D��A����g�t�_�$��7��+�+�D�#�{�C�����4��9L�9L�9N�O������t��,����t�$rc�"�|jgd�ddd|��}|j�}	|d}|D]}|j	d�s�|}n|jd�d	}|j
|j��S#t$rt�wxYw)
z�
        Return URL of the first remote encountered.

        Raises RemoteNotFoundError if the repository does not have a remote
        url configured.
        )r�z--get-regexpzremote\..*\.urlrFFTrGrzremote.origin.url rWr:)r<�
splitlines�
IndexErrorrrKrY�_git_remote_to_pip_urlrJ)rMrC�stdout�remotes�found_remote�remoter*s       r�get_remote_urlzGit.get_remote_url]s������:�!%����!�
���#�#�%��	&�"�1�:�L��F�� � �!5�6�%����� � ��%�a�(���)�)�#�)�)�+�6�6���	&�%�%�	&�s�A>�>Bc��tjd|�r|Stjj	|�r#tj|�j�Stj|�}|r|jd�St|��)a8
        Convert a remote url from what git uses to what pip accepts.

        There are 3 legal forms **url** may take:

            1. A fully qualified url: ssh://git@example.com/foo/bar.git
            2. A local project.git folder: /path/to/bare/repository.git
            3. SCP shorthand for form 1: git@example.com:foo/bar.git

        Form 1 is output as-is. Form 2 must be converted to URI and form 3 must
        be converted to form 1.

        See the corresponding test test_git_remote_url_to_pip() for examples of
        sample inputs/outputs.
        z\w+://z
ssh://\1\2/\3)�rer�os�path�exists�pathlib�PurePath�as_uri�	SCP_REGEX�expandr)r*�	scp_matchs  rr�zGit._git_remote_to_pip_url{sq��"�8�8�I�s�#��J�
�7�7�>�>�#���#�#�C�(�/�/�1�1��O�O�C�(�	���#�#�$4�5�5�!�#�&�&rc�Z�	|jdddd|zg|d��y#t$rYywxYw)zU
        Check if rev is a commit that is available in the local repository.
        �	rev-parserEz--verifyzsha^F)rI�log_failed_cmdT)r<r)rMrCr%s   rrdzGit.has_commit�sG��
		��O�O��d�J����=��$�
�
���!�	��	�s��	*�*c�X�|�d}|jd|gdd|��}|j�S)Nr$r�FT�r8r9rI)r<rJ)rMrCr%�current_revs    rrnzGit.get_revision�sA���;��C��o�o�
�#�����	&�
��� � �"�"rc�\�|jddgdd|��j�}tjj	|�s tjj||�}tjj
tjj|d��}t||�S)z�
        Return the path to Python project root, relative to the repo root.
        Return None if the project root is in the repo root.
        r�z	--git-dirFTr�z..)r<rJr�r��isabs�join�abspathr)rMrC�git_dir�	repo_roots    r�get_subdirectoryzGit.get_subdirectory�s����/�/�
�+�&����	"�
�
�%�'�	��w�w�}�}�W�%��g�g�l�l�8�W�5�G��G�G�O�O�B�G�G�L�L��$�$?�@�	�7��)�L�Lrc���t|�\}}}}}|jd�r�|dt|jd��}|tj
j
|�jdd�jd�z}|jd�dz}	|d|	t||	d||||f�z}d|vr>d|vsJ�|jd	d
�}t�|�-|�\}}
}|jdd�}nt�|�-|�\}}
}||
|fS)
a9
        Prefixes stub URLs like 'user@hostname:user/repo.git' with 'ssh://'.
        That's required because although they use SSH they sometimes don't
        work with a ssh:// scheme (e.g. GitHub). But we need a scheme for
        parsing. Hence we remove it again afterwards and return it as a stub.
        �fileN�/�\�+r:z://zfile:zgit+z
git+ssh://zssh://�)�urlsplit�endswithrL�lstrip�urllib�request�url2pathnamer�find�
urlunsplit�super�get_url_rev_and_auth)
rMr*�scheme�netlocr��query�fragment�initial_slashes�newpath�
after_plusr%�	user_pass�	__class__s
            �rr�zGit.get_url_rev_and_auth�s*���19��
�-����e�X��?�?�6�"�"�#;�c�$�+�+�c�*:�&;�%;�<�O�%����(C�(C�D�(I�(Q�(Q��c�)��f�S�k��G� ���S�)�A�-�J���*�%�
��
��$�f�g�u�h�G�)��C�����#�%�%�%��+�+�f�l�3�C�"'�'�">�s�"C��C��i��+�+�h��+�C�"'�'�">�s�"C��C��i��C��"�"rc��tjjtjj|d��sy|j	gd�|��y)Nz.gitmodules)�	submoduler�z--initz--recursiverEri)r�r�r�r�r<)rMrCs  rr{zGit.update_submodules�s;���w�w�~�~�b�g�g�l�l�8�]�C�D�����B��	�	
rc���t�|�|�}|r|S	|jddg|dddd��}tjj|jd��S#t$rtjd|�Yyt$rYywxYw)	Nr�z--show-toplevelFT�raise)rIr8r9rTr�zKcould not determine if %s is under git control because git is not availablez
)r��get_repository_rootr<rr>rzrr�r��normpathrZ)rMrC�loc�rr�s    �rr�zGit.get_repository_root�s�����g�)�(�3����J�	�����/�0��!� �%�$�
 ��A�"�w�w������� 0�1�1���	��L�L�/��
�
� �	��	�s�A�B	�>B	�B	�repo_urlc��y)zEIn either https or ssh form, requirements must be prefixed with git+.Tr')r�s r�should_add_vcs_url_prefixzGit.should_add_vcs_url_prefix	s��rr))�__name__�
__module__�__qualname__rq�dirname�	repo_name�schemes�
unset_environ�default_arg_rev�staticmethod�strrr)rr4rr@rB�classmethodrrQr/rer	rrpr.r�r�r�r�r�rdrnr�r
r�r{r�r��
__classcell__)r�s@rrr<s0����D��G��I��G�1�M��O���s��t�C�y����$�S�$��$��$�:��s�C�x��:���#��(�3�-����0�+�C�+�c�+�e�H�S�M�4�<O�6P�+��+�Z����3��4����,�+��+�'�+�6@�+�	�+��+�Z�.�c�.��#��.�4�.��.�=%��=%�(�=%�7A�=%�NQ�=%�	
�=%�~%�3�%�Z�%�j�%�T�%�%�3�%�Z�%�j�%�T�%��7�c�7�c�7��7�:�'�C�'�C�'��'�<�
�#�
�C�
�D�
��
��	#�C�	#�h�s�m�	#�s�	#��	#��M��M���
�M��M�"�#�s�#�u�S�(�3�-��5Q�/R�#��#�<�
��
��
��
��2�3�2�8�C�=�2��2�0��C��D���rr)/�logging�os.pathr�r�r��urllib.parser��urllib.request�dataclassesr�typingrrr�pip._internal.exceptionsrr�pip._internal.utils.miscr	r
r�pip._internal.utils.subprocessr� pip._internal.vcs.versioncontrolr
rrrrrr�parser�r��	getLoggerr�r>�compiler=r�VERBOSEr�r�rrr�registerr'rr�<module>r�s������	����(�(�B�G�G�7�����<�<� � ��
�\�\�
$�
$�
�
��	�	�8�	$���B�J�J�����R�Z�Z�+�
,�
�
�B�J�J�		��J�J�
�	�'��'��'�P�.�P�f
����S�r

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists