
    q"h                         S SK r S SKrS SKrS SKJrJrJr  S SKJrJ	r	  S SK
JrJr  S SKJr  S SKJr  S SKJrJrJrJr  \R,                  " \5      r " S S	\5      r\R4                  " \5        g)
    N)ListOptionalTuple)
BadCommandInstallationError)
HiddenTextdisplay_path)make_command)path_to_url)
RevOptionsVersionControl(find_path_to_project_root_from_repo_rootvcsc            
       d  ^  \ rS rSrSrSrSrSr\S\	S\
\	   4S j5       rS	\	S
\S\S\SS4
S jrS	\	S
\S\SS4S jrS	\	S
\S\SS4S jr\S\	S\	4S j5       r\S\	S\	4S j5       r\S\	S\	4S j5       r\S	\	S\\	   S\4S j5       r\S\	S\\	   4S j5       r\S\	S\\	   4U 4S jj5       rSrU =r$ )	Mercurial   hgz.hgclone)zhg+filezhg+httpzhg+httpszhg+sshzhg+static-httprevreturnc                     SU  3/$ )Nz--rev= )r   s    M/var/www/html/env/lib/python3.13/site-packages/pip/_internal/vcs/mercurial.pyget_base_rev_argsMercurial.get_base_rev_args    s        desturlrev_options	verbosityNc                 4   UR                  5       n[        R                  SUU[        U5      5        US::  a  SnOUS:X  a  SnOUS:X  a  SnOSnU R	                  [        S	S
/UQUPUP76 5        U R	                  [        S/UQUR                  5       P76 US9  g )NzCloning hg %s%s to %sr   )z--quiet   r      )	--verbose)r$   z--debugr   z
--noupdateupdatecwd)
to_displayloggerinfor	   run_commandr
   to_args)selfr   r   r   r    rev_displayflagss          r   	fetch_newMercurial.fetch_new$   s     ",,.#		
 >%1E!^E!^"E,Eg|OeOSO$OPAEA;+>+>+@A 	 	
r   c                    [         R                  R                  XR                  S5      n[        R
                  " 5       n UR                  U5        UR                  SSUR                  5        [        US5       nUR                  U5        S S S 5        [        SSUR                  5       5      nU R                  XqS9  g ! , (       d  f       N9= f! [        [        R                  4 a   n[         R#                  SX(5         S nAg S nAff = f)	Nhgrcpathsdefaultwr%   -qr&   z/Could not switch Mercurial repository to %s: %s)ospathjoindirnameconfigparserRawConfigParserreadsetsecretopenwriter
   r,   r+   OSErrorNoSectionErrorr)   warning)	r-   r   r   r   repo_configconfigconfig_filecmd_argsexcs	            r   switchMercurial.switch<   s    ggll4v>--/		1KK$JJw	3::6k3';[) (
 $HdK4G4G4IJHX0 ('445 	XNNLcWW	Xs0   :C ;C C  
C
C D+DDc                 |    U R                  SS/US9  [        SSUR                  5       5      nU R                  XAS9  g )Npullr7   r&   r%   )r+   r
   r,   )r-   r   r   r   rI   s        r   r%   Mercurial.updateJ   sA    &$T2$0C0C0EF,r   locationc                     U R                  SS/SSUS9R                  5       nU R                  U5      (       a  [        U5      nUR                  5       $ )N
showconfigzpaths.defaultFTshow_stdoutstdout_onlyr'   )r+   strip_is_local_repositoryr   )clsrP   r   s      r   get_remote_urlMercurial.get_remote_urlO   s[    oo?+	  

 %' 	 ##C((c"Cyy{r   c                 J    U R                  SS/SSUS9R                  5       nU$ )zG
Return the repository-local changeset revision number, as an integer.
parentsz--template={rev}FTrS   r+   rV   )rX   rP   current_revisions      r   get_revisionMercurial.get_revision[   s=    
 ??*+	 + 

 %' 	  r   c                 J    U R                  SS/SSUS9R                  5       nU$ )zP
Return the changeset identification hash, as a 40-character
hexadecimal string
r\   z--template={node}FTrS   r]   )rX   rP   current_rev_hashs      r   get_requirement_revision"Mercurial.get_requirement_revisionh   s=     ??+,	 + 

 %' 	  r   namec                     g)z&Always assume the versions don't matchFr   )rX   r   re   s      r   is_commit_id_equalMercurial.is_commit_id_equalv   s     r   c                    U R                  S/SSUS9R                  5       n[        R                  R	                  U5      (       d<  [        R                  R                  [        R                  R                  X5      5      n[        X5      $ )zy
Return the path to Python project root, relative to the repo root.
Return None if the project root is in the repo root.
rootFTrS   )r+   rV   r8   r9   isabsabspathr:   r   )rX   rP   	repo_roots      r   get_subdirectoryMercurial.get_subdirectory{   sk     OOH%Tx $ 

%' 	 ww}}Y''X(IJI7LLr   c           	        > [         TU ]  U5      nU(       a  U$  U R                  S/USSSSS9n[        R                  R                  UR                  S5      5      $ ! [         a    [        R                  SU5         g [         a     g f = f)Nrj   FTraise)r'   rT   rU   on_returncodelog_failed_cmdzIcould not determine if %s is under hg control because hg is not availablez
)superget_repository_rootr+   r   r)   debugr   r8   r9   normpathrstrip)rX   rP   locr	__class__s       r   ru   Mercurial.get_repository_root   s    g)(3J	! %$   A" ww 011  	LL.
   		s   A  B 	BBr   )__name__
__module____qualname____firstlineno__re   r;   	repo_nameschemesstaticmethodstrr   r   r   r   intr0   rK   r%   classmethodrY   r_   rc   r   boolrg   rn   ru   __static_attributes____classcell__)r{   s   @r   r   r      s   DGIG  s  tCy    

(
7A
NQ
	
013 1Z 1j 1T 1-3 -Z -j -T -
 	c 	c 	 	 
 C 
 C 
  
          c # 4   M M M M 23 28C= 2 2r   r   )r<   loggingr8   typingr   r   r   pip._internal.exceptionsr   r   pip._internal.utils.miscr   r	   pip._internal.utils.subprocessr
   pip._internal.utils.urlsr    pip._internal.vcs.versioncontrolr   r   r   r   	getLoggerr}   r)   r   registerr   r   r   <module>r      sY      	 ( ( B = 7 0  
		8	$L2 L2^ Y r   