3 igL-@sddlZddlZddlZddlmZmZmZddlmZm Z m Z m Z m Z ddl mZmZddlmZmZmZmZmZejeZejdZejdZejdZejd ZGd d d eZejedS) N)ListOptionalTuple) HiddenText display_pathis_console_interactiveis_installable_dirsplit_auth_from_netloc) CommandArgs make_command)AuthInfoRemoteNotFoundError RevOptionsVersionControlvcsz url="([^"]+)"zcommitted-rev="(\d+)"z\s*revision="(\d+)"z(.*)c seZdZdZdZdZd5Zeee d d d Z e ee ed d dZ eeedddZeeeeeeeeeeffdfdd Zeeeeeeefdfdd Ze eeeeedddZeeedddZeeeeeefdddZeeeee dd d!Zd6e d"d#fd$d% Zeed&fd'd(d)Zeed&fd'd*d+Zed'd,d-Zeeed"d.d/d0Z eeed"d.d1d2Z!eeed"d.d3d4Z"Z#S)7 Subversionsvnz.svncheckoutsvn+sshsvn+http svn+httpssvn+svnsvn+file) remote_urlreturncCsdS)NT)clsrrr;/tmp/pip-build-88gy_88q/pip/pip/_internal/vcs/subversion.pyshould_add_vcs_url_prefix$sz$Subversion.should_add_vcs_url_prefix)revrcCsd|gS)Nz-rr)rrrrget_base_rev_args(szSubversion.get_base_rev_args)locationrc Csd}xtj|D]\}}}|j|kr2g|dd<q|j|jtjj||jd}tjj|s^q|j|\}}||kr|dk st|d}n | s|j | rg|dd<qt ||}qWt |S)zR Return the maximum revision for all files under a given location rNentries/) oswalkdirnameremovepathjoinexists_get_svn_url_revAssertionError startswithmaxstr) rr!revisionbasedirs_ entries_fndirurllocalrevrrr get_revision,s$       zSubversion.get_revision)netlocschemercs|dkrtj||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)superget_netloc_and_authr )rr8r9) __class__rrr<IszSubversion.get_netloc_and_auth)urlrcs.tj|\}}}|jdr$d|}|||fS)Nzssh://zsvn+)r;get_url_rev_and_authr-)rr>r user_pass)r=rrr?Xs zSubversion.get_url_rev_and_auth)usernamepasswordrcCs(g}|r|d|g7}|r$|d|g7}|S)Nz --usernamez --passwordr)rArB extra_argsrrr make_rev_args`s   zSubversion.make_rev_argscCsX|}x4t|s8|}tjj|}||krtjd|tqW|j|\}}|dkrTt|S)NzMCould not find Python project for directory %s (tried all parent directories))rr$r(r&loggerwarningr r+)rr! orig_location last_locationr>Z_revrrrget_remote_urlls  zSubversion.get_remote_urlc Csddlm}tjj||jd}tjj|rHt|}|j}WdQRXnd}d}|j dsn|j dsn|j drt t t j |jd}|dd=|dd }d d |Ddg}n|j d rtj|} | std || jd}dd tj|Ddg}nryP|jdd|gddd} tj| } | dk s,t| jd}dd tj| D}Wn |k rldg}}YnX|r~t|} nd} || fS)Nr)InstallationErrorr"8910z cSs,g|]$}t|dkr|drt|dqS) )lenint).0drrr sz/Subversion._get_svn_url_rev..zr"revsmatchxmlrrrrr+sB           zSubversion._get_svn_url_rev)destnamercCsdS)z&Always assume the versions don't matchFr)rrprqrrris_commit_id_equalszSubversion.is_commit_id_equalN)use_interactivercs(|dkrt}||_d|_tjdS)N)rrs _vcs_versionr;__init__)selfrs)r=rrrus zSubversion.__init__.)rc Cs|d}|jdgddd}|j|s$fS|t|djd}|jddjd }yttt|}Wntk rvfSX|S) 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 --versionFT)rZr[Nr-.) rgr-rQra partitiontupler_rRrd)rvZversion_prefixversionZ version_listparsed_versionrrrcall_vcs_versions zSubversion.call_vcs_versioncCs"|jdk r|jS|j}||_|S)aReturn 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)rtr})rvZ vcs_versionrrrget_vcs_versions zSubversion.get_vcs_versioncCs&|js dgS|j}|dkr"dgSgS)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-interactiverVz--force-interactive)rVr)rsr~)rvZ svn_versionrrrget_remote_call_optionss  z"Subversion.get_remote_call_options)rpr> rev_optionsrcCsD|j}tjd||t|tdd|j|j||}|j|dS)NzChecking out %s%s to %srz-q)Z to_displayrErYrr rto_argsrg)rvrpr>r rev_displaycmd_argsrrr fetch_news zSubversion.fetch_newcCs&td|j|j||}|j|dS)Nswitch)r rrrg)rvrpr>rrrrrr*szSubversion.switchcCs$td|j|j|}|j|dS)Nupdate)r rrrg)rvrpr>rrrrrr4s zSubversion.update)rrrrr)N)$__name__ __module__ __qualname__rqr& repo_nameschemes classmethodr/boolr staticmethodrr r7rrr<r r?rr rDrIrRr+rrrur}r~rrrrr __classcell__rr)r=rrs>, $  1 r) loggingr$reZtypingrrrZpip._internal.utils.miscrrrrr Zpip._internal.utils.subprocessr r Z pip._internal.vcs.versioncontrolr r rrr getLoggerrrEcompilerbrerirhrregisterrrrrs     "