3 (\ @sddlmZddlZddlZddlmZddlmZddlm Z ddl m Z ddl m Z mZejeZGdd d e ZejedS) )absolute_importN) configparser) path_to_url) display_path) TempDirectory)VersionControlvcsc@s|eZdZdZdZdZdZedd Zd d Z e d d Z ddZ ddZ e ddZe ddZe ddZe ddZdS) Mercurialhgz.hgclonehg+httphg+httpshg+sshhg+static-httpcCs|gS)N)revrrn/private/var/folders/pf/wv4htv3x0qs2c2mp0dnn0kchsvlck3/T/pip-build-k1a8l1r5/pip/pip/_internal/vcs/mercurial.pyget_base_rev_argsszMercurial.get_base_rev_argsc Cs<tdd(}|j|j|jd|gd|jdWdQRXdS)z?Export the Hg repository at the url to the destination locationexport)kindarchiveF) show_stdoutcwdN)runpackpath run_command)selflocationtemp_dirrrrrs  zMercurial.exportcCsR|j}tjd||t||jddd||gddg|j}|j||ddS)NzCloning hg %s%s to %sr z --noupdatez-qupdate)r)Z to_displayloggerinforrto_args)clsdesturl rev_options rev_displaycmd_argsrrr fetch_new#s zMercurial.fetch_newc Cstjj||jd}tj}y<|j||jdd|t|d}|j |WdQRXWn6t tj fk r}zt j d||WYdd}~Xn Xddg|j}|j||ddS) Nhgrcpathsdefaultwz/Could not switch Mercurial repository to %s: %srz-q)r)osrjoindirnamerSafeConfigParserreadsetopenwriteOSErrorNoSectionErrorr warningr"r) rr$r%r& repo_configconfig config_fileexcr(rrrswitch0s  zMercurial.switchcCs4|jddg|dddg|j}|j||ddS)Npullz-q)rr)rr")rr$r%r&r(rrrr@szMercurial.updatecCs2|jddgd|dj}|j|r*t|}|jS)N showconfigz paths.defaultF)rr)rstrip_is_local_repositoryr)r#rr%rrrget_remote_urlEs  zMercurial.get_remote_urlcCs|jddgd|dj}|S)zW Return the repository-local changeset revision number, as an integer. parentsz--template={rev}F)rr)rr@)r#rcurrent_revisionrrr get_revisionNszMercurial.get_revisioncCs|jddgd|dj}|S)zh Return the changeset identification hash, as a 40-character hexadecimal string rCz--template={node}F)rr)rr@)r#rcurrent_rev_hashrrrget_requirement_revisionXsz"Mercurial.get_requirement_revisioncCsdS)z&Always assume the versions don't matchFr)r#r$namerrris_commit_id_equalcszMercurial.is_commit_id_equalN)r r r rr)__name__ __module__ __qualname__rHr0 repo_nameschemes staticmethodrr classmethodr)r=rrBrErGrIrrrrr s   r ) __future__rloggingr.pip._vendor.six.movesrZpip._internal.downloadrZpip._internal.utils.miscrZpip._internal.utils.temp_dirrZpip._internal.vcsrr getLoggerrJr r registerrrrrs      Y