+
     hH  c                   s   ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIH	t	 ^ RI
HtHtHtHt ^ RIHtHt ^ RIHtHtHt ^ RIHt ^ RIHtHtHtHtHtHtHt ]P@                  PB                  t!]P@                  PD                  t"] PF                  ! ]$4      t%]PL                  ! R4      t']PL                  ! R	4      t(]PL                  ! R
]PR                  4      t*R R lt+ ! R R]4      t,]PZ                  ! ],4       R# )i    N)replace)AnyListOptionalTuple)
BadCommandInstallationError)
HiddenTextdisplay_pathhide_url)make_command)AuthInfoRemoteNotFoundErrorRemoteNotValidError
RevOptionsVersionControl(find_path_to_project_root_from_repo_rootvcsz(^git version (\d+)\.(\d+)(?:\.(\d+))?.*$z^[a-fA-F0-9]{40}$a/  ^
    # Optional user, e.g. 'git@'
    (\w+@)?
    # Server, e.g. 'github.com'.
    ([^/:]+):
    # The server-side path. e.g. 'user/project.git'. Must start with an
    # alphanumeric character so as not to be confusable with a Windows paths
    # like 'C:/foo/bar' or 'C:\foo\bar'.
    (\w[^:]*)
    $c                s0    V ^8  d   QhR\         R\        /# )   shareturnstrbool)formats   ":/usr/lib/python3.14/site-packages/pip/_internal/vcs/git.py__annotate__r   8   s     ' ' ' '    c                 s>    \        \        P                  V 4      4      # N)r   
HASH_REGEXmatch)r      &r   looks_like_hashr    8   s    
  %&&r   c                   sn  a a ] tR t^<t oRtRtRtR0tR1tRt	]
V3R lR l4       t]V3R lV 3R ll4       tV3R	 lR
 ltV3R lR lt]V3R lR l4       t]V3R lR l4       t]V3R lR l4       t]V3R lR l4       t]V3R lR l4       tV3R lR ltV3R lR ltV3R lR lt]V3R lR l4       t]
V3R lR  l4       t]V3R! lR" l4       t]R2V3R# lR$ ll4       t]V3R% lR& l4       t]V3R' lV 3R( ll4       t]V3R) lR* l4       t]V3R+ lV 3R, ll4       t]
V3R- lR. l4       t R/t!Vt"V ;t## )3GitZgitz.gitcloneHEADc                6   < V ^8  d   QhRS[ RS[S[ ,          /# )r   revr   )r   r   r   __classdict__   "r   r   Git.__annotate__M   s      s tCy r   c                s    V .# r    r%   r   r   get_base_rev_argsZGit.get_base_rev_argsL   s	    ur   c                ,   < V ^8  d   QhRS[ RS[ RS[/# )r   argskwargsr   )r   r   r&   r(   r   r   r)   Q   s"     4 4 4s 4s 4r   c                s   < \         P                  P                  R 4      '       d!   VP                  R/ 4      pRVR&   RVR&   W2R&   \        SV `  ! V/ VB # )ZPIP_NO_INPUTextra_environZ0ZGIT_TERMINAL_PROMPTzssh -oBatchMode=yesZGIT_SSH_COMMAND)osZenvirongetsuperrun_command)clsr.   r/   r0   	__class__s   &*, r   r4   ZGit.run_commandP   sY    ::>>.))"JJ;M36M/0/DM+,&3?#w"D3F33r   c                r-   )r   urldestr   r   r&   r(   r   r   r)   Y   s"     $ $S $ $ $r   c                s   V P                  \        V4      4      w  r4VP                  '       g   R # V P                  W$P                  4      '       g   R # \	        V P                  W$P                  4      ^ ,          4      pV'       * # )F)Zget_url_rev_optionsr	   r%   is_commit_id_equalr   get_revision_sha)selfr7   r8   Z_rev_optionsZis_tag_or_branchs   &&&   r   is_immutable_rev_checkoutZGit.is_immutable_rev_checkoutY   sh    11(3-@&&t__==    5 5dOO LQ OP###r   c                s4   < V ^8  d   QhRS[ S[R3,          /# )r   r   .)r   intr&   r(   r   r   r)   g   s     : :sCx :r   c                s    V P                  R .RRRR7      p\        P                  V4      pV'       g   \        P	                  RV4       R# \        VP                  ^4      4      \        VP                  ^4      4      3# )versionzgit versionFT)Zcommand_descshow_stdoutstdout_onlyzCan't parse git version: %sr*   )r4   GIT_VERSION_REGEXr   loggerwarningr>   Zgroup)r;   r?   r   s   &  r   get_git_versionZGit.get_git_versiong   ss    ""K&	 # 
 "''0NN8'BIEKKN#SQ%899r   c                r$   r   locationr   r   r   r&   r(   r   r   r)   u   s      # (3- r   c                s    . ROpV P                  VRRRVR7      pVP                  4       pVP                  R4      '       d   V\        R4      R # R# )zT
