ó
    ‘óýjl.  ã                   óö   • S r / SQrSSKrSSKrSSKJrJr  SSKJr  SSK	J
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)zAccess to hooks.)ÚCommitMsgShellHookÚHookÚPostCommitShellHookÚPostReceiveShellHookÚPreCommitShellHookÚPreReceiveShellHookÚ	ShellHookÚUpdateShellHooké    N)ÚCallableÚSequence)ÚAnyé   )Ú	HookErrorc                   ó*   • \ rS rSrSrS\S\4S jrSrg)r   é+   zGeneric hook object.ÚargsÚreturnc                 ó,   • [        U R                  5      e)z£Execute the hook with the given args.

Args:
  args: argument list to hook
Raises:
  HookError: hook execution failure
Returns:
  a hook may return a useful value
)ÚNotImplementedErrorÚexecute)Úselfr   s     Ú8/usr/local/lib/python3.13/site-packages/dulwich/hooks.pyr   ÚHook.execute.   s   € ô " $§,¡,Ó/Ð/ó    © N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   Ú__static_attributes__r   r   r   r   r   +   s   † Ùð
0˜Sð 
0 S÷ 
0r   r   c                   ó€   • \ rS rSrSr   SS\S\S\S\S\4   S-  S	\S\4   S-  S
\S-  SS4S jjr	S\S\4S jr
Srg)r   é;   z‚Hook by executable file.

Implements standard githooks(5) [0]:

