
                            S r SSKr " S S\5      r " S S\5      r " S S\5      r " S	 S
\5      r " S S\5      r " S S\5      r " S S\5      r	 " S S\5      r
 " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S \5      r " S! S"\5      r " S# S$\5      r " S% S&\5      r " S' S(\5      r " S) S*\5      r " S+ S,\5      r " S- S.\5      rg)/z8Dulwich-related exception classes and utility functions.    Nc                   "    \ rS rSrSrSS jrSrg)ChecksumMismatch   z.A checksum didn't match the expected contents.Nc           	      X   [        U5      S:X  a  [        R                  " U5      n[        U5      S:X  a  [        R                  " U5      nXl        X l        X0l        U R
                  c  [        R                  U SU< SU< 35        g [        R                  U SU< SU< SU< 35        g )N   zChecksum mismatch: Expected z, got z; )lenbinasciihexlifyexpectedgotextra	Exception__init__)selfr   r   r   s       !lib/third_party/dulwich/errors.pyr   ChecksumMismatch.__init__   s    x=B''1Hs8r>""3'C 
::<DcJ
 @H#uU    )r   r   r   N__name__
__module____qualname____firstlineno____doc__r   __static_attributes__ r   r   r   r      s
    8r   r   c                       \ rS rSrSrS rSrg)WrongObjectException2   zBaseclass for all the _ is not a _ exceptions on objects.

Do not instantiate directly.

Subclasses should define a type_name attribute that indicates what
was expected if they were raised.
c                 P    [         R                  X< SU R                  < 35        g )Nz
 is not a )r   r   	type_namer   shaargskwargss       r   r   WrongObjectException.__init__;   s    4S$..!IJr   r   Nr   r   r   r   r   r   2   s    Kr   r   c                       \ rS rSrSrSrSrg)NotCommitError?   z<Indicates that the sha requested does not point to a commit.commitr   Nr   r   r   r   r   r!   r   r   r   r   r(   r(   ?   s
    FIr   r(   c                       \ rS rSrSrSrSrg)NotTreeErrorE   z:Indicates that the sha requested does not point to a tree.treer   Nr+   r   r   r   r-   r-   E   
    DIr   r-   c                       \ rS rSrSrSrSrg)NotTagErrorK   z9Indicates that the sha requested does not point to a tag.tagr   Nr+   r   r   r   r2   r2   K   s
    CIr   r2   c                       \ rS rSrSrSrSrg)NotBlobErrorQ   z:Indicates that the sha requested does not point to a blob.blobr   Nr+   r   r   r   r6   r6   Q   r0   r   r6   c                       \ rS rSrSrS rSrg)MissingCommitErrorW   z7Indicates that a commit was not found in the repositoryc                 B    Xl         [        R                  U SU-  5        g )Nz%s is not in the revision store)r#   r   r   r"   s       r   r   MissingCommitError.__init__Z   s    4!BS!HIr   )r#   Nr   r   r   r   r:   r:   W   s    AJr   r:   c                       \ rS rSrSrS rSrg)ObjectMissing_   z-Indicates that a requested object is missing.c                 6    [         R                  U SU-  5        g )Nz%s is not in the packr   r   r"   s       r   r   ObjectMissing.__init__b   s    4!83!>?r   r   Nr   r   r   r   r?   r?   _   s    7@r   r?   c                       \ rS rSrSrS rSrg)ApplyDeltaErrorf   z'Indicates that applying a delta failed.c                 8    [         R                  " U /UQ70 UD6  g r   rB   r   r$   r%   s      r   r   ApplyDeltaError.__init__i       41$1&1r   r   Nr   r   r   r   rE   rE   f   s
    12r   rE   c                       \ rS rSrSrS rSrg)NotGitRepositorym   z+Indicates that no Git repository was found.c                 8    [         R                  " U /UQ70 UD6  g r   rB   rH   s      r   r   NotGitRepository.__init__p   rJ   r   r   Nr   r   r   r   rL   rL   m   s
    52r   rL   c                   $    \ rS rSrSrS rS rSrg)GitProtocolErrort   zGit protocol exception.c                 8    [         R                  " U /UQ70 UD6  g r   rB   rH   s      r   r   GitProtocolError.__init__w   rJ   r   c                 l    [        U [        U5      5      =(       a    U R                  UR                  :H  $ r   )
isinstancetyper$   r   others     r   __eq__GitProtocolError.__eq__z   s%    $U,Hejj1HHr   r   N)r   r   r   r   r   r   rZ   r   r   r   r   rQ   rQ   t   s    !2Ir   rQ   c                       \ rS rSrSrSrg)SendPackError~   z#An error occurred during send_pack.r   Nr   r   r   r   r   r   r   r   r   r]   r]   ~   s    -r   r]   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )UpdateRefsError   z)The server reported errors updating refs.c                 Z   > UR                  S5      U l        [        [        U ]  " U0 UD6  g )N
ref_status)poprd   superra   r   )r   r$   r%   	__class__s      r   r   UpdateRefsError.__init__   s'     **\2ot-t>v>r   )rd   r   r   r   r   r   r   r   __classcell__rg   s   @r   ra   ra      s    3? ?r   ra   c                   6   ^  \ rS rSrSrSU 4S jjrS rSrU =r$ )HangupException   zHangup exception.c                    > U(       aC  [         [        U ]  SR                  U Vs/ s H  o"R	                  SS5      PM     sn5      5        O[         [        U ]  S5        Xl        g s  snf )N
zutf-8surrogateescapez5The remote server unexpectedly closed the connection.)rf   rm   r   joindecodestderr_lines)r   rt   linerg   s      r   r   HangupException.__init__   s_    /41		IUV[[*;<V /41G ) Ws   A&c                 l    [        U [        U5      5      =(       a    U R                  UR                  :H  $ r   )rV   rW   rt   rX   s     r   rZ   HangupException.__eq__   s)    $U,X1B1BeFXFX1XXr   )rt   r   )	r   r   r   r   r   r   rZ   r   rj   rk   s   @r   rm   rm      s    )Y Yr   rm   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )UnexpectedCommandError   z,Unexpected command received in a proto line.c                 H   > Uc  SnOSU-  n[         [        U ]  SU-  5        g )Nz	flush-pktz
command %szProtocol got unexpected %s)rf   rz   r   )r   commandrg   s     r   r   UnexpectedCommandError.__init__   s/    ?!G"W,G$d4(72	
r   r   ri   rk   s   @r   rz   rz      s    6
 
