7iddlZddlZddlZddlmZmZmZddlmZm Z ddl m Z m Z ddl mZddlmZddlmZmZmZmZej,eZGdd eZej4ey) N)ListOptionalTuple) BadCommandInstallationError) HiddenText display_path) make_command) path_to_url) RevOptionsVersionControl(find_path_to_project_root_from_repo_rootvcsc FeZdZdZdZdZdZedede efdZ ded e d e d e dd f d Zded e d e dd fdZded e d e dd fdZededefdZededefdZededefdZededeedefdZededeefdZededeeffd ZxZS) Mercurialhgz.hgclone)zhg+filezhg+httpzhg+httpszhg+sshzhg+static-httprevreturncd|gS)Nz--rev=)rs d/mnt/ssd/data/python-lab/ChefSystem/venv/lib/python3.12/site-packages/pip/_internal/vcs/mercurial.pyget_base_rev_argszMercurial.get_base_rev_args sdesturl rev_options verbosityNc4|j}tjd||t||dkrd}n|dk(rd}n |dk(rd}nd}|j t d d g||||j t d g||j | y) NzCloning hg %s%s to %sr)z--quietr) --verbose)r"z--debugrz --noupdateupdatecwd) to_displayloggerinfor run_commandr to_args)selfrrrr rev_displayflagss r fetch_newzMercurial.fetch_new$s",,.  #      >%1E !^E !^"E,E g|OeOSO$OP   AE A;+>+>+@ A  rctjj||jd}t j } |j ||jdd|jt|d5}|j|dddtdd|j}|j||y#1swY8xYw#ttjf$r!}t j#d||Yd}~yd}~wwxYw) Nhgrcpathsdefaultwr#-qr$z/Could not switch Mercurial repository to %s: %s)ospathjoindirname configparserRawConfigParserreadsetsecretopenwriter r*r)OSErrorNoSectionErrorr'warning) r+rrr repo_configconfig config_filecmd_argsexcs rswitchzMercurial.switch<sggll4v> --/ 1 KK $ JJw 3:: 6k3' *; [) * $HdK4G4G4IJH   X4  0  * *445 X NNLcSV W W Xs0:C;C CC  CD )DD c|jddg|tdd|j}|j||y)Npullr4r$r#)r)r r*)r+rrrrFs rr#zMercurial.updateJsC &$T2$ 0C0C0EF t,rlocationc|jddgdd|j}|j|r t|}|jS)N showconfigz paths.defaultFT show_stdout stdout_onlyr%)r)strip_is_local_repositoryr )clsrKrs rget_remote_urlzMercurial.get_remote_urlOsXoo ? +  %'  # #C (c"Cyy{rcP|jddgdd|j}|S)zW Return the repository-local changeset revision number, as an integer. parentsz--template={rev}FTrNr)rQ)rSrKcurrent_revisions r get_revisionzMercurial.get_revision[s= ?? * + + %'   rcP|jddgdd|j}|S)zh Return the changeset identification hash, as a 40-character hexadecimal string rVz--template={node}FTrNrW)rSrKcurrent_rev_hashs rget_requirement_revisionz"Mercurial.get_requirement_revisionhs= ?? + , + %'   rnamecy)z&Always assume the versions don't matchFr)rSrr]s ris_commit_id_equalzMercurial.is_commit_id_equalvsrc|jdgdd|j}tjj |s=tjj tjj ||}t||S)z Return the path to Python project root, relative to the repo root. Return None if the project root is in the repo root. rootFTrN)r)rQr5r6isabsabspathr7r)rSrK repo_roots rget_subdirectoryzMercurial.get_subdirectory{slOO H%Tx$ %' ww}}Y' Xy(IJI7)LLrct||}|r|S |jdg|dddd}tjj|jdS#t$rtj d|Yyt $rYywxYw)NraFTraise)r%rOrP on_returncodelog_failed_cmdzIcould not determine if %s is under hg control because hg is not availablez ) superget_repository_rootr)rr'debugrr5r6normpathrstrip)rSrKlocr __class__s rrkzMercurial.get_repository_rootsg)(3 J ! %$  A"ww 011  LL.     sAB=BB)__name__ __module__ __qualname__r]r8 repo_nameschemes staticmethodstrrrrr intr.rHr# classmethodrTrYr\rboolr_rerk __classcell__)rqs@rrrs DGIG s tCy    ( 7A NQ  0 13 1Z 1j 1T 1-3-Z-j-T-  c c    C  C            c#4 M M M M2328C=22rr)r9loggingr5typingrrrpip._internal.exceptionsrrpip._internal.utils.miscrr pip._internal.utils.subprocessr pip._internal.utils.urlsr pip._internal.vcs.versioncontrolr r rr getLoggerrrr'rregisterrrrrs] ((B=70   8 $L2L2^  Yr