ó
    6°hQ  ã                  óF   • S r SSKJr  SSKrSSKJr  Sr " S S5      rS rg)	a:  send ui.log() data to a subprocess (EXPERIMENTAL)

This extension lets you specify a shell command per ui.log() event,
sending all remaining arguments to as environment variables to that command.

Positional arguments construct a log message, which is passed in the `MSG1`
environment variables. Each keyword argument is set as a `OPT_UPPERCASE_KEY`
variable (so the key is uppercased, and prefixed with `OPT_`). The original
event name is passed in the `EVENT` environment variable, and the process ID
of mercurial is given in `HGPID`.

So given a call `ui.log('foo', 'bar %s
', 'baz', spam='eggs'), a script
configured for the `foo` event can expect an environment with `MSG1=bar baz`,
and `OPT_SPAM=eggs`.

Scripts are configured in the `[logtoprocess]` section, each key an event name.
For example::

  [logtoprocess]
  commandexception = echo "$MSG1" > /var/log/mercurial_exceptions.log

would log the warning message and traceback of any failed command dispatch.

Scripts are run asynchronously as detached daemon processes; mercurial will
not ensure that they exit cleanly.

é    )ÚannotationsN)Úprocutils   ships-with-hg-corec                  ó*   • \ rS rSrSrS rS rS rSrg)Úprocessloggeré0   zWMap log events to external commands

Arguments are passed on as environment variables.
c                óB   • [        UR                  S5      5      U l        g ©Ns   logtoprocess)ÚdictÚconfigitemsÚ_scripts)ÚselfÚuis     Ú4/usr/lib/python3/dist-packages/hgext/logtoprocess.pyÚ__init__Úprocesslogger.__init__6   s   € Ü˜RŸ^™^¨OÓ<Ó=ˆ�ó    c                óJ   • [        U R                  R                  U5      5      $ )N)Úboolr   Úget)r   Úevents     r   ÚtrackedÚprocesslogger.tracked9   s   € Ü�D—M‘M×%Ñ% eÓ,Ó-Ð-r   c                ó(  • U R                   U   nSn[        U5      U:”  a  US U S-   nU[        R                  " 5       US.nUR	                  S UR                  5        5       5        [        R                  " U5      n[        R                  " XXSS9  g )Ni † s    (truncated))s   EVENTs   HGPIDs   MSG1c              3  óP   #   • U  H  u  pS UR                  5       -  U4v •  M     g7f)s   OPT_%sN)Úupper)Ú.0ÚkeyÚvalues      r   Ú	<genexpr>Ú$processlogger.log.<locals>.<genexpr>K   s%   é € ð 
Ú?K±°ˆY˜Ÿ™›Ñ$ eÕ,º|ùs   ‚$&T)Úshell)	r   ÚlenÚosÚgetpidÚupdateÚitemsr   ÚshellenvironÚrunbgcommand)	r   r   r   ÚmsgÚoptsÚscriptÚmaxmsgÚenvÚfullenvs	            r   ÚlogÚprocesslogger.log<   sŒ   € Ø—‘˜uÑ%ˆØˆÜˆs‹8�fÓð
 �g�v�, Ñ0ˆCàÜ—i’i“kØñ
ˆð 	�
‰
ñ 
Ø?C¿z¹z¼|ó
ô 	
ô ×'Ò'¨Ó,ˆÜ×Ò˜f°TÓ:r   )r   N)	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r/   Ú__static_attributes__© r   r   r   r   0   s   † ñò
>ò.õ;r   r   c                ó:   • U R                  S[        U 5      5        g r	   )Ú	setloggerr   )r   s    r   Ú
uipopulater:   R   s   € Ø‡L�L�¤-°Ó"3Õ4r   )	r5   Ú
__future__r   r#   Úmercurial.utilsr   Ú
testedwithr   r:   r7   r   r   Ú<module>r>      s,   ðñõ8 #ã 	å $ð #€
÷;ñ ;óD5r   