Ë
    ›¾j‡  ã                   óÀ   — d dl Z d dlZd dlmZ d dlmZ d dlmZ ddlm	Z	 ddl
mZmZ dd	d
œdededededef
d„Zd„ Zdededefd„Z	 ddedeeef   fd„Zdedefd„Zy)é    N)ÚPath)ÚTuple)Úmsgé   )Úrun_command)Úis_subpath_ofÚmake_tempdirÚmasterF)ÚbranchÚsparseÚrepoÚsubpathÚdestr   r   c                ó.  — t        «       }|j                  «       rt        j                  dd¬«       |j                  j                  «       st        j                  dd¬«       |r|dk\  rt        | |||«      S |r0d|d   › d|d   › d	�}d
}t        j                  |dk(  r|n|› d�«       t        «       5 }d|› d| › d|› �}	t        |	d¬«       	 |t        |«      z  }
t        ||
«      sd|› d�}t        j                  || d¬«       t        j                  j                  |
«      rt        j                  |
|«       nt        j                   |
|«       d d d «       y # t"        $ r$ d|› d|› d�}t        j                  || d¬«       Y Œ5w xY w# 1 sw Y   y xY w)Nz&Destination of checkout must not existr   ©Úexitsz,Parent of destination of checkout must exist)é   é   z'You're running an old version of Git (vr   ú.z1) that doesn't fully support sparse checkout yet.zOYou're running an unknown version of Git, so sparse checkout has been disabled.©r   r   z— This means that more files than necessary may be downloaded temporarily. To only download the files needed, make sure you're using Git v2.22 or above.úgit -C z clone z . -b T©Úcaptureú'ú-' is a path outside of the cloned repository.zCan't clone z6. Make sure the directory exists in the repo (branch 'z'))Úget_git_versionÚexistsr   ÚfailÚparentÚgit_sparse_checkoutÚwarnr	   r   r   r   ÚosÚpathÚisdirÚshutilÚcopytreeÚcopyfileÚFileNotFoundError)r   r   r   r   r   Úgit_versionÚerr_oldÚerr_unkÚtmp_dirÚcmdÚsource_pathÚerrs               úY/home/spazio/kingdom_calls/work5/transenv/lib/python3.12/site-packages/weasel/util/git.pyÚgit_checkoutr1      sž  € ô "Ó#€KØ‡{�{„}Ü�‰Ð9ÀÕCØ�;‰;×ÑÔÜ�‰Ð?ÀqÕIÙ�+ Ò(Ü" 4¨°$¸Ó?Ð?Ù	ð 6°kÀ!±nÐ5EÀQÀ{ÐSTÁ~ÐFVð W>ð ?ð 	ð dˆÜ�‰Ø%¨Ò/‰w°WÐ=ð >/ð 0ô	
ô 
‹ð )˜7Ø˜�y ¨ v¨V°F°8Ð<ˆÜ�C Õ&ð	)Ø!¤D¨£MÑ1ˆKÜ  ¨+Ô6Ø˜'˜Ð"OÐP�Ü—‘˜˜d¨!Õ,Ü�w‰w�}‰}˜[Ô)Ü—‘ ¨TÕ2ä—‘ ¨TÔ2÷)ð )øô !ò 	)Ø   	Ð)_Ð`fÐ_gÐgiÐjˆCÜ�H‰H�S˜$ a×(ð	)ú÷)ð )ús+   Â4FÃBEÅ*FÆFÆFÆFÆFc           	      ó¼  — t        «       5 }d| › d|› d|› d�}t        |«       d|› d|› �}t        |d¬«      }t        | «      }dj                  |j                  j                  «       D �cg c]  }|j                  d	«      sŒ|d
d  ‘Œ c}«      }	|	s#d|› d| › d|› d	�}
t        j                  |
d
¬«       d|› d|› d|	› �}t        |d¬«       d|› d|› d|› �}t        |d¬«       |t        |«      z  }t        ||«      sd|› d�}
t        j                  |
| d
¬«       t        j                  t        |«      t        |«      «       d d d «       y c c}w # 1 sw Y   y xY w)Nz
git clone ú z --no-checkout --depth 1 -b z --filter=blob:noner   z- rev-list --objects --all --missing=print -- Tr   ú?r   z'Could not find any relevant files for 'z<'. Did you specify a correct and complete path within repo 'z' and branch r   z fetch-pack z
 checkout r   r   )r	   r   Ú_http_to_gitÚjoinÚstdoutÚsplitÚ
