
    g                        d Z g dZddlmZmZmZmZmZmZm	Z	m
Z
 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(y%)&z-Exceptions thrown throughout the git package.)AmbiguousObjectNameBadName	BadObjectBadObjectTypeInvalidDBRootODBError
ParseErrorUnsupportedOperationGitErrorInvalidGitRepositoryErrorWorkTreeRepositoryUnsupportedNoSuchPathErrorUnsafeProtocolErrorUnsafeOptionErrorCommandErrorGitCommandNotFoundGitCommandErrorCheckoutError
CacheErrorUnmergedEntriesErrorHookExecutionErrorRepositoryDirtyError    )r   r   r   r   r   r   r   r	   safe_decode)remove_password_if_present)ListSequenceTupleTYPE_CHECKINGUnion)PathLike)Repoc                       e Zd ZdZy)r
   z&Base class for all package exceptions.N__name__
__module____qualname____doc__     </var/www/openai/venv/lib/python3.12/site-packages/git/exc.pyr
   r
   =   s    0r*   r
   c                       e Zd ZdZy)r   zAThrown if the given repository appears to have an invalid format.Nr$   r)   r*   r+   r   r   A   s    Kr*   r   c                       e Zd ZdZy)r   z:Thrown to indicate we can't handle work tree repositories.Nr$   r)   r*   r+   r   r   E   s    Dr*   r   c                       e Zd ZdZy)r   z3Thrown if a path could not be access by the system.Nr$   r)   r*   r+   r   r   I   s    =r*   r   c                       e Zd ZdZy)r   zGThrown if unsafe protocols are passed without being explicitly allowed.Nr$   r)   r*   r+   r   r   M   s    Qr*   r   c                       e Zd ZdZy)r   zEThrown if unsafe options are passed without being explicitly allowed.Nr$   r)   r*   r+   r   r   Q   s    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y)r   zBase class for exceptions thrown at every stage of :class:`~subprocess.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|j                         }t	        |      | _        || _        |rMt        |t              r.t        |      j                  dt        t        |            d}n	 dt        |      z  }t        | j
                  d         | _        dj!                  d | j
                  D              | _        |xr d|z  xs d	| _        t        |      }t        |      }|xr d
|z  xs d| _        |xr d|z  xs d| _        y # t        t        f$ r. t        t        |            }t        |t              rd|z  n|}Y w xY w)Nz('z')zexit code(%s)z'%s'r    c              3   2   K   | ]  }t        |        y wNr   ).0is     r+   	<genexpr>z(CommandError.__init__.<locals>.<genexpr>{   s      FAQs   z due to: %s!z
  stdout: '%s' z
  stderr: '%s')
isinstancetuplelistsplitr   r2   r3   	Exceptiontyper%   r   strint
ValueError	TypeError_cmdjoin_cmdline_causer5   r4   )selfr2   r3   r4   r5   sstdout_decodestderr_decodes           r+   __init__zCommandError.__init__e   s0    'E4=1mmoG1':&),'+F|'<'<k#f+>VWJ,s6{:F
  Q0	 F FF7!7>3#F+#F+#J(:](JPb#J(:](JPb #I. J#CK0A+5fc+BVaZFJs   ?D :EEc                     | j                   dz   | j                  | j                  | j                  | j                  | j
                  fz  S )Nz
  cmdline: %s%s%s)_msgrJ   rM   rL   r5   r4   rN   s    r+   __str__zCommandError.__str__   sA    		11IIKKMMKKKK6
 
 	
r*   NNN)r%   r&   r'   r(   rT   r    r   rF   r   rG   rD   bytesrR   rV   r)   r*   r+   r   r   U   s      D 48*.*.QtCy%S/367Q c3i/0Q eS$&'	Q
 eS$&'Q 
Q:
 
