U n a@sddlmZddlZddlZddlmZddlmZmZddl m Z ddl m Z ddl mZddlmZdd lmZdd lmZmZmZerdd l mZdd lmZeeZGd ddeZeedS))absolute_importN) configparser) BadCommandInstallationError) display_path) make_command) TempDirectory)MYPY_CHECK_RUNNING) path_to_url)VersionControl!find_path_to_setup_from_repo_rootvcs) HiddenText) RevOptionscseZdZdZdZdZdZeddZddZ d d Z d d Z d dZ e ddZe ddZe ddZe ddZe ddZe fddZZS) Mercurialhgz.hgclone)rzhg+filezhg+httpzhg+httpszhg+sshzhg+static-httpcCs|gS)N)revrr\C:\Users\vtejo\AppData\Local\Temp\pip-unpacked-wheel-6mt8ur68\pip\_internal\vcs\mercurial.pyget_base_rev_args'szMercurial.get_base_rev_argsc Cs@tdd,}|j|j|d|jd|gd|jdW5QRXdS)z?Export the Hg repository at the url to the destination locationexport)kind)urlarchiveF show_stdoutcwdN)runpackpath run_command)selflocationrtemp_dirrrrr+s zMercurial.exportcCsP|}td||t||tddd|||jtdd||ddS)NzCloning hg %s%s to %srz --noupdate-qupdater) to_displayloggerinforr rto_args)r!destr rev_options rev_displayrrr fetch_new5szMercurial.fetch_newc Cstj||jd}t}z>|||dd|jt |d}| |W5QRXWn6t tj fk r}zt d||W5d}~XYn Xtdd|}|j||ddS) Nhgrcpathsdefaultwz/Could not switch Mercurial repository to %s: %sr%r$r&)osrjoindirnamerRawConfigParserreadsetsecretopenwriteOSErrorNoSectionErrorr(warningrr*r ) r!r+rr, repo_configconfig config_fileexccmd_argsrrrswitchDs  zMercurial.switchcCs4|jddg|dtdd|}|j||ddS)Npullr$r&r%)r rr*)r!r+rr,rCrrrr%UszMercurial.updatecCs2|jddgd|d}||r*t|}|S)N showconfigz paths.defaultFr)r strip_is_local_repositoryr )clsr"rrrrget_remote_url[s  zMercurial.get_remote_urlcCs|jddgd|d}|S)zW Return the repository-local changeset revision number, as an integer. parentsz--template={rev}Frr rG)rIr"current_revisionrrr get_revisionds  zMercurial.get_revisioncCs|jddgd|d}|S)zh Return the changeset identification hash, as a 40-character hexadecimal string rKz--template={node}FrrL)rIr"current_rev_hashrrrget_requirement_revisionns  z"Mercurial.get_requirement_revisioncCsdS)z&Always assume the versions don't matchFr)rIr+namerrris_commit_id_equalyszMercurial.is_commit_id_equalcCsB|jdgd|d}tj|s8tjtj||}t||S)z~ Return the path to setup.py, relative to the repo root. Return None if setup.py is in the repo root. rootFr)r rGr3risabsabspathr4r )rIr" repo_rootrrrget_subdirectory~s  zMercurial.get_subdirectorycs|tt||}|r|Sz|jdg|dddd}Wn6tk rTtd|YdStk rhYdSXtj | dS)NrSFraise)rr on_returncodelog_failed_cmdzIcould not determine if %s is under hg control because hg is not availablez ) superrget_repository_rootr rr(debugrr3rnormpathrstrip)rIr"locr __class__rrr\s& zMercurial.get_repository_root)__name__ __module__ __qualname__rQr5 repo_nameschemes staticmethodrrr.rDr% classmethodrJrNrPrRrWr\ __classcell__rrrbrrs,       r) __future__rloggingr3pip._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 getLoggerrdr(rregisterrrrrs"