startswithr   r   r   r   r%   ÚmoveÚstr)r   r   r   r   r,   r-   ÚretÚgit_repoÚxÚmissingsr/   r.   s               r0   r    r    6   s�  € ô  
‹ð !1˜7ð ˜˜˜a ˜yð )Ø�Ð,ð.ð 	ô 	�CÔð ˜�yÐ MÈgÈYÐWˆÜ˜# tÔ,ˆÜ Ó%ˆà—8‘8¨C¯J©J×,<Ñ,<Ó,>ÖT qÀ!Ç,Á,ÈsÕBS˜Q˜q˜ršUÒTÓUˆÙà9¸'¸ð CLØLPÈ6ð RØ$˜X Qð(ð ô
 �H‰H�S Õ"Ø˜�y ¨X¨J°a¸°zÐBˆÜ�C Õ&à˜�y 
¨6¨(°!°G°9Ð=ˆÜ�C Õ&ð ¤ W£Ñ-ˆÜ˜W kÔ2Ø�g�YÐKÐLˆCÜ�H‰H�S˜$ aÕ(ä�‰”C˜Ó$¤c¨$£iÔ0÷C!1ð !1ùò U÷!1ð !1ús%   ‹AEÁ*E
ÂE
ÂB<EÅEÅEÚreturnc                 ób   — t        «        d| › d|› �}t        |d¬«      }|j                  dk7  }|S )zÁUses 'git ls-remote' to check if a repository and branch exists

    repo (str): URL to get repo.
    branch (str): Branch on repo to check.
    RETURNS (bool): True if repo:branch exists.
    zgit ls-remote r3   Tr   Ú )r   r   r7   )r   r   r-   r<   r   s        r0   Úgit_repo_branch_existsrC   j   s=   € ô ÔØ˜4˜&  & Ð
*€Cô �c 4Ô
(€CØ�Z‰Z˜2Ñ€FØ€Mó    Úerrorc                 ó&  — 	 t        dd¬«      }|j                  j	                  «       }|r|j                  d«      sy|dd j	                  «       j                  d«      }t        |d	   «      t        |d
   «      fS # t        $ r t        | «      ‚w xY w)a  Get the version of git and raise an error if calling 'git --version' fails.

    error (str): The error message to show.
    RETURNS (Tuple[int, int]): The version as a (major, minor) tuple. Returns
        (0, 0) if the version couldn't be determined.
    zgit --versionTr   zgit versionr   é   Nr   r   r   )r   Ú	ExceptionÚRuntimeErrorr7   Ústripr9   r8   Úint)rE   r<   r7   Úversions       r0   r   r   {   s�   € ð"Ü˜/°4Ô8ˆð �Z‰Z×ÑÓ€FÙ˜×*Ñ*¨=Ô9ØØ�R�Sˆk×ÑÓ!×'Ñ'¨Ó,€GÜˆw�q‰z‹?œC ¨¡
›OÐ+Ð+øô ò "Ü˜5Ó!Ð!ð"ús   ‚A; Á;Bc                 óê   — | j                  d«      r| j                  dd«      } | j                  d«      r>| j                  dd«      j                  ddd«      } | j                  d«      r| d d } | › d�} | S )	Nzhttp://zhttps://zgit@ú/ú:r   éÿÿÿÿz.git)r9   ÚreplaceÚendswith)r   s    r0   r5   r5   �   sp   € Ø‡��yÔ!Ø�|‰|˜J¨Ó4ˆØ‡��{Ô#Ø�|‰|˜J¨Ó/×7Ñ7¸¸SÀ!ÓDˆØ�=‰=˜ÔØ˜˜�9ˆDØ��tˆ}ˆØ€KrD   )zNCould not run 'git'. Make sure it's installed and the executable is available.)r"   r%   Úpathlibr   Útypingr   Úwasabir   Úcommandsr   Ú
filesystemr   r	   r;   Úboolr1   r    rC   rK   r   r5   © rD   r0   ú<module>rZ      s§   ðÛ 	Û Ý Ý å å !ß 3ð ;CÐSXò')Ø
ð')Øð')Ø#'ð')Ø47ð')ØLPó')òT11ðh ð ¨cð °dó ð$ bñ,Øð,à
ˆ3�ˆ8�_ó,ð(�sð ˜sô rD   