HEX
Server: Apache
System: Linux p102.lithium.hosting 4.18.0-553.141.1.el8_10.x86_64 #1 SMP Fri Jul 10 17:48:02 UTC 2026 x86_64
User: bvzmoamr (9955)
PHP: 8.1.34
Disabled: syslog
Upload Files
File: //proc/self/root/proc/thread-self/root/lib64/python2.7/site-packages/hgext/logtoprocess.pyc
�
1�3\c@@sydZddlmZddlZddlZddlZddlZddlmZddl	m
Z
dZd�ZdS(s^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.

Each positional argument to the method results in a `MSG[N]` key in the
environment, starting at 1 (so `MSG1`, `MSG2`, etc.). 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', 'baz', spam='eggs'), a script configured
for the `foo` event can expect an environment with `MSG1=bar`, `MSG2=baz`, and
`OPT_SPAM=eggs`.

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

  [logtoprocess]
  commandexception = echo "$MSG2$MSG3" > /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.

i(tabsolute_importN(tpycompat(tprocutilsships-with-hg-corec@sftjr.d}|tjB��fd��n	d��d|jf��fd��Y��|_dS(Nic
@s;tjtj|�dtdtj|�dtd��dS(Ntshelltenvt	close_fdst
creationflags(t
subprocesstPopenRttonativestrtTruettonativeenv(tscriptR(t_creationflags(s8/usr/lib64/python2.7/site-packages/hgext/logtoprocess.pytrunshellcommand@scS@s�tj�}|rdStjdkr8itjd6}n
itd6}znttjd�}ttjd�}tj	t
j|�dtd|d	|d
|dt
j|�dt|�Wdtj
d
�XdS(Niit
preexec_fntstart_new_sessiontrtwRtstdintstdouttstderrRRi(ii(tostforktsystversion_infotsetsidR
topentdevnullRRRR	Rt_exit(RRtpidt
newsessiontnullrfdtnullwfd((s8/usr/lib64/python2.7/site-packages/hgext/logtoprocess.pyRHs 
tlogtoprocessuic@seZ��fd�ZRS(c
@s|jd|�}|r�|rly|d|d}Wn!ttfk
rW|d}nX|f|d}n|}d�t|d�D�}d�|j�D�}ttjtj	�j
�||�d|dttj
���}	�||	�nt�|�j|||�S(spMap log events to external commands

            Arguments are passed on as environment variables.

            tlogtoprocessiics@s0|]&\}}dj|�t|�fVqdS(sMSG{0:d}N(tformattstr(t.0titm((s8/usr/lib64/python2.7/site-packages/hgext/logtoprocess.pys	<genexpr>scs@s6|],\}}dj|j��t|�fVqdS(sOPT_{0}N(R$tupperR%(R&tkeytvalue((s8/usr/lib64/python2.7/site-packages/hgext/logtoprocess.pys	<genexpr>�stEVENTtHGPID(tconfigt	TypeErrortKeyErrort	enumeratet	iteritemstdictt	itertoolstchainRtshellenvirontitemsR%Rtgetpidtsupertlog(
tselfteventtmsgtoptsRt	formattedtmessagestmsgpairstoptpairsR(R"R(s8/usr/lib64/python2.7/site-packages/hgext/logtoprocess.pyR:hs$(t__name__t
__module__R:((R"R(s8/usr/lib64/python2.7/site-packages/hgext/logtoprocess.pyR"gs(Rt	iswindowsRtCREATE_NEW_PROCESS_GROUPt	__class__(tuitDETACHED_PROCESS((R
R"Rs8/usr/lib64/python2.7/site-packages/hgext/logtoprocess.pytuisetup8s	
	"%(
t__doc__t
__future__RR4RRRt	mercurialRtmercurial.utilsRt
testedwithRJ(((s8/usr/lib64/python2.7/site-packages/hgext/logtoprocess.pyt<module>!s