Re*@sddlmZddlZddlZddlmZddlmZmZddl m Z ddl m Z ddl mZddlmZdd lmZdd lmZmZmZerdd l mZdd lmZejeZGd ddeZejedS))absolute_importN) configparser) BadCommandSubProcessError) display_path) make_command) TempDirectory)MYPY_CHECK_RUNNING) path_to_url)VersionControl!find_path_to_setup_from_repo_rootvcs) HiddenText) RevOptionscseZdZdZdZdZdZed d Zd d Z d dZ ddZ ddZ e ddZe ddZe ddZe ddZe ddZe fddZS) Mercurialhgz.hgclonehg+filehg+httphg+httpshg+sshhg+static-httpcCs|gS)N)revrr/builddir/build/BUILDROOT/alt-python35-pip-20.2.4-5.el8.x86_64/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/vcs/mercurial.pyget_base_rev_args'szMercurial.get_base_rev_argsc CsOtdd9}|j|jd||jd|gd|jWdQRXdS)z?Export the Hg repository at the url to the destination locationkindexporturlarchivecwdN)runpackpath run_command)selflocationrtemp_dirrrrr+szMercurial.exportcCsp|j}tjd||t||jtddd|||jtdd|jd|dS)NzCloning hg %s%s to %srz --noupdatez-qupdater ) to_displayloggerinforr#rto_args)r$destr rev_options rev_displayrrr fetch_new5s  zMercurial.fetch_newc Cstjj||jd}tj}yM|j||jdd|jt |d}|j |WdQRXWnAt tj fk r}zt jd||WYdd}~Xn,Xtdd|j}|j|d|dS) Nhgrcpathsdefaultwz/Could not switch Mercurial repository to %s: %sr'z-qr )osr"joindirnamerRawConfigParserreadsetsecretopenwriteOSErrorNoSectionErrorr)warningrr+r#) r$r,rr- repo_configconfig config_fileexccmd_argsrrrswitchDs   zMercurial.switchcCsH|jddgd|tdd|j}|j|d|dS)Npullz-qr r')r#rr+)r$r,rr-rDrrrr'UszMercurial.updatecCsF|jddgd|j}|j|r<t|}|jS)N showconfigz paths.defaultr )r#strip_is_local_repositoryr )clsr%rrrrget_remote_url[s   zMercurial.get_remote_urlcCs%|jddgd|j}|S)zW Return the repository-local changeset revision number, as an integer. parentsz--template={rev}r )r#rH)rJr%current_revisionrrr get_revisiondszMercurial.get_revisioncCs%|jddgd|j}|S)zh Return the changeset identification hash, as a 40-character hexadecimal string rLz--template={node}r )r#rH)rJr%current_rev_hashrrrget_requirement_revisionms z"Mercurial.get_requirement_revisioncCsdS)z&Always assume the versions don't matchFr)rJr,namerrris_commit_id_equalxszMercurial.is_commit_id_equalcCs^|jdgd|j}tjj|sQtjjtjj||}t||S)z~ Return the path to setup.py, relative to the repo root. Return None if setup.py is in the repo root. rootr )r#rHr4r"isabsabspathr5r )rJr% repo_rootrrrget_subdirectory}s !zMercurial.get_subdirectoryc stt|j|}|r"|Sy"|jdgd|dd}Wn;tk rltjd|dSYntk rdSYnXtj j |j dS)NrSr log_failed_cmdFzIcould not determine if %s is under hg control because hg is not availablez ) superrget_repository_rootr#rr)debugrr4r"normpathrstrip)rJr%locr) __class__rrrZs      zMercurial.get_repository_root)rrrrrr)__name__ __module__ __qualname__rQr6 repo_nameschemes staticmethodrrr/rEr' classmethodrKrNrPrRrWrZrr)r`rrs        r) __future__rloggingr4pip._vendor.six.movesrpip._internal.exceptionsrrpip._internal.utils.miscrpip._internal.utils.subprocessrpip._internal.utils.temp_dirrpip._internal.utils.typingr pip._internal.utils.urlsr pip._internal.vcs.versioncontrolr r r rr getLoggerrar)rregisterrrrrs