HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/pip/_internal/vcs/__pycache__/subversion.cpython-310.pyc
o

��h.�@s�ddlmZddlZddlZddlZddlmZmZmZm	Z	m
Z
ddlmZm
Z
ddlmZmZmZmZmZe�e�Ze�d�Ze�d�Ze�d�Ze�d	�ZGd
d�de�Ze�e�dS)�)�annotationsN)�
HiddenText�display_path�is_console_interactive�is_installable_dir�split_auth_from_netloc)�CommandArgs�make_command)�AuthInfo�RemoteNotFoundError�
RevOptions�VersionControl�vcsz
url="([^"]+)"zcommitted-rev="(\d+)"z\s*revision="(\d+)"z<url>(.*)</url>cs�eZdZdZdZdZdZedDd	d
��Ze	dEd
d��Z
edFdd��ZedG�fdd��ZedH�fdd��Z
e	dId d!��ZedFd"d#��ZedJd%d&��ZedKd)d*��ZdLdM�fd/d0�
ZdNd2d3�ZdNd4d5�ZdOd6d7�ZdPd=d>�Z	?dQdPd@dA�Z	?dQdPdBdC�Z�ZS)R�
Subversion�svnz.svn�checkout)zsvn+sshzsvn+httpz	svn+httpszsvn+svnzsvn+file�
remote_url�str�return�boolcC�dS)NT�)�clsrrr�G/usr/local/lib/python3.10/dist-packages/pip/_internal/vcs/subversion.py�should_add_vcs_url_prefix%sz$Subversion.should_add_vcs_url_prefix�rev�	list[str]cCsd|gS)Nz-rr)rrrr�get_base_rev_args)szSubversion.get_base_rev_args�locationc	Cs�d}t�|�D]P\}}}|j|vrg|dd�<q|�|j�tj�||jd�}tj�|�s.q|�|�\}}||krD|dus?J�|d}n|rK|�|�sRg|dd�<qt	||�}qt
|�S)zR
        Return the maximum revision for all files under a given location
        rN�entries�/)�os�walk�dirname�remove�path�join�exists�_get_svn_url_rev�
startswith�maxr)	rr�revision�base�dirs�_�
entries_fn�dirurl�localrevrrr�get_revision-s$

zSubversion.get_revision�netloc�scheme�)tuple[str, tuple[str | None, str | None]]cs|dkrt��||�St|�S)z�
        This override allows the auth information to be passed to svn via the
        --username and --password options instead of via the URL.
        �ssh)�super�get_netloc_and_authr)rr3r4��	__class__rrr8JszSubversion.get_netloc_and_auth�url� tuple[str, str | None, AuthInfo]cs.t��|�\}}}|�d�rd|}|||fS)Nzssh://zsvn+)r7�get_url_rev_and_authr))rr;r�	user_passr9rrr=Ys

zSubversion.get_url_rev_and_auth�username�
str | None�password�HiddenText | NonercCs(g}|r
|d|g7}|r|d|g7}|S)Nz
--usernamez
--passwordr)r?rA�
extra_argsrrr�
make_rev_argsaszSubversion.make_rev_argscCsZ|}t|�s|}tj�|�}||krt�d|�t�t|�r|�|�\}}|dur+t�|S)NzMCould not find Python project for directory %s (tried all parent directories))rr!r%r#�logger�warningrr()rr�
orig_location�
last_locationr;�_revrrr�get_remote_urlks��
zSubversion.get_remote_url�tuple[str | None, int]cCs�ddlm}tj�||jd�}tj�|�r.t|��}|��}Wd�n1s(wYnd}d}|�	d�rXt
ttj
|�d���}|dd=|dd}dd	�|D�dg}n\|�	d
�r~t�|�}	|	sktd|����|	�d�}d
d	�t�|�D�dg}n6z'|jdd|gddd�}
t�|
�}	|	dus�J�|	�d�}dd	�t�|
�D�}Wn|y�dg}}Ynw|r�t|�}||fSd}||fS)Nr)�InstallationErrorr�)�8�9�10z

