403Webshell
Server IP : 127.0.0.1  /  Your IP : 216.73.216.109
Web Server : Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10
System : Windows NT DESKTOP-E5T4RUN 10.0 build 19045 (Windows 10) AMD64
User : SERVERWEB ( 0)
PHP Version : 8.1.10
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : OFF |  Perl : OFF |  Python : OFF |  Sudo : OFF |  Pkexec : OFF
Directory :  C:/cygwin64/lib/python3.6/site-packages/pip/_internal/vcs/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : C:/cygwin64/lib/python3.6/site-packages/pip/_internal/vcs/__pycache__/git.cpython-36.pyc
3

�N�a�E�@sddlZddlZddlZddlZddlZddlZddlm	Z	m
Z
mZddlm
Z
mZddlmZmZmZddlmZddlmZmZmZmZmZmZmZejjZejjZej e!�Z"ej#d�Z$ej#d�Z%ej#d	ej&�Z'e(e)d
�dd�Z*Gd
d�de�Z+ej,e+�dS)�N)�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�returncCsttj|��S)N)�bool�
HASH_REGEX�match)r�r�/usr/lib/python3.6/git.py�looks_like_hash7srcseZdZdZdZdZd@ZdAZdZe	e
ee
d�d
d��Ze
e
e
d�dd�Zeedfd�dd�Zee
ee
d�dd��Zee
e
eee
e
fd�dd��Zee
e
e
d�dd��Zee
eeed�dd ��Zee
ee
e
d!�d"d#��Ze
eed$d�d%d&�Ze
eed$d�d'd(�Ze
eed$d�d)d*�Zee
e
d�d+d,��Ze	e
e
d-�d.d/��Zee
e
e
d0�d1d2��Z edBe
ee
e
d0�d3d4��Z!ee
ee
d�d5d6��Z"ee
ee
ee
e#fd-��fd7d8��Z$ee
d$d�d9d:��Z%ee
ee
d��fd;d<��Z&e	e
e
d=�d>d?��Z'�Z(S)C�GitZgitz.git�clone�git+http�	git+https�git+ssh�git+git�git+file�GIT_DIR�
GIT_WORK_TREE�HEAD)�revrcCs|gS)Nr)r$rrr�get_base_rev_argsKszGit.get_base_rev_args)�url�destrcCsJ|jt|��\}}|jsdS|j||j�s.dSt|j||j�d�}|S)NFr)Zget_url_rev_optionsr	r$�is_commit_id_equalr�get_revision_sha)�selfr&r'�_�rev_optionsZis_tag_or_branchrrr�is_immutable_rev_checkoutOszGit.is_immutable_rev_checkout.)rcCsF|jdgddd�}tj|�}|s0tjd|�fStdd�|j�D��S)N�versionFT)�show_stdout�stdout_onlyzCan't parse git version: %scss|]}t|�VqdS)N)�int)�.0�crrr�	<genexpr>csz&Git.get_git_version.<locals>.<genexpr>)�run_command�GIT_VERSION_REGEXr�logger�warning�tuple�groups)r*r.rrrr�get_git_version]s
zGit.get_git_version)�locationrcCsDdddg}|j|d
dd|d�}|j�}|jd�r@|td�d	�Sd	S)zl
        Return the current branch, or None if HEAD isn't at a branch
        (e.g. detached HEAD).
        zsymbolic-refz-qr#�FT)�extra_ok_returncodesr/r0�cwdzrefs/heads/N)r=)r5�strip�
startswith�len)�clsr<�args�output�refrrr�get_current_branches


zGit.get_current_branch)r'r$rcCs�|jd|g|dddd�}i}xh|j�jd�D]V}|jd�}|s@q,y|jdd	d
�\}}Wn"tk
rxtd|����YnX|||<q,Wd|��}d
|��}	|j|�}
|
dk	r�|
dfS|j|	�}
|
dfS)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)r?r/r0�
on_returncode�
�
� �)�maxsplitzunexpected show-ref line: zrefs/remotes/origin/z
refs/tags/N)r5r@�split�rstrip�
ValueError�get)rCr'r$rEZrefs�lineZref_shaZref_nameZ
branch_refZtag_refrrrrr)~s.




zGit.get_revision_shacCs.|jd�rdSt|�sdS|j||�r*dSdS)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)rAr�
has_commit)rCr'r$rrr�
_should_fetch�s	
zGit._should_fetch)r'r&r,rcCs�|j}|dk	st�|j||�\}}|dk	rF|j|�}|r<|nd|_|St|�sZtjd|�|j||�sj|S|j	t
dd||j��|d�|j|dd�}|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.
        Nz:Did not find branch or tag '%s', assuming revision or ref.�fetchz-q)r?Z
FETCH_HEAD)r$)
Zarg_rev�AssertionErrorr)�make_new�branch_namerr7r8rUr5r
�to_args�get_revision)rCr'r&r,r$rZ	is_branchrrr�resolve_revision�s&

zGit.resolve_revision)r'�namercCs|sdS|j|�|kS)z�
        Return whether the current commit hash equals the given name.

        Args:
          dest: the repository directory.
          name: a string name.
        F)r[)rCr'r]rrrr(�s	zGit.is_commit_id_equalNc	Cs |j�}tjd||t|��|j�dkr@|jtddd||��n|jtdd||��|jr�|j|||�}t	|dd�}tj
