3 Reo0@sddlmZddlZddlZddlZddlmZddlmZm Z m Z m Z ddl m Z ddlmZddlmZmZejdZejd Zejd Zejd Zerdd lmZmZdd l mZddlmZddlmZmZeje Z!GdddeZ"ej#e"dS))absolute_importN) indent_log) display_pathis_console_interactivermtreesplit_auth_from_netloc) make_command)MYPY_CHECK_RUNNING)VersionControlvcsz url="([^"]+)"zcommitted-rev="(\d+)"z\s*revision="(\d+)"z(.*))OptionalTuple) CommandArgs) HiddenText)AuthInfo RevOptionscseZdZdZdZdZd+Zedd Ze d d Z ed d Z efddZ efddZ e ddZeddZeddZeddZd,fdd ZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*ZZS)- Subversionsvnz.svncheckoutsvn+sshsvn+http svn+httpssvn+svncCsdS)NT)cls remote_urlrr/builddir/build/BUILDROOT/alt-python36-pip-20.2.4-5.el9.x86_64/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/vcs/subversion.pyshould_add_vcs_url_prefix+sz$Subversion.should_add_vcs_url_prefixcCsd|gS)Nz-rr)revrrrget_base_rev_args/szSubversion.get_base_rev_argsc Csd}xtj|D]\}}}|j|kr2g|dd<q|j|jtjj||jd}tjj|s^q|j|\}}||kr~|d}n | s|j| rg|dd<qt ||}qW|S)zR Return the maximum revision for all files under a given location rNentries/) oswalkdirnameremovepathjoinexists_get_svn_url_rev startswithmax) rlocationrevisionbasedirs_ entries_fndirurllocalrevrrr get_revision3s"      zSubversion.get_revisioncs"|dkrtt|j||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)superrget_netloc_and_authr)rnetlocscheme) __class__rrr7OszSubversion.get_netloc_and_authcs2tt|j|\}}}|jdr(d|}|||fS)Nzssh://zsvn+)r6rget_url_rev_and_authr*)rurlr user_pass)r:rrr;\s zSubversion.get_url_rev_and_authcCs(g}|r|d|g7}|r$|d|g7}|S)Nz --usernamez --passwordr)usernamepassword extra_argsrrr make_rev_argses   zSubversion.make_rev_argscCsV|}xBtjjtjj|dsF|}tjj|}||krtjd|dSqW|j|dS)Nzsetup.pyzGCould not find setup.py for directory %s (tried all parent directories)r)r"r&r(r'r$loggerwarningr))rr, orig_location last_locationrrrget_remote_urlps zSubversion.get_remote_urlc Csrddlm}tjj||jd}tjj|rHt|}|j}WdQRXnd}|j dsj|j dsj|j drt t t j |jd}|dd=|dd }d d |Ddg}n|j d rtj|}|std jft|jd}dd tj|Ddg}nZy8|jdd|g} tj| jd}dd tj| D}Wn |k rTdg}}YnX|rft|} nd} || fS)Nr)SubProcessErrorr 8910z cSs,g|]$}t|dkr|drt|dqS) )lenint).0drrr sz/Subversion._get_svn_url_rev..z             zSubversion._get_svn_url_revcCsdS)z&Always assume the versions don't matchFr)rdestnamerrris_commit_id_equalszSubversion.is_commit_id_equalNcs,|dkrt}||_d|_tt|jdS)N)ruse_interactive _vcs_versionr6r__init__)selfrr)r:rrrts zSubversion.__init__c Csvd}|jdg}|j|sfS|t|djd}|jddjd}yttt|}Wntk rpfSX|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 --versionNr-.) rfr*rNr^ partitiontupler[rOra)ruversion_prefixversion 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)rsr~)ru vcs_versionrrrget_vcs_versions zSubversion.get_vcs_versioncCs&|js dgS|j}|dkr"dgSgS)aXReturn 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-interactiverSz--force-interactive)rSr)rrr)ru svn_versionrrrget_remote_call_optionss  z"Subversion.get_remote_call_optionsc Csh|j|\}}tjd||t<tjj|r8t|td|j |j ||}|j |WdQRXdS)z@Export the svn repository at the url to the destination locationz!Exporting svn repository %s to %sexportN) get_url_rev_optionsrBrVrr"r&r(rrrto_argsrf)rur,r< rev_optionscmd_argsrrrrs zSubversion.exportcCsD|j}tjd||t|tdd|j|j||}|j|dS)NzChecking out %s%s to %srz-q) to_displayrBrVrrrrrf)ruror<r rev_displayrrrr fetch_new0s  zSubversion.fetch_newcCs&td|j|j||}|j|dS)Nswitch)rrrrf)ruror<rrrrrr?szSubversion.switchcCs$td|j|j|}|j|dS)Nupdate)rrrrf)ruror<rrrrrrGszSubversion.update)rrrrr)N)__name__ __module__ __qualname__rpr$ repo_nameschemes classmethodr staticmethodrr4r7r;rArFr)rqrtr~rrrrrr __classcell__rr)r:rr%s*      2 !r)$ __future__rloggingr"repip._internal.utils.loggingrpip._internal.utils.miscrrrrpip._internal.utils.subprocessrpip._internal.utils.typingr pip._internal.vcs.versioncontrolr r compiler_rdrhrgtypingr r rrrr getLoggerrrBrregisterrrrrs,           -