Return the current branch, or None if HEAD isn't at a branch
(e.g. detached HEAD).
FTZextra_ok_returncodesr@   rA   cwdzrefs/heads/N)zsymbolic-ref-qr#      )r4   strip
startswithlen)r5   rG   r.   outputZrefs   &&   r   get_current_branchZGit.get_current_brancht   s]     .!% ! 
 lln>>-((s=)+,,r   c                sR   < V ^8  d   QhRS[ RS[ RS[S[S[ ,          S[3,          /# r   r8   r%   r   )r   r   r   r   r&   r(   r   r   r)      s0     + +C +c +eHSM4<O6P +r   c                s   V P                  RV.VRRRR7      p/ pVP                  4       P                  R4       F8  pVP                  R4      pV'       g   K   VP                  R^R	7      w  rgYdT&   K:  	  RV 2pRV 2p	VP                  V4      p
V
e   V
R3# VP                  V	4      p
V
R3#   \         d    \	        R
T: 24      hi ; i)z
Return (sha_or_none, is_branch), where sha_or_none is a commit hash
if the revision names a remote branch or tag, otherwise None.

Args:
  dest: the repository directory.
  rev: the revision name.
zshow-refFTZignore)rJ   r@   rA   on_returncodeZ
Z )Zmaxsplitzunexpected show-ref line: zrefs/remotes/origin/z
refs/tags/)r4   rN   splitrstripZ
ValueErrorr2   )r5   r8   r%   rQ   ZrefsZlineZref_shaZref_nameZ
branch_refZtag_refr   s   &&&        r   r:   ZGit.get_revision_sha   s     " ! 
  LLN((.D;;t$DH$(JJsQJ$?! %N / ,C51
se$hhz"?;hhwU|!  H !#=dX!FGGHs   B..C	c                r-   rS   r   r&   r(   r   r   r)      s"       3 4 r   c                s    VP                  R4      '       d   R# \        V4      '       g   R# V P                  W4      '       d   R# R# )z
Return true if rev is a ref or is a commit that we don't have locally.

Branches and tags are not considered in this method because they are
assumed to be always available locally (which is a normal outcome of
``git clone`` and ``git fetch --tags``).
zrefs/TF)rO   r    
has_commit)r5   r8   r%      &&&r   _should_fetchZGit._should_fetch   s9     >>'""s##>>$$$r   c                s2   < V ^8  d   QhRS[ RS[RS[RS[/# )r   r8   r7   r<   r   r   r   r   r&   r(   r   r   r)      s-     + ++'+6@+	+r   c           	     s   VP                   pVf   Q hV P                  W4      w  rVVe*   VP                  V4      p\        Y6'       d   TMRR7      pV# \	        V4      '       g   \
        P                  RV4       V P                  W4      '       g   V# V P                  \        RRW#P                  4       4      VR7       V P                  VRR7      pVP                  V4      pV# )	z
Resolve a revision to a new RevOptions object with the SHA1 of the
branch, tag, or ref if found.

Args:
  rev_options: a RevOptions object.
N)branch_namez:Did not find branch or tag '%s', assuming revision or ref.fetchrK   rJ   Z
FETCH_HEADr+   )Zarg_revr:   make_newr    r    rC   rD   rZ   r4   r
   to_argsget_revision)r5   r8   r7   r<   r%   r   Z	is_branchs   &&&&   r   resolve_revisionZGit.resolve_revision   s     !! --d8?%..s3K!+9CRVXK s##NNL
   ++ 	$-@-@-BC 	 	

 t6!**3/r   c                s<   < V ^8  d   QhRS[ RS[S[ ,          RS[/# )r   r8   namer   )r   r   r   r&   r(   r   r   r)     s&     . .c .# .4 .r   c                s>    V'       g   R# V P                  V4      V8H  # )z
Return whether the current commit hash equals the given name.

Args:
  dest: the repository directory.
  name: a string name.
F)ra   )r5   r8   rc   rY   r   r9   ZGit.is_commit_id_equal   s      %--r   c          
      s6   < V ^8  d   QhRS[ RS[RS[RS[RR/# )r   r8   r7   r<   	verbosityr   N)r   r   r   r>   r&   r(   r   r   r)     s5     =% =%=%(=%7A=%NQ=%	=%r   c                s   VP                  4       p\        P                  R W%\        V4      4       V^ 8:  d   RpMV^8X  d   RpMRpV P	                  4       R8  d#   V P                  \        RR.VOVNVN5!  4       M V P                  \        R.VOVNVN5!  4       VP                  '       d   V P                  WV4      p\        VRR4      p\        P                  RW74       VfP   V P                  WP                  4      '       g.   \        RRVP                  4       4      pV P                  WR7       MWV P                  V4      V8w  d   R	V 2p	RR
VRV	.pV P                  WR7       M"V P                  V4      p
VP                  V
4      p\        P                  RW#P                  4       V P!                  V4       R# )zCloning %s%s to %sr"   z--filter=blob:noner\   NzRev options %s, branch_name %scheckoutrK   r^   zorigin/z-bz--trackzResolved %s to commit %s)z--quietr*   )z	--verbosez
--progress)r   i   )Z
to_displayrC   Zinfor   rE   r4   r
   r%   rb   Zgetattrdebugr9   r`   rR   ra   r_   update_submodules)r;   r8   r7   r<   rd   Zrev_displayZflagsr\   cmd_argsZtrack_branchr   s   &&&&&      r   	fetch_newZGit.fetch_new  s    ",,.(#L<NO>%1E!^E/E!W, (  	
  \'EEE3EEF???//;GK!+}dCKLL9;T" ..t__EE+"#++- H
 $$X$8((.+= ")6     4##D)C%..s3K.__E 	t$r   c                0   < V ^8  d   QhRS[ RS[RS[RR/# r   r8   r7   r<   r   Nr[   r&   r(   r   r   r)   N  s)     % %3 %Z %j %T %r   c                s    V P                  \        R RV4      VR7       \        RRVP                  4       4      pV P                  WAR7       V P                  V4       R# )configzremote.origin.urlr^   re   rK   N)r4   r
   r`   rg   r;   r8   r7   r<   rh      &&&& r   switchZ
Git.switchN  s]    #6< 	 	
  
D+2E2E2GH,t$r   c                rj   rk   r[   r&   r(   r   r   r)   X  s)     % %3 %Z %j %T %r   c                s(   V P                  4       R8  d   V P                  . ROVR7       MV P                  RR.VR7       V P                  WV4      p\        RRRVP	                  4       4      pV P                  WAR7       V P                  V4       R# )	rM   r]   rK   r^   Zresetz--hardN)rM   i	   )r]   rK   z--tags)rE   r4   rb   r
   r`   rg   rm   rn   r   updateZ
Git.updateX  s    !V+6DAgt_$7++D{C49L9L9NO,t$r   c                &   < V ^8  d   QhRS[ RS[ /# rF   r   r&   r(   r   r   r)   g  s     7 7c 7c 7r   c                sF   V P                  . RORRRVR7      pVP                  4       p V^ ,          pT F  pTP	                  R4      '       g   K  Tp M	  TP                  R4      ^,          pT P                  TP                  4       4      #   \         d    \        hi ; i)z
Return URL of the first remote encountered.

Raises RemoteNotFoundError if the repository does not have a remote
url configured.
FTrI   zremote.origin.url rU   )rl   z--get-regexpzremote\..*\.urlrL   )r4   Z
splitlinesZ
IndexErrorr   rO   rV   _git_remote_to_pip_urlrN   )r5   rG   ZstdoutZremotesZfound_remoteZremoter7   s   &&     r   get_remote_urlZGit.get_remote_urlf  s     :!% ! 
 ##%	&"1:L F  !566%    %a())#))+66  	&%%	&s   	B B c                rq   r   r7   r   rr   r&   r(   r   r   r)     s     ' 'C 'C 'r   c                sD   \         P                  ! RV 4      '       d   V # \        P                  P	                  V 4      '       d%   \
        P                  ! V 4      P                  4       # \        P                  V 4      pV'       d   VP                  R4      # \        V 4      h)a  
Convert a remote url from what git uses to what pip accepts.

There are 3 legal forms **url** may take:

    1. A fully qualified url: ssh://git@example.com/foo/bar.git
    2. A local project.git folder: /path/to/bare/repository.git
    3. SCP shorthand for form 1: git@example.com:foo/bar.git

Form 1 is output as-is. Form 2 must be converted to URI and form 3 must
be converted to form 1.

See the corresponding test test_git_remote_url_to_pip() for examples of
sample inputs/outputs.
z\w+://zssh://\1\2/\3)rer   r1   pathexistspathlibZPurePathZas_uri	SCP_REGEXZexpandr   )r7   Z	scp_matchs   & r   rs   ZGit._git_remote_to_pip_url  sw    " 88Is##J77>># ##C(//11OOC(	##$455!#&&r   c                r-   r   rG   r%   r   r   r&   r(   r   r   r)     s"      # C D r   c                sj     V P                  RRRRV,           .VRR7       R#   \         d     R# i ; i)zE
Check if rev is a commit that is available in the local repository.
	rev-parserK   z--verifyzsha^F)rJ   log_failed_cmdT)r4   r   )r5   rG   r%   rY   r   rX   ZGit.has_commit  sG    
		OOdJ=$    ! 		s   # 22c                s<   < V ^8  d   QhRS[ RS[S[ ,          RS[ /# r{   rH   r&   r(   r   r   r)     s&     	# 	#C 	#hsm 	#s 	#r   c                s\    Vf   RpV P                  RV.RRVR7      pVP                  4       # )Nr#   r|   FTr@   rA   rJ   )r4   rN   )r5   rG   r%   Zcurrent_revs   &&& r   ra   ZGit.get_revision  sA    ;Coo#	 & 
   ""r   c                r$   rF   rH   r&   r(   r   r   r)     s#     M M M Mr   c                sd   V P                  RR.RRVR7      P                  4       p\        P                  P	                  V4      '       g    \        P                  P                  W4      p\        P                  P                  \        P                  P                  VR4      4      p\        W4      # )zy
Return the path to Python project root, relative to the repo root.
Return None if the project root is in the repo root.
r|   z	--git-dirFTr~   z..)r4   rN   r1   rw   ZisabsjoinZabspathr   )r5   rG   Zgit_dirZ	repo_roots   &&  r   get_subdirectoryZGit.get_subdirectory  s     //+&	 " 

 %' 	 ww}}W%%ggll85GGGOOBGGLL$$?@	7LLr   c                sP   < V ^8  d   QhRS[ RS[S[ S[S[ ,          S[3,          /# ru   )r   r   r   r   r&   r(   r   r   r)     s+     # #s #uS(3-5Q/R #r   c                s4  < \        V4      w  r#rEpVP                  R4      '       d   VR\        VP                  R4      4      )  pV\        P
                  P                  V4      P                  RR4      P                  R4      ,           pVP                  R4      ^,           p	VRV	 \        W)R W8WV34      ,           pRV9  dA   RV9  g   Q hVP                  RR	4      p\        SV `-  V4      w  rpVP                  R
R4      pM\        SV `-  V4      w  rpWV3# )a  
Prefixes stub URLs like 'user@hostname:user/repo.git' with 'ssh://'.
That's required because although they use SSH they sometimes don't
work with a ssh:// scheme (e.g. GitHub). But we need a scheme for
parsing. Hence we remove it again afterwards and return it as a stub.
ZfileNZ/Z\Z+z://zfile:zgit+z
git+ssh://zssh://Z )urlsplitZendswithrP   ZlstripurllibZrequestZurl2pathnamer    Zfind
urlunsplitr3   get_url_rev_and_auth)r5   r7   ZschemeZnetlocrw   ZqueryZfragmentZinitial_slashesZnewpathZ
after_plusr%   Z	user_passr6   s   &&          r   r   ZGit.get_url_rev_and_auth  s    19-X??6"""#;c$++c*:&;%;<O%(C(CD(I(Q(Qc)fSkG  S)A-J*%
$fuG) C #%%%++fl3C"''">s"CCi++h+C"''">s"CCi""r   c                s$   < V ^8  d   QhRS[ RR/# )r   rG   r   Nrr   r&   r(   r   r   r)     s     
 
 
 
r   c                s    \         P                  P                  \         P                  P                  VR 4      4      '       g   R# V P	                  . ROVR7       R# )z.gitmodulesNr^   )Z	submodulerp   z--initz--recursiverK   )r1   rw   rx   r   r4   )r5   rG   s   &&r   rg   ZGit.update_submodules  s>    ww~~bggll8]CDDB 	 	
r   c                r$   rF   rH   r&   r(   r   r   r)     s     2 23 28C= 2r   c           	     s0  < \         SV `  V4      pV'       d   V#  V P                  R R.VRRRRR7      p\        P                  P                  TP                  R4      4      #   \         d    \        P                  RT4        R# \         d     R# i ; i)	r|   z--show-toplevelFTZraise)rJ   r@   rA   rT   r}   zKcould not determine if %s is under git control because git is not availableNz
)r3   get_repository_rootr4   r   rC   rf   r   r1   rw   ZnormpathrW   )r5   rG   ZlocZrr6   s   &&  r   r   ZGit.get_repository_root  s    g)(3J	/0! %$   A" ww 011  	LL/
   		s   A# #!BBBBc                s&   < V ^8  d   QhRS[ RS[/# )r   repo_urlr   r   r&   r(   r   r   r)     s      C D r   c                s    R# )zEIn either https or ssh form, requirements must be prefixed with git+.Tr*   )r   r   r   should_add_vcs_url_prefixZGit.should_add_vcs_url_prefix  s     r   r*   )zgit+httpz	git+httpszgit+sshzgit+gitzgit+file)ZGIT_DIRZGIT_WORK_TREEr   )$__name__Z
__module__Z__qualname__Z__firstlineno__rc   ZdirnameZ	repo_nameZschemesZunset_environZdefault_arg_revZstaticmethodr,   Zclassmethodr4   r=   rE   rR   r:   rZ   rb   r9   ri   ro   rp   rt   rs   rX   ra   r   r   rg   r   r   Z__static_attributes__Z__classdictcell__Z__classcell__)r6   r'   s   @@r   r!   r!   <   s    DGIG 1MO  4 4 4$ $: :  0 + +Z  , + +Z . .=% =%~% %% % 7 7: ' '<   	# 	# 	# M M" # # #< 
 
 2 2 20   r   r!   ).ZloggingZos.pathr1   ry   rv   Zurllib.parser   Zurllib.requestZdataclassesr    Ztypingr   r   r   r   Zpip._internal.exceptionsr   r   Zpip._internal.utils.miscr   r   r	   Zpip._internal.utils.subprocessr
   Z pip._internal.vcs.versioncontrolr   r   r   r   r   r   r   Zparser   r   Z	getLoggerr   rC   ZcompilerB   r   ZVERBOSErz   r    r!   Zregisterr*   r   r   <module>r      s       	    - - B G G 7   <<  \\$$
 
		8	$ JJ  ZZ+,
 JJ		 JJ	'Y. Yx S r   