
    64%e&                        d Z ddlmZ ddlT ddlmZ ddlmZ ddlmZm	Z	m
Z
mZmZ ddlmZ erddlmZ  G d	 d
e          Z G d de          Z G d de          Z G d dee          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d d e          Z G d! d"e          Z G d# d$e          Z d%S )&zE Module containing all exceptions thrown throughout the git package,     )BadName)*safe_decode)remove_password_if_present)ListSequenceTupleUnionTYPE_CHECKING)PathLike)Repoc                       e Zd ZdZdS )GitErrorz%Base class for all package exceptionsN__name__
__module____qualname____doc__     'lib/python3.11/site-packages/git/exc.pyr   r      s        ////r   r   c                       e Zd ZdZdS )InvalidGitRepositoryErrorzAThrown if the given repository appears to have an invalid format.Nr   r   r   r   r   r      s        KKKKr   r   c                       e Zd ZdZdS )WorkTreeRepositoryUnsupportedz9Thrown to indicate we can't handle work tree repositoriesNr   r   r   r   r   r       s        CCCCr   r   c                       e Zd ZdZdS )NoSuchPathErrorz3Thrown if a path could not be access by the system.Nr   r   r   r   r   r   $   s        ====r   r   c                       e Zd ZdZdS )UnsafeProtocolErrorzGThrown if unsafe protocols are passed without being explicitly allowed.Nr   r   r   r   r    r    (   s        QQQQr   r    c                       e Zd ZdZdS )UnsafeOptionErrorzEThrown if unsafe options are passed without being explicitly allowed.Nr   r   r   r   r"   r"   ,   s        OOOOr   r"   c                       e Zd ZdZdZ	 	 	 ddeee         eedf         ef         deee	de
f         deeedf         deeedf         d	df
d
Zd	efdZdS )CommandErrorzBase class for exceptions thrown at every stage of `Popen()` execution.

    :param command:
        A non-empty list of argv comprising the command-line.
    zCmd('%s') failed%sNcommand.statusstderrstdoutreturnc                    t          |t          t          f          s|                                }t	          |          | _        || _        |rt          |t                    r5t          |          j	        dt          t          |                    d}nc	 dt          |          z  }nO# t          t          f$ r; t          t          |                    }t          |t                    rd|z  n|}Y nw xY wt          | j        d                   | _        d                    d | j        D                       | _        |rd|z  pd	| _        t          |          }t          |          }|rd
|z  pd| _        |rd|z  pd| _        d S )Nz('z')zexit code(%s)z'%s'r    c              3   4   K   | ]}t          |          V  d S Nr   ).0is     r   	<genexpr>z(CommandError.__init__.<locals>.<genexpr>R   s(       F FAQ F F F F F Fr   z due to: %s!z
  stdout: '%s' z
  stderr: '%s')
isinstancetuplelistsplitr   r%   r&   	Exceptiontyper   r   strint
ValueError	TypeError_cmdjoin_cmdline_causer(   r'   )selfr%   r&   r'   r(   sstdout_decodestderr_decodes           r   __init__zCommandError.__init__<   s    'E4=11 	&mmooG1':: 	J&),, J'+F||'<'<'<k#f++>V>V>V>VWJ,s6{{:FF"I. J J J#CKK00A+5fc+B+BIVaZZFFFJ  Q00	 F F F F FFF7!7>3#F++#F++#J(:](JPb#J(:](JPbs   B, ,A	C87C8c                 X    | j         dz   | j        | j        | j        | j        | j        fz  S )Nz
  cmdline: %s%s%s)_msgr=   r@   r?   r(   r'   rA   s    r   __str__zCommandError.__str__Y   s5    	11IKMKK6
 
 	
r   NNN)r   r   r   r   rG   r   r   r9   r
   r:   r7   bytesrE   rI   r   r   r   r$   r$   0   s           D
 48*.*.Q QtCy%S/367Q c3i/0Q eS$&'	Q
 eS$&'Q 
Q Q Q Q:
 
 
 
 
 
 
r   r$   c                   j     e Zd ZdZdeee         ee         ef         deeef         ddf fdZ	 xZ
S )GitCommandNotFoundzThrown if we cannot find the `git` executable in the PATH or at the path given by
    the GIT_PYTHON_GIT_EXECUTABLE environment variabler%   causer)   Nc                 h    t          t          |                               ||           d| _        d S )NzCmd('%s') not found%s)superrM   rE   rG   )rA   r%   rN   	__class__s      r   rE   zGitCommandNotFound.__init__g   s/     $''00%@@@+			r   )r   r   r   r   r   r   r9   r
   r7   rE   __classcell__rQ   s   @r   rM   rM   c   s}        : :,d3isS&@ A ,%PSU^P^J_ ,dh , , , , , , , , , ,r   rM   c                        e Zd ZdZ	 	 	 d