r   rz   c                       \ rS rSrSrSrg)FileFormatException   z?Base class for exceptions relating to reading git file formats.r   Nr_   r   r   r   r   r      s    Ir   r   c                       \ rS rSrSrSrg)PackedRefsException   z.Indicates an error parsing a packed-refs file.r   Nr_   r   r   r   r   r      s    8r   r   c                       \ rS rSrSrSrg)ObjectFormatException   z%Indicates an error parsing an object.r   Nr_   r   r   r   r   r      s    /r   r   c                       \ rS rSrSrSrg)NoIndexPresent   zNo index is present.r   Nr_   r   r   r   r   r      s    r   r   c                       \ rS rSrSrSrg)CommitError   z,An error occurred while performing a commit.r   Nr_   r   r   r   r   r      s    6r   r   c                       \ rS rSrSrSrg)RefFormatError   zIndicates an invalid ref name.r   Nr_   r   r   r   r   r      s    (r   r   c                       \ rS rSrSrSrg)	HookError   z)An error occurred while executing a hook.r   Nr_   r   r   r   r   r      s    3r   r   )r   r	   r   r   r   r(   r-   r2   r6   r:   r?   rE   rL   rQ   r]   ra   rm   rz   r   r   r   r   r   r   r   r   r   r   <module>r      s+  , ? y .
K9 
K) ' & ' J J@I @2i 22y 2Iy I.$ .?& ?Y& Y(

- 

J) J9- 90/ 0Y 7) 7)Y )4	 4r   