관리-도구
편집 파일: git.cpython-39.pyc
a ��Re�E � @ s d dl Z d dlZd dlZd dlZd dlZd dlZd dlm Z m Z mZ d dlm Z mZ d dlmZmZmZ d dlmZ d dlmZmZmZmZmZmZmZ ejjZejjZe � e!�Z"e�#d�Z$e�#d�Z%e�#d ej&�Z'e(e)d �dd�Z*G d d� de�Z+e�,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�returnc C s t t�| ��S �N)�bool� HASH_REGEX�match)r � r ��/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/vcs/git.py�looks_like_hash7 s r c s e Zd ZdZdZdZdZdZdZe e ee d�dd ��Ze e e d �dd�Zeed f d�dd�Zee ee d�dd��Zee e eee e f d�dd��Zee e e d�dd��Zee eeed�dd��Zee ee e d�dd��Ze eedd�d d!�Ze eedd�d"d#�Ze eedd�d$d%�Zee e d�d&d'��Ze e e d(�d)d*��Zee e e d+�d,d-��Z ed;e ee e d+�d.d/��Z!ee ee d�d0d1��Z"ee ee ee e#f d(�� fd2d3��Z$ee dd�d4d5��Z%ee ee d�� fd6d7��Z&e e e d8�d9d:��Z'� Z(S )<�Git�gitz.git�clone)zgit+httpz git+httpszgit+sshzgit+gitzgit+file)�GIT_DIR� GIT_WORK_TREE�HEAD)�revr c C s | gS r r �r! r r r �get_base_rev_argsK s zGit.get_base_rev_args)�url�destr c C sJ | � t|��\}}|jsdS | �||j�s.dS t| �||j�d �}| S )NFr )�get_url_rev_optionsr r! �is_commit_id_equalr �get_revision_sha)�selfr$ r% �_�rev_options�is_tag_or_branchr r r �is_immutable_rev_checkoutO s zGit.is_immutable_rev_checkout.)r c C sF | j dgddd�}t�|�}|s0t�d|� dS tdd� |�� D ��S ) N�versionFT)�show_stdout�stdout_onlyzCan't parse git version: %sr c s s | ]}t |�V qd S r )�int)�.0�cr r r � <genexpr>c � z&Git.get_git_version.<locals>.<genexpr>)�run_command�GIT_VERSION_REGEXr �logger�warning�tuple�groups)r) r. r r r r �get_git_version] s zGit.get_git_version)�locationr c C sB g d�}| j |ddd|d�}|�� }|�d�r>|td�d� S dS )zl Return the current branch, or None if HEAD isn't at a branch (e.g. detached HEAD). )zsymbolic-ref�-qr �� FT��extra_ok_returncodesr/ r0 �cwdzrefs/heads/N)r6 �strip� startswith�len)�clsr= �args�output�refr r r �get_current_branche s � zGit.get_current_branch)r% r! r c C s� | j d|g|dddd�}i }|�� �d�D ]T}|�d�}|s>q*z|jdd d �\}}W n tyt td|����Y n0 |||<