�cSs,g|]}t|�dkr|drt|d��qS)�	)�len�int)�.0�drrr�
<listcomp>�s,z/Subversion._get_svn_url_rev.<locals>.<listcomp>z<?xmlzBadly formatted data: �cS�g|]	}t|�d���qS�rX�rT�group�rU�mrrrrW���infoz--xmlFT��show_stdout�stdout_onlycSrYrZr[r]rrrrW�r_)�pip._internal.exceptionsrLr!r%r&r#r'�open�readr)�list�mapr�
splitlines�split�_svn_xml_url_re�search�
ValueErrorr\�_svn_rev_re�finditer�run_command�_svn_info_xml_url_re�_svn_info_xml_rev_rer*)rrrL�entries_path�f�datar;r�revs�match�xmlrrrrr(�sL

��




�

��zSubversion._get_svn_url_rev�dest�namecCr)z&Always assume the versions don't matchFr)rryrzrrr�is_commit_id_equal�szSubversion.is_commit_id_equalN�use_interactive�bool | None�Nonecs(|durt�}||_d|_t���dS�N)rr|�_vcs_versionr7�__init__)�selfr|r9rrr��s
zSubversion.__init__�tuple[int, ...]cCszd}|jdgddd�}|�|�sdS|t|�d���d}|�d	�d�d
�}z
ttt|��}W|Sty<YdSw)aQuery the version of the currently installed Subversion client.

        :return: A tuple containing the parts of the version information or
            ``()`` if the version returned from ``svn`` could not be parsed.
        :raises: BadCommand: If ``svn`` is not installed.
        z
svn, version z	--versionFTrarNr�-�.)	rpr)rSrj�	partition�tuplerhrTrm)r��version_prefix�version�version_list�parsed_versionrrr�call_vcs_version�s
��zSubversion.call_vcs_versioncCs"|jdur|jS|��}||_|S)a�Return the version of the currently installed Subversion client.

        If the version of the Subversion client has already been queried,
        a cached value will be used.

        :return: A tuple containing the parts of the version information or
            ``()`` if the version returned from ``svn`` could not be parsed.
        :raises: BadCommand: If ``svn`` is not installed.
        N)r�r�)r��vcs_versionrrr�get_vcs_version�s


zSubversion.get_vcs_versioncCs&|jsdgS|��}|dkrdgSgS)aCReturn options to be used on calls to Subversion that contact the server.

        These options are applicable for the following ``svn`` subcommands used
        in this class.

            - checkout
            - switch
            - update

        :return: A list of command line arguments to pass to ``svn``.
        z--non-interactive)rX�z--force-interactive)r|r�)r��svn_versionrrr�get_remote_call_options�s	z"Subversion.get_remote_call_optionsr�rev_optionsr�	verbosityrTcCsf|��}t�d||t|��|dkrdg}ng}tdg|�|���|���|�|�R�}|�|�dS)NzChecking out %s%s to %srz--quietr)�
to_displayrEr`rr	r��to_argsrp)r�ryr;r�r��rev_display�flags�cmd_argsrrr�	fetch_news0�������zSubversion.fetch_newrcCs&td|��|��||�}|�|�dS)N�switch�r	r�r�rp�r�ryr;r�r�r�rrrr�/s�zSubversion.switchcCs$td|��|��|�}|�|�dS)N�updater�r�rrrr�?s�zSubversion.update)rrrr)rrrr)rrrr)r3rr4rrr5)r;rrr<)r?r@rArBrr)rrrrK)ryrrzr@rrr)r|r}rr~)rr�)rr)
ryrr;rr�rr�rTrr~)r)�__name__�
__module__�__qualname__rzr#�	repo_name�schemes�classmethodr�staticmethodrr2r8r=rDrJr(r{r�r�r�r�r�r�r��
__classcell__rrr9rrs@	1



��r)�
__future__r�loggingr!�re�pip._internal.utils.miscrrrrr�pip._internal.utils.subprocessrr	� pip._internal.vcs.versioncontrolr
rrr
r�	getLoggerr�rE�compilerkrnrrrqr�registerrrrr�<module>s 




2