
    chK                     T   S r / SQrSSKrSSKJr  SSKrSSKJr  SSK	r	SSK
r
SSKJr  SSKJrJrJrJrJr  SSKJrJrJr  \(       a  SSKJr  \	R2                  r\	R4                  r " S	 S
5      rS\S\4   S\S\4   4S jrS\S\4   S\S\4   4S jrS\S\4   S\S\4   4S jrg)zIndex utilities.)TemporaryFileSwappost_clear_cachedefault_indexgit_working_dir    N)wraps)TracebackType)AnyCallableTYPE_CHECKINGOptionalType)LiteralPathLike_T)	IndexFilec            	       p    \ rS rSrSrSrS\SS4S jrSS jrS	\	\
\      S
\	\   S\	\   S\S   4S jrSrg)r   !   zUtility 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                 `   Xl         [        R                  " U5      u  p#[        R                  " X2S9u  o@l        [        R                  " U5        [        R                  " [        5         [        R                  " U R                   U R
                  5        S S S 5        g ! , (       d  f       g = f)N)prefixdir)r   ospsplittempfilemkstempr   osclose
contextlibsuppressOSErrorreplace)selfr   dirnamebasenamefds        aC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\git/index/util.py__init__TemporaryFileSwap.__init__'   sk    "IIi0!)!1!1!O
  )JJt~~t'9'9: *))s   *,B
B-c                     U $ N )r$   s    r(   	__enter__TemporaryFileSwap.__enter__/   s        exc_typeexc_valexc_tbFc                     [         R                  " U R                  5      (       a+  [        R                  " U R                  U R
                  5        g)NF)r   isfiler   r   r#   r   )r$   r1   r2   r3   s       r(   __exit__TemporaryFileSwap.__exit__2   s4     ::d(())JJt))4>>:r0   )r   r   )__name__
__module____qualname____firstlineno____doc__	__slots__r   r)   r.   r   r   BaseExceptionr   r   r6   __static_attributes__r-   r0   r(   r   r   !   si    6 /I;( ;t ;4./ -( '	
 
r0   r   func.r   c           	      \   ^  [        T 5      SSS[        S[        S[        4U 4S jj5       nU$ )zDecorator 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                 @   > T" U /UQ70 UD6nU R                  5         U$ r,   )_delete_entries_cache)r$   rB   rC   rvalr@   s       r(   post_clear_cache_if_not_raised8post_clear_cache.<locals>.post_clear_cache_if_not_raisedG   s(    D*4*6*""$r0   r   r	   r   )r@   rG   s   ` r(   r   r   @   sA     4[[  PS XZ   *)r0   c           	      \   ^  [        T 5      SSS[        S[        S[        4U 4S jj5       nU$ )zDecorator 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   rB   rC   r   c                    > U R                   U R                  5       :w  a  [        STR                  -  5      eT" U /UQ70 UD6$ )NzECannot call %r on indices that do not represent the default git index)
_file_path_index_pathAssertionErrorr8   )r$   rB   rC   r@   s      r(   check_default_index*default_index.<locals>.check_default_indexY   sK    ??d..00 WZ^ZgZgg  D*4*6**r0   rI   )r@   rO   s   ` r(   r   r   R   s?     4[++ +c +S +R + + r0   c           	      \   ^  [        T 5      SSS[        S[        S[        4U 4S jj5       nU$ )zDecorator which changes the current working dir to the one of the git
repository in order to ensure relative paths are handled correctly.r$   r   rB   rC   r   c                   > [         R                  " 5       n[         R                  " [        U R                  R
                  5      5         T" U /UQ70 UD6[         R                  " U5        $ ! [         R                  " U5        f = fr,   )r   getcwdchdirstrrepoworking_tree_dir)r$   rB   rC   cur_wdr@   s       r(   set_git_working_dir,git_working_dir.<locals>.set_git_working_dirj   sY    
TYY//01	.t.v.HHVBHHVs   A- -BrI   )r@   rY   s   ` r(   r   r   f   s?     4[+ c S R   r0   )r<   __all__r    	functoolsr   r   os.pathpathr   structr   typesr   typingr	   r
   r   r   r   	git.typesr   r   r   	git.indexr   packunpackr   r   r   r   r-   r0   r(   <module>rf      s    
W   	     @ ? + +#
 {{	 >*8CG, *#r'1B *$b) hsBw.? ((37+ b0A r0   