
    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)processlogger0   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    DMM%%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%s8f
 gv,0Ciik
 	

 
?Czz|
 	
 '',fT: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    LL-"34r   )	r5   
__future__r   r#   mercurial.utilsr   
testedwithr   r:   r7   r   r   <module>r>      s,   8 # 	 $ #
; ;D5r   