[0] http://www.kernel.org/pub/software/scm/git/docs/githooks.html
NÚnameÚpathÚnumparamÚpre_exec_callback.Úpost_exec_callbackÚcwdr   c                 óL   • Xl         X l        X0l        X@l        XPl        X`l        g)a€  Setup shell hook definition.

Args:
  name: name of hook for error messages
  path: absolute path to executable file
  numparam: number of requirements parameters
  pre_exec_callback: closure for setup before execution
    Defaults to None. Takes in the variable argument list from the
    execute functions and returns a modified argument list for the
    shell hook.
  post_exec_callback: closure for cleanup after execution
    Defaults to None. Takes in a boolean for hook success and the
    modified argument list and returns the final hook return value
    if applicable
  cwd: working directory to switch to when executing the hook
N)r$   Úfilepathr&   r'   r(   r)   )r   r$   r%   r&   r'   r(   r)   s          r   Ú__init__ÚShellHook.__init__C   s$   € ð2 Œ	ØŒØ Œà!2ÔØ"4Ôà�r   r   c           
      ó¸  • [        U5      U R                  :w  a4  [        SU R                   SU R                   S[        U5       SU 35      eU R                  b  U R                  " U6 n [
        R                  " [        R                  R                  U R                  U R                  5      /[        U5      QU R                  S9nUS:w  a;  U R                  b  U R                  " S/UQ76   [        SU R                   SU 35      eU R                  b  U R                  " S	/UQ76 $ g! [         a%    U R                  b  U R                  " S/UQ76    g gf = f)
z!Execute the hook with given args.zHook z. executed with wrong number of args. Expected z. Saw z. args: N©r)   r
   z exited with non-zero status r   )Úlenr&   r   r$   r'   Ú
subprocessÚcallÚosr%   Úrelpathr+   r)   Úlistr(   ÚFileNotFoundError)r   r   Úrets      r   r   ÚShellHook.executee   sQ  € äˆt‹9˜Ÿ™Ó%ÜØ˜Ÿ	™	�{Ð"PÐQU×Q^ÑQ^ÐP_Ð_eÔfiÐjnÓfoÐepÐpxÐy}Ðx~Ðóð ð ×!Ñ!Ñ-Ø×)Ò)¨4Ð0ˆDð	2Ü—/’/Ü—‘—‘ §¡°·±Ó9ÐG¼DÀ»JÐGÈTÏXÉXñˆCð �a‹xØ×*Ñ*Ñ6Ø×+Ò+¨AÐ5°Ó5Ü %¨¯	©	 {Ð2OÐPSÈuÐ UÓVÐVØ×&Ñ&Ñ2Ø×.Ò.¨qÐ8°4Ò8Ð8ð 3øä ó 	2Ø×&Ñ&Ñ2Ø×'Ò'¨Ð1¨DÕ1ñ 3ð	2ús   Á+B=D* Ä**EÅE)r)   r+   r$   r&   r(   r'   )NNN)r   r   r   r   r    ÚstrÚintr   r   r,   r   r!   r   r   r   r   r   ;   s�   † ñð 8<Ø8<Øñ àð ð ð ð ð	 ð
 $ C¨ HÑ-°Ñ4ð ð % S¨# XÑ.°Ñ5ð ð �4‰Zð ð 
õ ðD2˜Sð 2 S÷ 2r   r   c                   ó.   • \ rS rSrSrS\S\SS4S jrSrg)	r   é~   zpre-commit shell hook.r)   Ú
controldirr   Nc                 ót   • [         R                  R                  USS5      n[        R	                  U SUSUS9  g)zŠInitialize pre-commit hook.

Args:
    cwd: Working directory for hook execution
    controldir: Path to the git control directory (.git)
Úhooksz
pre-commitr
   r/   N©r3   r%   Újoinr   r,   )r   r)   r=   r+   s       r   r,   ÚPreCommitShellHook.__init__�   s3   € ô —7‘7—<‘< 
¨G°\ÓBˆä×Ñ˜4 ¨x¸ÀÐÒDr   r   ©r   r   r   r   r    r9   r,   r!   r   r   r   r   r   ~   s#   † Ù ð	E˜Cð 	E¨Sð 	E°T÷ 	Er   r   c                   ó*   • \ rS rSrSrS\SS4S jrSrg)r   é�   zpost-commit shell hook.r=   r   Nc                 ót   • [         R                  R                  USS5      n[        R	                  U SUSUS9  g)z]Initialize post-commit hook.

Args:
    controldir: Path to the git control directory (.git)
r?   zpost-commitr
   r/   Nr@   ©r   r=   r+   s      r   r,   ÚPostCommitShellHook.__init__�   s3   € ô —7‘7—<‘< 
¨G°]ÓCˆä×Ñ˜4 °¸!ÀÐÒLr   r   rC   r   r   r   r   r   �   s   † Ù!ðM 3ð M¨4÷ Mr   r   c                   ó*   • \ rS rSrSrS\SS4S jrSrg)r   é›   zcommit-msg shell hook.r=   r   Nc           	      óâ   • [         R                  R                  USS5      nS[        S[        [
        S4   4S jnS[        S[
        S[        S-  4S	 jn[        R                  U SUS
X4U5        g)z\Initialize commit-msg hook.

Args:
    controldir: Path to the git control directory (.git)
r?   z
commit-msgr   r   .c                  óÂ   • SS K nUR                  5       u  p#[        R                  " US5       nUR	                  U S   5        S S S 5        U4$ ! , (       d  f       U4$ = f)Nr
   Úwb)ÚtempfileÚmkstempr3   ÚfdopenÚwrite)r   rN   Úfdr%   Úfs        r   Úprepare_msgÚ0CommitMsgShellHook.__init__.<locals>.prepare_msg¦   sU   € Ûà!×)Ñ)Ó+‰JˆRä—’˜2˜tÔ$¨Ø—‘˜˜Q™Ô ÷ %ð �7ˆN÷ %Ô$ð �7ˆNús   ®AÁ
AÚsuccessNc                 óì   • U (       aC  [        US   S5       nUR                  5       nS S S 5        [        R                  " US   5        W$ [        R                  " US   5        g ! , (       d  f       NC= f)Nr
   Úrb)ÚopenÚreadr3   Úunlink)rV   r   rS   Únew_msgs       r   Ú	clean_msgÚ.CommitMsgShellHook.__init__.<locals>.clean_msg°   sV   € ÞÜ˜$˜q™' 4Ô(¨AØŸf™f›h�G÷ )ä—	’	˜$˜q™'Ô"Ø�Ü�IŠI�d˜1‘gÔØ÷ )Õ(ús   —A%Á%
A3r   )	r3   r%   rA   ÚbytesÚtupler9   r:   r   r,   )r   r=   r+   rT   r]   s        r   r,   ÚCommitMsgShellHook.__init__ž   sp   € ô —7‘7—<‘< 
¨G°\ÓBˆð	œuð 	¬¬s°C¨x©ô 	ð	œsð 	¬3ð 	´5¸4±<ô 	ô 	×ÑØ�, ¨!¨[ÀZõ	
r   r   rC   r   r   r   r   r   ›   s   † Ù ð
 3ð 
¨4÷ 
r   r   c                   óT   • \ rS rSrSrS\SS4S jrS\\\	\	\	4      S\	S-  4S jr
S	rg)
r   é¾   zpost-receive shell hook.r=   r   Nc                 ó~   • Xl         [        R                  R                  USS5      n[        R                  U SUSS9  g)z^Initialize post-receive hook.

Args:
    controldir: Path to the git control directory (.git)
r?   zpost-receiver
   ©r%   r&   N©r=   r3   r%   rA   r   r,   rG   s      r   r,   ÚPostReceiveShellHook.__init__Á   s6   € ð %ŒÜ—7‘7—<‘< 
¨G°^ÓDˆÜ×Ñ˜4 °hÈÐÒKr   Úclient_refsc           	      óæ  • [         R                  R                  U R                  5      (       d  g [         R                  R                  5       nU R                  US'   [        R                  " U R                  [        R                  [        R                  [        R                  US9nSR                  U Vs/ s H  nSR                  U5      PM     sn5      nUR                  U5      u  pgUR                  S:w  d  U(       a@  SUR                   SUR                  S	S
5       SUR                  S	S
5       3n[        U5      eU$ s  snf ! [         a  n	[        [!        U	5      5      U	eSn	A	ff = f)a  Execute the post-receive hook.

Args:
    client_refs: List of tuples containing (old_sha, new_sha, ref_name)
                for each updated reference

Returns:
    Output from the hook execution or None if hook doesn't exist

Raises:
    HookError: If hook execution fails
NÚGIT_DIR©ÚstdinÚstdoutÚstderrÚenvó   
ó    r
   zpost-receive exit code: z	
stdout:
úutf-8Úbackslashreplacez	
stderr:
)r3   r%   Úexistsr+   ÚenvironÚcopyr=   r1   ÚPopenÚPIPErA   ÚcommunicateÚ
returncodeÚdecoder   ÚOSErrorÚrepr)
r   rh   ro   ÚpÚrefÚin_dataÚout_dataÚerr_dataÚerr_msgÚerrs
             r   r   ÚPostReceiveShellHook.executeË   s5  € ô  �w‰w�~‰~˜dŸm™m×,Ñ,Øð	0Ü—*‘*—/‘/Ó#ˆCØ!Ÿ_™_ˆC�	‰Nä× Ò Ø—‘Ü —o‘oÜ!—‘Ü!—‘ØñˆAð —j‘j¹KÓ!HºK°S $§)¡)¨C¦.¹KÑ!HÓIˆGà!"§¡¨wÓ!7ÑˆHà—‘ Ó!¦hà.¨q¯|©|¨nð = Ø (§¡°Ð9KÓ LÐMð N Ø (§¡°Ð9KÓ LÐMðOð ô
   Ó(Ð(ØˆOùò "Iøô ó 	0ÜœD ›IÓ&¨CÐ/ûð	0ús+   ±BE Â9EÃA2E ÅE Å
E0ÅE+Å+E0©r=   ©r   r   r   r   r    r9   r,   r   r`   r_   r   r!   r   r   r   r   r   ¾   sE   † Ù"ðL 3ð L¨4ô Lð-0Ø# E¨%°¸Ð*=Ñ$>Ñ?ð-0à	�‰÷-0r   r   c                   óX   • \ rS rSrSrS\SS4S jrS\\\	\	\	4      S\\	\	4   4S jr
S	rg)
r   éû   zpre-receive shell hook.r=   r   Nc                 ó~   • Xl         [        R                  R                  USS5      n[        R                  U SUSS9  g)z]Initialize pre-receive hook.

