관리-도구
편집 파일: git.cpython-38.pyc
U ʗRe�F � @ 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-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/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 eeedd �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/d0��Z!ee ee d�d1d2��Z"ee ee ee e#f d)�� fd3d4��Z$ee dd�d5d6��Z%ee ee d�� fd7d8��Z&e e e d9�d:d;��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 sH | j dgdddd�}t�|�}|s2t�d|� dS tdd � |�� D ��S ) N�versionzgit versionFT)�command_desc�show_stdout�stdout_onlyzCan't parse git version: %sr c s s | ]}t |�V qd S r )�int)�.0�cr r r � <genexpr>h s 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 sD dddg}| j |ddd|d�}|�� }|�d�r@|td�d � S d S ) zl Return the current branch, or None if HEAD isn't at a branch (e.g. detached HEAD). zsymbolic-ref�-qr �� FT��extra_ok_returncodesr0 r1 �cwdzrefs/heads/N)r6 �strip� startswith�len)�clsr= �args�output�refr r r �get_current_branchj s � zGit.get_current_branch)r% r! r c C s� | j d|g|dddd�}i }|�� �d�D ]V}|�d�}|s>q*z|jdd d �\}}W n" tk rv td|����Y nX |||<