3
”Re* ã @ sÌ d dl mZ d dlZd dlZd dlmZ d dlmZmZ d dl m
Z
d dlmZ d dl
mZ d dlmZ d d lmZ d d
lmZmZmZ er¤d dl mZ d dlmZ ejeƒZG d
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)Ú
RevOptionsc s˜ e Zd ZdZdZdZdZed d
„ ƒZdd„ Z d
d„ Z
dd„ Zdd„ Ze
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-httpc C s | gS )N© )Úrevr r úŠ/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' s zMercurial.get_base_rev_argsc C s> t dd��*}| j|j|d� | jd|g|jd� W dQ R X dS )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_dirr r r r + s zMercurial.exportc C sP |j ƒ }tjd||t|ƒƒ | jtddd||ƒƒ | jtdd|jƒ ƒ|d� d S )NzCloning hg %s%s to %sr z
--noupdatez-qÚupdate)r )Ú
to_displayÚloggerÚinfor r# r Úto_args)r$ Údestr Úrev_optionsÚrev_displayr r r Ú fetch_new5 s
zMercurial.fetch_newc C s² t jj|| jdƒ}tjƒ }y>|j|ƒ |jdd|jƒ t |dƒ�}|j
|ƒ W d Q R X W n6 ttjfk
rŽ } zt
jd||ƒ W Y d d }~X n X tdd|jƒ ƒ}| j||d� d S ) 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) Úwarningr r+ r# ) r$ r, r r- Úrepo_configÚconfigÚconfig_fileÚexcÚcmd_argsr r r ÚswitchD s
zMercurial.switchc C s4 | j ddg|d� tdd|jƒ ƒ}| j ||d� d S )NÚpullz-q)r r' )r# r r+ )r$ r, r r- rD r r r r' U s zMercurial.updatec C s0 | j ddg|d�jƒ }| j|ƒr(t|ƒ}|jƒ S )NÚ
showconfigz
paths.default)r )r# ÚstripÚ_is_local_repositoryr
)Úclsr% r r r r Úget_remote_url[ s
zMercurial.get_remote_urlc C s | j ddg|d�jƒ }|S )zW
Return the repository-local changeset revision number, as an integer.
Úparentsz--template={rev})r )r# rH )rJ r% Úcurrent_revisionr r r Úget_revisiond s zMercurial.get_revisionc C s | j ddg|d�jƒ }|S )zh
Return the changeset identification hash, as a 40-character
hexadecimal string
rL z--template={node})r )r# rH )rJ r% Úcurrent_rev_hashr r r Úget_requirement_revisionm s z"Mercurial.get_requirement_revisionc C s dS )z&Always assume the versions don't matchFr )rJ r, Únamer r r Úis_commit_id_equalx s zMercurial.is_commit_id_equalc C s@ | j dg|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# rH r4 r" ÚisabsÚabspathr5 r )rJ r% Ú repo_rootr r r Úget_subdirectory} s
zMercurial.get_subdirectoryc st t t| ƒj|ƒ}|r|S y| jdg|dd�}W n2 tk
rN tjd|ƒ d S tk
r` d S X tj j
|jdƒƒS )NrS F)r Úlog_failed_cmdzIcould not determine if %s is under hg control because hg is not availablez
)Úsuperr Úget_repository_rootr# r r) Údebugr r4 r" ÚnormpathÚrstrip)rJ r% ÚlocÚr)Ú __class__r r rZ Š s zMercurial.get_repository_root)r r r r r r )Ú__name__Ú
__module__Ú__qualname__rQ r6 Ú repo_nameÚschemesÚstaticmethodr r r/ rE r' ÚclassmethodrK rN rP rR rW rZ Ú
__classcell__r r )r` r r s
r )Ú
__future__r Úloggingr4 Úpip._vendor.six.movesr Úpip._internal.exceptionsr r Ú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
r r Ú getLoggerra r) r Úregisterr r r r Ú