Args:
    controldir: Path to the git control directory (.git)
r?   zpre-receiver
   re   Nrf   rG   s      r   r,   ÚPreReceiveShellHook.__init__þ   s6   € ð %ŒÜ—7‘7—<‘< 
¨G°]ÓCˆÜ×Ñ˜4 °XÈÐÒJr   rh   c           	      ó°  • [         R                  R                  U R                  5      (       d  g [         R                  R                  5       nU R                  US'   [        R                  " U R                  [        R                  [        R                  [        R                  US9nSR                  U Vs/ s H  nSR                  U5      PM     sn5      nUR                  U5      u  pgUR                  S:w  a+  [        SUR                   SUR                  S	S
5       35      eXg4$ s  snf ! [         a  n[        [!        U5      5      UeSnAff = f)a'  Execute the pre-receive hook.

Args:
    client_refs: List of tuples containing (old_sha, new_sha, ref_name)
                for each reference to be updated

Returns:
    Tuple of (stdout, stderr) from hook execution

Raises:
    HookError: If hook execution fails (exits with non-zero status)
©r   r   rj   rk   rp   rq   r
   z$pre-receive hook exited with status ú: rr   rs   N)r3   r%   rt   r+   ru   rv   r=   r1   rw   rx   rA   ry   rz   r   r{   r|   r}   )	r   rh   ro   r~   r   r€   r�   r‚   r„   s	            r   r   ÚPreReceiveShellHook.execute  s  € ô  �w‰w�~‰~˜dŸm™m×,Ñ,Øð	0Ü—*‘*—/‘/Ó#ˆCØ!Ÿ_™_ˆC�	‰Nä× Ò Ø—‘Ü —o‘oÜ!—‘Ü!—‘ØñˆAð —j‘j¹KÓ!HºK°S $§)¡)¨C¦.¹KÑ!HÓIˆGà!"§¡¨wÓ!7ÑˆHà�|‰|˜qÓ ÜØ:¸1¿<¹<¸.ÈÈ8Ï?É?Ð[bÐdvÓKwÐJxÐyóð ð Ð'Ð'ùò "Iøô ó 	0ÜœD ›IÓ&¨CÐ/ûð	0ús+   ±BD1 Â9D,ÃAD1 Ä,D1 Ä1
EÄ;EÅEr†   r‡   r   r   r   r   r   û   sJ   † Ù!ðK 3ð K¨4ô Kð*0Ø# E¨%°¸Ð*=Ñ$>Ñ?ð*0à	ˆu�eˆ|Ñ	÷*0r   r   c            
       óN   • \ rS rSrSrS\SS4S jrS\S\S	\S\\\4   4S
 jr	Sr
g)r	   i5  zupdate shell hook.r=   r   Nc                 ó~   • Xl         [        R                  R                  USS5      n[        R                  U SUSS9  g)zXInitialize update hook.

Args:
    controldir: Path to the git control directory (.git)
r?   Úupdateé   re   Nrf   rG   s      r   r,   ÚUpdateShellHook.__init__8  s6   € ð %ŒÜ—7‘7—<‘< 
¨G°XÓ>ˆÜ×Ñ˜4 °À1ÐÒEr   Úref_nameÚold_shaÚnew_shac           	      óŒ  • [         R                  R                  U R                  5      (       d  g [         R                  R                  5       nU R                  US'   [        R                  " U R                  UR                  SS5      UR                  SS5      UR                  SS5      /[        R                  [        R                  US9nUR                  5       u  pgUR                  S:w  a+  [        SUR                   SUR                  SS5       35      eXg4$ ! [         a  n[        [        U5      5      UeS	nAff = f)
a8  Execute the update hook for a single ref.

Args:
    ref_name: Name of the reference being updated
    old_sha: Old SHA of the reference
    new_sha: New SHA of the reference

Returns:
    Tuple of (stdout, stderr) from hook execution

Raises:
    HookError: If hook execution fails (exits with non-zero status)
r�   rj   rr   rs   )rm   rn   ro   r
   zupdate hook exited with status rŽ   N)r3   r%   rt   r+   ru   rv   r=   r1   rw   r{   rx   ry   rz   r   r|   r}   )	r   r•   r–   r—   ro   r~   r�   r‚   r„   s	            r   r   ÚUpdateShellHook.executeB  s  € ô" �w‰w�~‰~˜dŸm™m×,Ñ,Øð	0Ü—*‘*—/‘/Ó#ˆCØ!Ÿ_™_ˆC�	‰Nä× Ò à—M‘MØ—O‘O GÐ-?Ó@Ø—N‘N 7Ð,>Ó?Ø—N‘N 7Ð,>Ó?ð	ô "—‘Ü!—‘Øñ
ˆAð "#§¡£ÑˆHà�|‰|˜qÓ ÜØ5°a·l±l°^À2ÀhÇoÁoÐV]Ð_qÓFrÐEsÐtóð ð Ð'Ð'øÜó 	0ÜœD ›IÓ&¨CÐ/ûð	0ús   ±C-D Ä
EÄ)D>Ä>Er†   )r   r   r   r   r    r9   r,   r_   r`   r   r!   r   r   r   r	   r	   5  sI   † ÙðF 3ð F¨4ô Fð,0Øð,0Ø(-ð,0Ø8=ð,0à	ˆu�eˆ|Ñ	÷,0r   r	   )r    Ú__all__r3   r1   Úcollections.abcr   r   Útypingr   Úerrorsr   r   r   r   r   r   r   r   r	   r   r   r   Ú<module>rž      sŠ   ðñ, ò	€ó 
Û ß .Ý å ÷0ñ 0ô @2�ô @2ôFE˜ô EôM˜)ô Mô 
˜ô  
ôF:0˜9ô :0ôz70˜)ô 70ôt90�iõ 90r   