r*   r   c                   R     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 )r   zThrown if we cannot find the ``git`` executable in the :envvar:`PATH` or at the
    path given by the :envvar:`GIT_PYTHON_GIT_EXECUTABLE` environment variable.r2   causer6   Nc                 4    t         |   ||       d| _        y )NzCmd('%s') not found%ssuperrR   rT   )rN   r2   rZ   	__class__s      r+   rR   zGitCommandNotFound.__init__   s    %(+	r*   )r%   r&   r'   r(   r    r   rF   r   rD   rR   __classcell__r^   s   @r+   r   r      sI    S,d3isS&@ A ,%PSU^P^J_ ,dh , ,r*   r   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 )r   zGThrown if execution of the git command fails with non-zero status code.Nr2   .r3   r4   r5   r6   c                 *    t         |   ||||       y r:   )r]   rR   rN   r2   r3   r4   r5   r^   s        r+   rR   zGitCommandError.__init__   s     	&&&9r*   rW   r%   r&   r'   r(   r    r   rF   r   rG   rD   rX   rR   r_   r`   s   @r+   r   r      s    Q
 48*.*.:tCy%S/367: c3i/0: eS$&'	:
 eS$&': 
: :r*   r   c            
       J    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	y)
r   a  Thrown if a file could not be checked out from the index as it contained
    changes.

    The :attr:`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 :attr:`failed_reasons` attribute contains a string informing about the actual
    cause of the issue.

    The :attr:`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_reasonsr6   Nc                 Z    t         j                  | |       || _        || _        || _        y r:   )rD   rR   rg   ri   rh   )rN   rf   rg   rh   ri   s        r+   rR   zCheckoutError.__init__   s,     	4)(,&r*   c                 L    t         j                  |       d| j                  z  z   S )Nz:%s)rD   rV   rg   rU   s    r+   rV   zCheckoutError.__str__   s#      &1B1B)BBBr*   )
r%   r&   r'   r(   rF   r   r!   r   rR   rV   r)   r*   r+   r   r      sX    
'
' x(
' h'	
'
 S	
' 

'C Cr*   r   c                       e Zd ZdZy)r   zUBase for all errors related to the git index, which is called "cache"
    internally.Nr$   r)   r*   r+   r   r      s    r*   r   c                       e Zd ZdZy)r   z[Thrown if an operation cannot proceed as there are still unmerged
    entries in the cache.Nr$   r)   r*   r+   r   r      s    r*   r   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 )r   zThrown if a hook exits with a non-zero exit code.

    This provides access to the exit code and the string returned via standard output.
    Nr2   .r3   r4   r5   r6   c                 8    t         |   ||||       d| _        y )NzHook('%s') failed%sr\   rc   s        r+   rR   zHookExecutionError.__init__   s     	&&&9)	r*   )NNrd   r`   s   @r+   r   r      s     +/*.*tCy%S/367* c3i/0* eS$&'	*
 eS$&'* 
* *r*   r   c                   0    e Zd ZdZdddeddfdZdefdZy)	r   zoThrown whenever an operation on a repository fails as it has uncommitted changes
    that would be overwritten.repor"   rf   r6   Nc                      || _         || _        y r:   rq   rf   )rN   rq   rf   s      r+   rR   zRepositoryDirtyError.__init__   s    	r*   c                 :    d| j                   d| j                  S )Nz!Operation cannot be performed on z: rs   rU   s    r+   rV   zRepositoryDirtyError.__str__   s    <@IIt||TTr*   )r%   r&   r'   r(   rF   rR   rV   r)   r*   r+   r   r      s/    "V c d U Ur*   r   N))r(   __all__	gitdb.excr   r   r   r   r   r   r   r	   
git.compatr   git.utilr   typingr   r   r   r   r    	git.typesr!   git.repo.baser"   rD   r
   r   r   OSErrorr   r   r   r   r   r   r   r   r   r   r   r)   r*   r+   <module>r}      s    46	 	 	 # / ? > "
1y 1L LE$= E>h >R( RP P4
8 4
n, ,
:l 
:CH C< 
: 
* *"	U8 	Ur*   