o
    ﯪg                     @   sj  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rBddlmZ G d	d
 d
eZG dd deZG dd deZG dd deeZG dd deZG dd deZ G dd deZ!G dd de!Z"G dd de!Z#G dd deZ$G dd deZ%G dd  d e%Z&G d!d" d"e!Z'G d#d$ d$eZ(d%S )&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dS )r	   z&Base class for all package exceptions.N__name__
__module____qualname____doc__ r(   r(   C/var/www/html/chatdoc2/venv/lib/python3.10/site-packages/git/exc.pyr	   =       r	   c                   @   r"   )r
   zAThrown if the given repository appears to have an invalid format.Nr#   r(   r(   r(   r)   r
   A   r*   r
   c                   @   r"   )r   z:Thrown to indicate we can't handle work tree repositories.Nr#   r(   r(   r(   r)   r   E   r*   r   c                   @   r"   )r   z3Thrown if a path could not be access by the system.Nr#   r(   r(   r(   r)   r   I   r*   r   c                   @   r"   )r   zGThrown if unsafe protocols are passed without being explicitly allowed.Nr#   r(   r(   r(   r)   r   M   r*   r   c                   @   r"   )r   zEThrown if unsafe options are passed without being explicitly allowed.Nr#   r(   r(   r(   r)   r   Q   r*   r   c                   @   s   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
dZd	efddZdS )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              	   C   s  t |ttfs| }t|| _|| _|rMt |tr(dt|j	t
t|f }n%zdt| }W n ttfyL   t
t|}t |trHd| n|}Y nw t
| jd | _ddd | jD | _|rgd| phd	| _t
|}t
|}|rxd
| pyd| _|rd| pd| _d S )Nz%s('%s')zexit code(%s)z'%s'r    c                 s   s    | ]}t |V  qd S Nr   ).0ir(   r(   r)   	<genexpr>{   s    z(CommandError.__init__.<locals>.<genexpr>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_decoder(   r(   r)   __init__e   s(   

zCommandError.__init__c                 C   s"   | j d | j| j| j| j| jf S )Nz
  cmdline: %s%s%s)_msgrA   rD   rC   r.   r-   rE   r(   r(   r)   __str__   s   zCommandError.__str__NNN)r$   r%   r&   r'   rJ   r   r   r=   r   r>   r;   bytesrI   rL   r(   r(   r(   r)   r   U   s&    

r   c                       sH   e Zd ZdZdeee ee ef deeef ddf fddZ	  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.r+   causer/   Nc                    s   t  || d| _d S )NzCmd('%s') not found%ssuperrI   rJ   )rE   r+   rO   	__class__r(   r)   rI      s   
zGitCommandNotFound.__init__)r$   r%   r&   r'   r   r   r=   r   r;   rI   __classcell__r(   r(   rR   r)   r      s    <r   c                       st   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	d
Z  ZS )r   zGThrown if execution of the git command fails with non-zero status code.Nr+   .r,   r-   r.   r/   c                    s   t  |||| d S r1   )rQ   rI   rE   r+   r,   r-   r.   rR   r(   r)   rI      s   zGitCommandError.__init__rM   r$   r%   r&   r'   r   r   r=   r   r>   r;   rN   rI   rT   r(   r(   rR   r)   r      s     r   c                
   @   sH   e Zd ZdZdedee dee dee ddf
dd	Zdefd
dZ	dS )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_reasonsr/   Nc                 C   s"   t | | || _|| _|| _d S r1   )r;   rI   rX   rZ   rY   )rE   rW   rX   rY   rZ   r(   r(   r)   rI      s   
zCheckoutError.__init__c                 C   s   t | d| j  S )Nz:%s)r;   rL   rX   rK   r(   r(   r)   rL      s   zCheckoutError.__str__)
r$   r%   r&   r'   r=   r   r    r   rI   rL   r(   r(   r(   r)   r      s    
r   c                   @   r"   )r   zUBase for all errors related to the git index, which is called "cache"
    internally.Nr#   r(   r(   r(   r)   r      r*   r   c                   @   r"   )r   z[Thrown if an operation cannot proceed as there are still unmerged
    entries in the cache.Nr#   r(   r(   r(   r)   r      r*   r   c                       sr   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	d
Z  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.
    Nr+   .r,   r-   r.   r/   c                    s   t  |||| d| _d S )NzHook('%s') failed%srP   rU   rR   r(   r)   rI      s   
zHookExecutionError.__init__)NNrV   r(   r(   rR   r)   r      s    	r   c                   @   s4   e Zd ZdZdddeddfddZdefd	d
ZdS )r   zoThrown whenever an operation on a repository fails as it has uncommitted changes
    that would be overwritten.repor!   rW   r/   Nc                 C   s   || _ || _d S r1   r[   rW   )rE   r[   rW   r(   r(   r)   rI      s   
zRepositoryDirtyError.__init__c                 C   s   d| j | jf S )Nz'Operation cannot be performed on %r: %sr\   rK   r(   r(   r)   rL      s   zRepositoryDirtyError.__str__)r$   r%   r&   r'   r=   rI   rL   r(   r(   r(   r)   r      s    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!   r;   r	   r
   r   OSErrorr   r   r   r   r   r   r   r   r   r   r   r(   r(   r(   r)   <module>   s.   (7	