£Á°èZ¨Ä…–K§‚«“ô4“ÒÙ´dîfUÙÃÅ WKbyÊ¦•êŽ…È®FÒ¿ÊÎóCozá¬S@6{Í:›œêZÌ:Š•_%:¢¾¾~;‘Ã~èŠ©ÊÇí`ÔÑ©úë™µ'5I¿fš×WO%ø9¾«¾DK|€ùÍD”Ýs]nHÕ¶ê×Ó¼ãžªéUWŸÈË%DÒÕ¬ï‘]/Åcx  ‰ï2ß]ä6G[]S£ÔÏ¯rs{úëóµmÒï#UQxo·õÞCe]"±/aÙ&Eã4ú9Jé_ÞåëdãöKë)AÞ                  ¯¹ægƒÛowÐø^d™ý½ßB7áyMä9ÜÖUã
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
<html>
B
    Reo0                 @   s   d dl mZ d dlZd dlZd dlZd dlmZ d dlmZm	Z	m
Z
mZ d dlmZ d dlmZ d dlmZmZ edZed	Zed
ZedZerd dlmZmZ d dlmZ d dlmZ d dlmZmZ ee Z!G dd deZ"e#e" dS )    )absolute_importN)
indent_log)display_pathis_console_interactivermtreesplit_auth_from_netloc)make_command)MYPY_CHECK_RUNNING)VersionControlvcszurl="([^"]+)"zcommitted-rev="(\d+)"z\s*revision="(\d+)"z<url>(.*)</url>)OptionalTuple)CommandArgs)
HiddenText)AuthInfo
RevOptionsc                   s   e Zd ZdZdZdZdZedd Ze	dd Z
ed	d
 Ze fddZe fddZe	dd Zedd Zedd Zedd Zd( fdd	Zdd Zdd Zdd Zd d! Zd"d# Zd$d% Zd&d' Z  ZS ))
Subversionsvnz.svncheckout)r   zsvn+sshzsvn+httpz	svn+httpszsvn+svnc             C   s   dS )NT )cls
remote_urlr   r   /builddir/build/BUILDROOT/alt-python37-pip-20.2.4-6.el8.x86_64/opt/alt/python37/lib/python3.7/site-packages/pip/_internal/vcs/subversion.pyshould_add_vcs_url_prefix+   s    z$Subversion.should_add_vcs_url_prefixc             C   s   d| gS )Nz-rr   )revr   r   r   get_base_rev_args/   s    zSubversion.get_base_rev_argsc       	      C   s   d}xt |D ]\}}}| j|kr2g |dd< q|| j t j|| jd}t j|s^q| |\}}||kr~|d }n|r||sg |dd< qt	||}qW |S )zR
        Return the maximum revision for all files under a given location
        r   Nentries/)
oswalkdirnameremovepathjoinexists_get_svn_url_rev
startswithmax)	r   locationrevisionbasedirs_
entries_fndirurllocalrevr   r   r   get_revision3   s"    

zSubversion.get_revisionc                s"   |dkrt t| ||S t|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)superr   get_netloc_and_authr   )r   netlocscheme)	__class__r   r   r3   O   s    zSubversion.get_netloc_and_authc                s2   t t| |\}}}|dr(d| }|||fS )Nzssh://zsvn+)r2   r   get_url_rev_and_authr&   )r   urlr   	user_pass)r6   r   r   r7   \   s    
zSubversion.get_url_rev_and_authc             C   s(   g }| r|d| g7 }|r$|d|g7 }|S )Nz
--usernamez
--passwordr   )usernamepassword
extra_argsr   r   r   make_rev_argse   s    zSubversion.make_rev_argsc             C   sV   |}xBt jt j|dsF|}t j|}||krtd| d S qW | |d S )Nzsetup.pyzGCould not find setup.py for directory %s (tried all parent directories)r   )r   r"   r$   r#   r    loggerwarningr%   )r   r(   orig_locationlast_locationr   r   r   get_remote_urlp   s    zSubversion.get_remote_urlc          	   C   sr  ddl m} tj|| jd}tj|rHt|}| }W d Q R X nd}|	dsj|	dsj|	drt
ttj|d}|d d= |d d	 }d
d |D dg }n|	drt|}|stdjf t |d}dd t|D dg }nZy8| dd|g}	t|	d}dd t|	D }W n  |k
rT   d g  }}Y nX |rft|}
nd}
||
fS )Nr   )SubProcessErrorr    8910z

   c             S   s,   g | ]$}t |d kr|d  rt|d  qS )	   )lenint).0dr   r   r   
<listcomp>   s    z/Subversion._get_svn_url_rev.<locals>.<listcomp>z<?xmlzBadly formatted data: {data!r}   c             S   s   g | ]}t |d qS )rO   )rK   group)rL   mr   r   r   rN      s    infoz--xmlc             S   s   g | ]}t |d qS )rO   )rK   rP   )rL   rQ   r   r   r   rN      s    )pip._internal.exceptionsrC   r   r"   r#   r    r$   openreadr&   listmapstr
splitlinessplit_svn_xml_url_research
ValueErrorformatlocalsrP   _svn_rev_refinditerrun_command_svn_info_xml_url_re_svn_info_xml_rev_rer'   )r   r(   rC   entries_pathfdatar8   revsmatchxmlr   r   r   r   r%      s>    








zSubversion._get_svn_url_revc             C   s   dS )z&Always assume the versions don't matchFr   )r   destnamer   r   r   is_commit_id_equal   s    zSubversion.is_commit_id_equalNc                s,   |d krt  }|| _d | _tt|   d S )N)r   use_interactive_vcs_versionr2   r   __init__)selfrn   )r6   r   r   rp      s
    zSubversion.__init__c             C   sv   d}|  dg}||sdS |t|d  d }|dd d}yttt|}W n tk
rp   dS X |S )a  Query 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	--versionr   Nr   -.)	rb   r&   rJ   rZ   	partitiontuplerW   rK   r]   )rq   version_prefixversionversion_listparsed_versionr   r   r   call_vcs_version   s    
zSubversion.call_vcs_versionc             C   s"   | j dk	r| j S |  }|| _ |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)ro   rz   )rq   vcs_versionr   r   r   get_vcs_version   s
    
zSubversion.get_vcs_versionc             C   s&   | j sdgS |  }|dkr"dgS g S )aX  Return 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
            - export
            - switch
            - update

        :return: A list of command line arguments to pass to ``svn``.
        z--non-interactive)rO      z--force-interactive)rn   r|   )rq   svn_versionr   r   r   get_remote_call_options   s    	z"Subversion.get_remote_call_optionsc          	   C   sh   |  |\}}td|| t < tj|r8t| td| 	 |
 ||}| | W dQ R X dS )z@Export the svn repository at the url to the destination locationz!Exporting svn repository %s to %sexportN)get_url_rev_optionsr>   rR   r   r   r"   r$   r   r   r   to_argsrb   )rq   r(   r8   rev_optionscmd_argsr   r   r   r     s    zSubversion.exportc             C   sD   |  }td||t| tdd|  | ||}| | d S )NzChecking out %s%s to %sr   z-q)
to_displayr>   rR   r   r   r   r   rb   )rq   rk   r8   r   rev_displayr   r   r   r   	fetch_new0  s    

zSubversion.fetch_newc             C   s&   t d|  | ||}| | d S )Nswitch)r   r   r   rb   )rq   rk   r8   r   r   r   r   r   r   ?  s    zSubversion.switchc             C   s$   t d|  | |}| | d S )Nupdate)r   r   r   rb   )rq   rk   r8   r   r   r   r   r   r   G  s    zSubversion.update)N)__name__
__module____qualname__rl   r    	repo_nameschemesclassmethodr   staticmethodr   r0   r3   r7   r=   rB   r%   rm   rp   rz   r|   r   r   r   r   r   __classcell__r   r   )r6   r   r   %   s*   	2!r   )$
__future__r   loggingr   repip._internal.utils.loggingr   pip._internal.utils.miscr   r   r   r   pip._internal.utils.subprocessr   pip._internal.utils.typingr	    pip._internal.vcs.versioncontrolr
   r   compiler[   r`   rd   rc   typingr   r   r   r   r   r   	getLoggerr   r>   r   registerr   r   r   r   <module>   s,   




  -