3 ”Re*ã@sÌddlmZddlZddlZddlmZddlmZmZddl m Z ddl m Z ddl mZddlmZdd lmZdd lmZmZmZer¤dd l mZdd lmZejeƒZGd d„deƒZejeƒdS)é)Úabsolute_importN)Ú configparser)Ú BadCommandÚSubProcessError)Ú display_path)Ú make_command)Ú TempDirectory)ÚMYPY_CHECK_RUNNING)Ú path_to_url)ÚVersionControlÚ!find_path_to_setup_from_repo_rootÚvcs)Ú HiddenText)Ú RevOptionscs˜eZdZdZdZdZdZed d „ƒZd d „Z d d„Z dd„Z dd„Z e dd„ƒZe dd„ƒZe dd„ƒZe dd„ƒZe dd„ƒZe ‡fdd„ƒZ‡ZS) Ú MercurialÚhgz.hgÚcloneúhg+fileúhg+httpúhg+httpsúhg+sshúhg+static-httpcCs|gS)N©)ÚrevrrúŠ/builddir/build/BUILDROOT/alt-python36-pip-20.2.4-5.el8.x86_64/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/vcs/mercurial.pyÚget_base_rev_args'szMercurial.get_base_rev_argsc Cs>tdd��*}|j|j|d�|jd|g|jd�WdQRXdS)z?Export the Hg repository at the url to the destination locationÚexport)Úkind)ÚurlÚarchive)ÚcwdN)rÚunpackÚpathÚ run_command)ÚselfÚlocationrÚtemp_dirrrrr+s zMercurial.exportcCsP|jƒ}tjd||t|ƒƒ|jtddd||ƒƒ|jtdd|jƒƒ|d�dS)NzCloning hg %s%s to %srz --noupdatez-qÚupdate)r )Ú to_displayÚloggerÚinforr#rÚto_args)r$ÚdestrÚ rev_optionsÚ rev_displayrrrÚ fetch_new5s zMercurial.fetch_newc Cs²tjj||jdƒ}tjƒ}y>|j|ƒ|jdd|jƒt |dƒ�}|j |ƒWdQRXWn6t tj fk rŽ}zt jd||ƒWYdd}~Xn Xtdd|jƒƒ}|j||d�dS) NÚhgrcÚpathsÚdefaultÚwz/Could not switch Mercurial repository to %s: %sr'z-q)r )Úosr"ÚjoinÚdirnamerÚRawConfigParserÚreadÚsetÚsecretÚopenÚwriteÚOSErrorÚNoSectionErrorr)Úwarningrr+r#) r$r,rr-Ú repo_configÚconfigÚ config_fileÚexcÚcmd_argsrrrÚswitchDs  zMercurial.switchcCs4|jddg|d�tdd|jƒƒ}|j||d�dS)NÚpullz-q)r r')r#rr+)r$r,rr-rDrrrr'UszMercurial.updatecCs0|jddg|d�jƒ}|j|ƒr(t|ƒ}|jƒS)NÚ showconfigz paths.default)r )r#ÚstripÚ_is_local_repositoryr )Úclsr%rrrrÚget_remote_url[s   zMercurial.get_remote_urlcCs|jddg|d�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|jddg|d�jƒ}|S)zh Return the changeset identification hash, as a 40-character hexadecimal string rLz--template={node})r )r#rH)rJr%Úcurrent_rev_hashrrrÚget_requirement_revisionms z"Mercurial.get_requirement_revisioncCsdS)z&Always assume the versions don't matchFr)rJr,ÚnamerrrÚis_commit_id_equalxszMercurial.is_commit_id_equalcCs@|jdg|d�jƒ}tjj|ƒs6tjjtjj||ƒƒ}t||ƒS)z~ Return the path to setup.py, relative to the repo root. Return None if setup.py is in the repo root. Úroot)r )r#rHr4r"ÚisabsÚabspathr5r )rJr%Ú repo_rootrrrÚget_subdirectory}s  zMercurial.get_subdirectoryc sttt|ƒj|ƒ}|r|Sy|jdg|dd�}Wn2tk rNtjd|ƒdStk r`dSXtj j |j dƒƒS)NrSF)r Úlog_failed_cmdzIcould not determine if %s is under hg control because hg is not availablez ) ÚsuperrÚget_repository_rootr#rr)Údebugrr4r"ÚnormpathÚrstrip)rJr%ÚlocÚr)Ú __class__rrrZŠs zMercurial.get_repository_root)rrrrrr)Ú__name__Ú __module__Ú __qualname__rQr6Ú repo_nameÚschemesÚ staticmethodrrr/rEr'Ú classmethodrKrNrPrRrWrZÚ __classcell__rr)r`rrs    r)Ú __future__rÚloggingr4Úpip._vendor.six.movesrÚpip._internal.exceptionsrrÚpip._internal.utils.miscrÚpip._internal.utils.subprocessrÚpip._internal.utils.temp_dirrÚpip._internal.utils.typingr Úpip._internal.utils.urlsr Ú pip._internal.vcs.versioncontrolr r r rrÚ getLoggerrar)rÚregisterrrrrÚs