Ë
    úmxit  ã                  óÜ   — U d dl mZ d dlZd dlZd dlmZmZmZ d dlm	Z	 d dl
mZ erd dlmZmZmZmZ  ee«      Zded<    ej(                  d	«      Zded
<   dZded<   dd„Z G d„ d«      Zy)é    )ÚannotationsN)ÚTYPE_CHECKINGÚFinalÚcast)Úutil)Ú
get_logger)ÚCommitÚRemoteÚRemoteReferenceÚRepor   Ú_LOGGERz5github\.com(?::\d+)?[/:]([^/]+)/([^/]+?)(?:\.git)?/?$Ú_GITHUB_URL_PATTERN)é   é   r   Ú_MIN_GIT_VERSIONc                ó˜   — t         j                  | j                  «       «      }|€y|j                  d«      › d|j                  d«      › �S )aú  Extract the ``owner/repo`` from a GitHub remote URL.

    This supports HTTPS and SSH URL forms including optional user info, port,
    trailing slash, and ``.git`` suffix. Validation of the scheme is not
    performed; we only extract if the URL contains ``github.com`` and ends with
    a path of the shape ``owner/repo``.

    Parameters
    ----------
    url
        The remote URL string.

    Returns
    -------
    str | None
        The extracted ``owner/repo`` if found; otherwise ``None``.
    Né   ú/r   )r   ÚsearchÚstripÚgroup)ÚurlÚmatchs     úI/home/htdocs/ttos/venv/lib/python3.12/site-packages/streamlit/git_util.pyÚ_extract_github_repo_from_urlr   )   sE   € ô$  ×&Ñ& s§y¡y£{Ó3€EØ€}ØØ�k‰k˜!‹nÐ˜Q˜uŸ{™{¨1›~Ð.Ð/Ð/ó    c                  óš   — e Zd ZU ded<   dd„Zdd„Zdd„Zedd„«       Zedd„«       Z	edd„«       Z
edd	„«       Zedd
„«       Zdd„Zdd„Zy)ÚGitRepozRepo | NoneÚrepoc                óè  — d | _         d| _        	 dd l}|j                  |d¬«      | _        | j                  j                  j
                  | _         | j                   �h| j                   t        k\  rT| j                  j                  j                  d«      }t        t        j                  j                  ||«      «      | _        y y y # t        $ r" t        j                  d|d¬«       d | _        Y y w xY w)NÚ r   T)Úsearch_parent_directoriesz--show-toplevelzØDid not find a git repo at %s. This is expected if this isn't a git repo, but could also fail for other reasons: 1) git binary or GitPython not installed 2) No .git folder 3) Corrupted .git folder 4) Path is invalid.©Úexc_info)Úgit_versionÚmoduleÚgitr   r   Úversion_infor   Ú	rev_parseÚstrÚosÚpathÚrelpathÚ	Exceptionr   Údebug)Úselfr,   r'   Úgit_roots       r   Ú__init__zGitRepo.__init__D   sÔ   € ð 48ˆÔØˆŒð	ÛàŸ™ À˜ÓFˆDŒIØ#Ÿy™yŸ}™}×9Ñ9ˆDÔà×ÑÐ+°×0@Ñ0@ÔDTÒ0TØŸ9™9Ÿ=™=×2Ñ2Ð3DÓE�Ü!¤"§'¡'§/¡/°$¸Ó"AÓB�•ð 1UÐ+øô ò 	Ü�M‰Mð&ð Øð ô 	ð ˆDŽIð	ús   �B3C Ã(C1Ã0C1c                ó,   — t        j                  | «      S ©N)r   Úrepr_©r0   s    r   Ú__repr__zGitRepo.__repr__`   s   € Ü�z‰z˜$ÓÐr   c                óh   — | j                   duxr# | j                  duxr | j                  t        k\  S )zETrue if there's a git repo here, and git.version >= _MIN_GIT_VERSION.N)r   r%   r   r6   s    r   Úis_validzGitRepo.is_validc   s<   € ð �I‰I˜TÐ!ò 5Ø× Ñ ¨Ð,ò5à× Ñ Ô$4Ñ4ð	
