a ReL-@sddlZddlZddlZddlmZmZmZddlmZm Z m Z m Z m Z ddl mZmZddlmZmZmZmZmZeeZedZedZedZed ZGd d d eZeedS) 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 seZdZdZdZdZdZeee dddZ e ee edd d Z eeed d d Zeeeeeeeeeeffdfdd Zeeeeeeefdfdd Ze eeeeedddZeeed ddZeeeeeefd ddZeeeee dddZd1e ddfd d! Zeed"fd#d$d%Zeed"fd#d&d'Zed#d(d)Zeeedd*d+d,Z eeedd*d-d.Z!eeedd*d/d0Z"Z#S)2 Subversionsvnz.svncheckout)zsvn+sshzsvn+httpz svn+httpszsvn+svnzsvn+file) remote_urlreturncCsdS)NT)clsrrr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/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}t|D]\}}}|j|vr0g|dd<q||jtj||jd}tj|s\q||\}}||kr|dus~J|d}n|r||sg|dd<qt ||}qt |S)zR Return the maximum revision for all files under a given location rNentries/) oswalkdirnameremovepathjoinexists_get_svn_url_rev startswithmaxstr) rrrevisionbasedirs_ entries_fndirurllocalrevrrr get_revision,s$        zSubversion.get_revision)netlocschemercs|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)superget_netloc_and_authr )rr2r3 __class__rrr6IszSubversion.get_netloc_and_auth)urlrcs.t|\}}}|dr$d|}|||fS)Nzssh://zsvn+)r5get_url_rev_and_authr')rr9r user_passr7rrr:Xs zSubversion.get_url_rev_and_auth)usernamepasswordrcCs(g}|r|d|g7}|r$|d|g7}|S)Nz --usernamez --passwordr)r<r= extra_argsrrr make_rev_args`s   zSubversion.make_rev_argscCsT|}t|s6|}tj|}||krtd|tq||\}}|durPt|S)NzMCould not find Python project for directory %s (tried all parent directories))rrr#r!loggerwarningr r&)rr orig_location last_locationr9_revrrrget_remote_urlls zSubversion.get_remote_urlc Csddlm}tj||jd}tj|r\t|}|}Wdq`1sP0Ynd}d}| ds| ds| drt t t j |d}|dd=|dd }d d |Ddg}n| d rt|} | std || d}dd t|Ddg}npzP|jdd|gddd} t| } | dusBJ| d}dd t| D}Wn|ydg}}Yn0|rt|} nd} || fS)Nr)InstallationErrorr8910z cSs,g|]$}t|dkr|drt|dqS) )lenint).0drrr z/Subversion._get_svn_url_rev..zs     "