deee         eedf         ef         deeede	f         dee
edf         dee
edf         ddf
 fd	Z xZS )GitCommandErrorzGThrown if execution of the git command fails with non-zero status code.Nr%   .r&   r'   r(   r)   c                 ^    t          t          |                               ||||           d S r-   )rP   rU   rE   rA   r%   r&   r'   r(   rQ   s        r   rE   zGitCommandError.__init__o   s/     	ot$$--gvvvNNNNNr   rJ   r   r   r   r   r   r   r9   r
   r:   r7   rK   rE   rR   rS   s   @r   rU   rU   l   s        QQ
 48*.*.O OtCy%S/367O c3i/0O eS$&'	O
 eS$&'O 
O O O O O O O O O Or   rU   c            
       ^    e Zd ZdZdedee         dee         dee         ddf
dZdefd	Z	dS )
CheckoutErrora  Thrown if a file could not be checked out from the index as it contained
    changes.

    The .failed_files attribute contains a list of relative paths that failed
    to be checked out as they contained changes that did not exist in the index.

    The .failed_reasons attribute contains a string informing about the actual
    cause of the issue.

    The .valid_files attribute contains a list of relative paths to files that
    were checked out successfully and hence match the version stored in the
    indexmessagefailed_filesvalid_filesfailed_reasonsr)   Nc                 f    t                               | |           || _        || _        || _        d S r-   )r7   rE   r\   r^   r]   )rA   r[   r\   r]   r^   s        r   rE   zCheckoutError.__init__   s8     	4)))(,&r   c                 L    t                               |           d| j        z  z   S )Nz:%s)r7   rI   r\   rH   s    r   rI   zCheckoutError.__str__   s#      &&1B)BBBr   )
r   r   r   r   r9   r	   r   r   rE   rI   r   r   r   rZ   rZ   y   s         
'
' x(
' h'	
'
 S	
' 

' 
' 
' 
'C C C C C C Cr   rZ   c                       e Zd ZdZdS )
CacheErrorzNBase for all errors related to the git index, which is called cache internallyNr   r   r   r   rb   rb      s        XXXXr   rb   c                       e Zd ZdZdS )UnmergedEntriesErrorzZThrown if an operation cannot proceed as there are still unmerged
    entries in the cacheNr   r   r   r   rd   rd      s           r   rd   c                        e Zd ZdZ	 	 d
deee         eedf         ef         deeede	f         dee
edf         dee
edf         ddf
 fd	Z xZS )HookExecutionErrorzThrown if a hook exits with a non-zero exit code. It provides access to the exit code and the string returned
    via standard outputNr%   .r&   r'   r(   r)   c                 l    t          t          |                               ||||           d| _        d S )NzHook('%s') failed%s)rP   rf   rE   rG   rW   s        r   rE   zHookExecutionError.__init__   s5     	 $''00&&&QQQ)			r   )NNrX   rS   s   @r   rf   rf      s          +/*.* *tCy%S/367* c3i/0* eS$&'	*
 eS$&'* 
* * * * * * * * * *r   rf   c                   2    e Zd ZdZdddeddfdZdefdZdS )	RepositoryDirtyErrorzjThrown whenever an operation on a repository fails as it has uncommitted changes that would be overwrittenrepor   r[   r)   Nc                 "    || _         || _        d S r-   rj   r[   )rA   rj   r[   s      r   rE   zRepositoryDirtyError.__init__   s    	r   c                 &    d| j         d| j        S )Nz!Operation cannot be performed on z: rl   rH   s    r   rI   zRepositoryDirtyError.__str__   s     <@IIIt||TTr   )r   r   r   r   r9   rE   rI   r   r   r   ri   ri      se        ttV c d    U U U U U U Ur   ri   N)!r   	gitdb.excr   
git.compatr   git.utilr   typingr   r	   r
   r   r   	git.typesr   git.repo.baser   r7   r   r   r   OSErrorr   r    r"   r$   rM   rU   rZ   rb   rd   rf   ri   r   r   r   <module>ru      sD   L K           " " " " " " / / / / / / ? > > > > > > > > > > > > >       #""""""
0 0 0 0 0y 0 0 0L L L L L L L LD D D D D$= D D D> > > > >h > > >R R R R R( R R RP P P P P P P P0
 0
 0
 0
 0
8 0
 0
 0
f, , , , , , , ,
O 
O 
O 
O 
Ol 
O 
O 
OC C C C CH C C C<Y Y Y Y Y Y Y Y
    :   
* * * * * * * *U U U U U8 U U U U Ur   