d||�|dkr�|j||j�s�td	d|j��}|j||d
�n4|j
|�|kr�d|��}d	d|d
|g}|j||d
�n|j|�}|j|�}tjd||j�|j|�dS)NzCloning %s%s to %srM�rz--filter=blob:nonez-qrYzRev options %s, branch_name %s�checkout)r?zorigin/z-bz--trackzResolved %s to commit %s)rMr^)Z
to_displayr7�inforr;r5r
r$r\�getattr�debugr(rZrGr[rX�update_submodules)	r*r'r&r,Zrev_displayrY�cmd_argsZtrack_branchrrrr�	fetch_newsD




z
Git.fetch_newcCsB|jtdd|�|d�tdd|j��}|j||d�|j|�dS)N�configzremote.origin.url)r?r_z-q)r5r
rZrc)r*r'r&r,rdrrr�switch7s
z
Git.switchcCsp|j�d	kr"|jdddg|d�n|jddg|d�|j|||�}tddd|j��}|j||d�|j|�dS)
Nr=�	rVz-qz--tags)r?�resetz--hard)r=rh)r;r5r\r
rZrc)r*r'r&r,rdrrr�updateAsz
Git.updatecCs�|jdddgddd|d�}|j�}y|d}Wntk
rFt�YnXx|D]}|jd	�rN|}PqNW|jd
�d}|j|j��S)z�
        Return URL of the first remote encountered.

        Raises RemoteNotFoundError if the repository does not have a remote
        url configured.
        rfz--get-regexpzremote\..*\.urlr=FT)r>r/r0r?rzremote.origin.url rL)r=)r5�
splitlines�
IndexErrorrrArO�_git_remote_to_pip_urlr@)rCr<�stdoutZremotesZfound_remoteZremoter&rrr�get_remote_urlOs"



zGit.get_remote_url)r&rcCsNtjd|�r|Stjj|�r*tj|�j�Stj|�}|rB|j	d�St
|��dS)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/\3N)�rer�os�path�exists�pathlibZPurePathZas_uri�	SCP_REGEX�expandr
)r&Z	scp_matchrrrrmms

zGit._git_remote_to_pip_url)r<r$rcCs>y |jdddd|g|dd�Wntk
r4dSXdSdS)	zU
        Check if rev is a commit that is available in the local repository.
        z	rev-parsez-qz--verifyzsha^F)r?�log_failed_cmdTN)r5r)rCr<r$rrrrT�szGit.has_commitcCs*|dkrd}|jd|gdd|d�}|j�S)Nr#z	rev-parseFT)r/r0r?)r5r@)rCr<r$Zcurrent_revrrrr[�szGit.get_revisioncCsT|jddgdd|d�j�}tjj|�s4tjj||�}tjjtjj|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.
        z	rev-parsez	--git-dirFT)r/r0r?z..)r5r@rqrr�isabs�join�abspathr)rCr<Zgit_dirZ	repo_rootrrr�get_subdirectory�szGit.get_subdirectorycs�t|�\}}}}}|jd�r�|dt|jd���}|tjj|�jdd�jd�}|jd�d}	|d|	�t	||	d�||||f�}d|kr�d|ks�t
�|jd	d
�}t�j|�\}}
}|jdd�}nt�j|�\}}
}||
|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�endswithrB�lstrip�urllibZrequestZurl2pathname�replace�find�
urlunsplitrW�super�get_url_rev_and_auth)rCr&�schemeZnetlocrrZqueryZfragment�initial_slashes�newpathZ
after_plusr$Z	user_pass)�	__class__rrr��s 

zGit.get_url_rev_and_authcCs6tjjtjj|d��sdS|jdddddg|d�dS)Nz.gitmodulesZ	submodulerjz--initz--recursivez-q)r?)rqrrrsryr5)rCr<rrrrc�s
zGit.update_submodulescsxt�j|�}|r|Sy|jddg|ddddd�}Wn2tk
rRtjd|�dStk
rddSXtjj	|j
d��S)	Nz	rev-parsez--show-toplevelFT�raise)r?r/r0rIrwzKcould not determine if %s is under git control because git is not availablez
)r��get_repository_rootr5rr7rbrrqrr�normpathrP)rCr<�loc�r)r�rrr��s&zGit.get_repository_root)�repo_urlrcCsdS)zEIn either https or ssh form, requirements must be prefixed with git+.Tr)r�rrr�should_add_vcs_url_prefix�szGit.should_add_vcs_url_prefix)rrrrr )r!r")N))�__name__�
__module__�__qualname__r]�dirnameZ	repo_nameZschemesZ
unset_environZdefault_arg_rev�staticmethod�strrr%rr-rr1r;�classmethodrrGr)rUrrr\r(rergrjrormrTr[r{rr�rcr�r��
__classcell__rr)r�rr;s\ -+7
$r)-ZloggingZos.pathrqrtrpZurllib.parser�Zurllib.requestZtypingrrrZpip._internal.exceptionsrrZpip._internal.utils.miscrrr	Zpip._internal.utils.subprocessr
Z pip._internal.vcs.versioncontrolrrr
rrrr�parser�r�Z	getLoggerr�r7�compiler6r�VERBOSErur�rrr�registerrrrr�<module>s2$



I

Youez - 2016 - github.com/yon3zu
LinuXploit