r   c                óž   — | j                   �| j                  «       sy | j                  ry | j                   j                  j	                  «       S r4   )r   r9   Úis_head_detachedÚactive_branchÚtracking_branchr6   s    r   r=   zGitRepo.tracking_branchk   s<   € à�9‰9Ð D§M¡M¤OØà× Ò Øà�y‰y×&Ñ&×6Ñ6Ó8Ð8r   c                óh   — | j                   �| j                  «       sy | j                   j                  S r4   )r   r9   Úuntracked_filesr6   s    r   r?   zGitRepo.untracked_filesu   s'   € à�9‰9Ð D§M¡M¤OØà�y‰y×(Ñ(Ð(r   c                ó|   — | j                   �| j                  «       sy| j                   j                  j                  S )NF)r   r9   ÚheadÚis_detachedr6   s    r   r;   zGitRepo.is_head_detached|   s+   € à�9‰9Ð D§M¡M¤OØà�y‰y�~‰~×)Ñ)Ð)r   c                óÔ   — | j                   �| j                  «       sy | j                   j                  j                  d «      D �cg c]  }t	        d|j
                  «      ‘Œ c}S c c}w )Nr*   )r   r9   ÚindexÚdiffr   Úa_path)r0   Úitems     r   Úuncommitted_fileszGitRepo.uncommitted_filesƒ   sI   € à�9‰9Ð D§M¡M¤OØà59·Y±Y·_±_×5IÑ5IÈ$Ó5OÖP¨T”�U˜DŸK™KÕ(ÒPÐPùÒPs   ÁA%c                ó  — | j                   �| j                  «       sy 	 | j                  «       }|€y |\  }}|j                  › d|› �}t	        | j                   j                  |› d|› �«      «      S # t        $ r g cY S w xY w)Nr   z..)r   r9   Úget_tracking_branch_remoteÚnameÚlistÚiter_commitsr.   )r0   Útracking_branch_infoÚremoteÚbranch_nameÚremote_branchs        r   Úahead_commitszGitRepo.ahead_commitsŠ   s‹   € à�9‰9Ð D§M¡M¤OØð
	Ø#'×#BÑ#BÓ#DÐ Ø#Ð+Øà"6ÑˆF�KØ%Ÿ{™{˜m¨1¨[¨MÐ:ˆMä˜Ÿ	™	×.Ñ.°-°ÀÀ;À-Ð/PÓQÓRÐRøÜò 	ØŠIð	ús   ŸA1 ²>A1 Á1A?Á>A?c                ó@  — | j                   �| j                  «       sy | j                  }|€y |j                  j	                  d«      ^}}dj                  |«      }	 | j                   j                  |«      |fS # t        $ r t        j                  d|d¬«       Y y w xY w)Nr   zFailed to resolve remote %sTr#   )
r   r9   r=   rK   ÚsplitÚjoinrO   r.   r   r/   )r0   r=   Úremote_nameÚbranchrP   s        r   rJ   z"GitRepo.get_tracking_branch_remote›   s˜   € Ø�9‰9Ð D§M¡M¤OØà×.Ñ.ˆàÐ"Øà.×3Ñ3×9Ñ9¸#Ó>Ðˆ�fØ—h‘h˜vÓ&ˆð	Ø—9‘9×#Ñ# KÓ0°+Ð=Ð=øÜò 	Ü�M‰MÐ7¸ÈtˆMÔTÙð	ús   ÁA9 Á9!BÂBc                óh  — | j                  «       s!t        j                  d| j                  «       y | j	                  «       }|€t        j                  d«       y |\  }}t        |j                  «      }d }|D ]  }t        |«      }|€Œ n |€t        j                  d|«       y ||| j                  fS )Nz/No valid git information found. Git version: %sz1No tracking remote branch found for the git repo.zCUnable to determine repo name from configured remote URLs. URLs: %s)	r9   r   r/   r%   rJ   rL   Úurlsr   r&   )r0   Úremote_inforO   rW   Úremote_urlsr   r   s          r   Úget_repo_infozGitRepo.get_repo_info­   s¸   € Ø�}‰}ŒÜ�M‰MØAÀ4×CSÑCSôð à×5Ñ5Ó7ˆØÐÜ�M‰MÐMÔNØà$‰ˆ�Ü˜6Ÿ;™;Ó'ˆØˆØò 	ˆCÜ0°Ó5ˆDØÑÙð	ð
 ˆ<Ü�M‰MØUØôð à�V˜TŸ[™[Ð(Ð(r   N)r,   r*   ÚreturnÚNone)r]   r*   )r]   Úbool)r]   zRemoteReference | None)r]   zlist[str] | None)r]   zlist[Commit] | None)r]   ztuple[Remote, str] | None)r]   ztuple[str, str, str] | None)Ú__name__Ú
__module__Ú__qualname__Ú__annotations__r2   r7   r9   Úpropertyr=   r?   r;   rH   rR   rJ   r\   © r   r   r   r   A   s‡   … Ø
Óóó8 ó
ð ò9ó ð9ð ò)ó ð)ð ò*ó ð*ð òQó ðQð òó ðó ô$)r   r   )r   r*   r]   z
str | None)Ú
__future__r   r+   ÚreÚtypingr   r   r   Ú	streamlitr   Ústreamlit.loggerr   r'   r	   r
   r   r   r`   r   rc   Úcompiler   r   r   r   re   r   r   ú<module>rl      so   ðö #ã 	Û 	ß -Ñ -å Ý 'áß9Ó9á˜HÓ%€ˆÓ %ð (˜RŸZ™ZØ<óÐ �Uó ð $Ð �%Ó #ó0÷0G)ò G)r   