Ë
    ùmxi\  ã                   óH  — d Z g d¢ZddlZddlmZ ddlZddlmZ ddl	Z	ddl
Z
ddlmZ ddlmZmZmZmZmZmZ ddlmZmZmZ erddlmZ e	j4                  Ze	j6                  Z G d	„ d
«      Zdedef   dedef   fd„Zdedef   dedef   fd„Zdedef   dedef   fd„Zy)zIndex utilities.)ÚTemporaryFileSwapÚpost_clear_cacheÚdefault_indexÚgit_working_diré    N)Úwraps)ÚTracebackType)ÚAnyÚCallableÚTYPE_CHECKINGÚOptionalÚTypeÚcast)ÚLiteralÚPathLikeÚ_T)Ú	IndexFilec            	       ób   — e Zd ZdZdZdeddfd„Zdd„Zdee	e
      d	ee
   d
ee   ded   fd„Zy)r   z„Utility class moving a file to a temporary location within the same directory and
    moving it back on to where on object deletion.)Ú	file_pathÚtmp_file_pathr   ÚreturnNc                 óZ  — || _         t        j                  |«      \  }}t        j                  ||¬«      \  }| _        t        j                  |«       t        j                  t        «      5  t        j                  | j                   | j
                  «       d d d «       y # 1 sw Y   y xY w)N)ÚprefixÚdir)r   ÚospÚsplitÚtempfileÚmkstempr   ÚosÚcloseÚ
contextlibÚsuppressÚOSErrorÚreplace)Úselfr   ÚdirnameÚbasenameÚfds        úE/home/htdocs/ttos/venv/lib/python3.12/site-packages/git/index/util.pyÚ__init__zTemporaryFileSwap.__init__'   s|   € Ø"ˆŒÜŸI™I iÓ0Ñˆ�Ü!)×!1Ñ!1¸ÀwÔ!OÑˆˆDÔÜ
�‰�ŒÜ× Ñ ¤Ó)ñ 	;Ü�J‰J�t—~‘~ t×'9Ñ'9Ô:÷	;÷ 	;ñ 	;ús   Á-+B!Â!B*c                 ó   — | S ©N© )r$   s    r(   Ú	__enter__zTemporaryFileSwap.__enter__/   s   € Øˆó    Úexc_typeÚexc_valÚexc_tbFc                 ó–   — t        j                  | j                  «      r*t        j                  | j                  | j
                  «       y)NF)r   Úisfiler   r   r#   r   )r$   r/   r0   r1   s       r(   Ú__exit__zTemporaryFileSwap.__exit__2   s1   € ô �:‰:�d×(Ñ(Ô)Ü�J‰J�t×)Ñ)¨4¯>©>Ô:Ør.   )r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r   r)   r-   r   r   ÚBaseExceptionr   r   r4   r,   r.   r(   r   r   !   si   „ ñ6ð /€Ið; (ð ;¨tó ;óðà˜4 Ñ.Ñ/ðð ˜-Ñ(ðð ˜Ñ'ð	ð
 
�‰ôr.   r   Úfunc.r   c           	      óX   ‡ — t        ‰ «      dddt        dt        dt        fˆ fd„«       }|S )zøDecorator for functions that alter the index using the git command.

    When a git command alters the index, this invalidates our possibly existing entries
    dictionary, which is why it must be deleted to allow it to be lazily reread later.
    r$   r   ÚargsÚkwargsr   c                 ó@   •—  ‰| g|¢­i |¤Ž}| j                  «        |S r+   )Ú_delete_entries_cache)r$   r=   r>   Úrvalr;   s       €r(   Úpost_clear_cache_if_not_raisedz8post_clear_cache.<locals>.post_clear_cache_if_not_raisedG   s(   ø€ á�DÐ*˜4Ò* 6Ñ*ˆØ×"Ñ"Ô$Øˆr.   ©r   r	   r   )r;   rB   s   ` r(   r   r   @   sA   ø€ ô ˆ4ƒ[ð¨[ð Äð ÔPSð ÔXZô ó ðð *Ð)r.   c           	      óX   ‡ — t        ‰ «      dddt        dt        dt        fˆ fd„«       }|S )z¬Decorator ensuring the wrapped method may only run if we are the default
    repository index.

    This is as we rely on git commands that operate on that index only.
    r$   r   r=   r>   r   c                 ó†   •— | j                   | j                  «       k7  rt        d‰j                  z  «      ‚ ‰| g|¢­i |¤ŽS )NzECannot call %r on indices that do not represent the default git index)Ú
_file_pathÚ_index_pathÚAssertionErrorr5   )r$   r=   r>   r;   s      €r(   Úcheck_default_indexz*default_index.<locals>.check_default_indexY   sK   ø€ à�?‰?˜d×.Ñ.Ó0Ò0Ü ØWÐZ^×ZgÑZgÑgóð ñ �DÐ*˜4Ò* 6Ñ*Ð*r.   rC   )r;   rI   s   ` r(   r   r   R   s?   ø€ ô ˆ4ƒ[ð+ +ð +´cð +ÄSð +ÌRô +ó ð+ð Ðr.   c           	      óX   ‡ — t        ‰ «      dddt        dt        dt        fˆ fd„«       }|S )z�Decorator which changes the current working dir to the one of the git
    repository in order to ensure relative paths are handled correctly.r$   r   r=   r>   r   c                 ó  •— t        j                  «       }t        j                  t        t        | j
                  j                  «      «       	  ‰| g|¢­i |¤Žt        j                  |«       S # t        j                  |«       w xY wr+   )r   ÚgetcwdÚchdirr   r   ÚrepoÚworking_tree_dir)r$   r=   r>   Úcur_wdr;   s       €r(   Úset_git_working_dirz,git_working_dir.<locals>.set_git_working_dirj   s[   ø€ ä—‘“ˆÜ
�‰””h §	¡	× :Ñ :Ó;Ô<ð	Ù˜Ð.˜tÒ. vÑ.ä�H‰H�VÕøŒB�H‰H�VÕús   ÁA/ Á/BrC   )r;   rQ   s   ` r(   r   r   f   s?   ø€ ô ˆ4ƒ[ð +ð ´cð ÄSð ÌRô ó ðð Ðr.   ) r8   Ú__all__r    Ú	functoolsr   r   Úos.pathÚpathr   Ústructr   Útypesr   Útypingr	   r
   r   r   r   r   Ú	git.typesr   r   r   Ú	git.indexr   ÚpackÚunpackr   r   r   r   r,   r.   r(   ú<module>r]      sÆ   ðñ â
W€ã Ý Û 	Ý Û Û Ý ÷ F× Eç +Ñ +áÝ#ð
 ‡{�{€Ø	�‰€÷ñ ð>*˜8 C¨ GÑ,ð *°¸#¸r¸'Ñ1Bó *ð$˜  b Ñ)ð ¨h°s¸B°wÑ.?ó ð(˜( 3¨ 7Ñ+ð °¸¸b¸Ñ0Aô r.   