^c. BdZddlZddlmZdZGddZdZdS)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. N)procutilsships-with-hg-corec$eZdZdZdZdZdZdS) processloggerz_Map log events to external commands Arguments are passed on as environment variables. cTt|d|_dSNs logtoprocess)dict configitems_scripts)selfuis 4/usr/lib/python3/dist-packages/hgext/logtoprocess.py__init__zprocesslogger.__init__5s!R^^O<<== cPt|j|S)N)boolr get)r events r trackedzprocesslogger.tracked8s DM%%e,,---rcJ|j|}d}t||kr |d|dz}|tj|d}|d|Dt j|}t j||ddS)Nis (truncated))sEVENTsHGPIDsMSG1c3NK|] \}}d|z|fV!dS)sOPT_%sN)upper).0keyvalues r z$processlogger.log..JsI  1;eY $e ,      rT)shell) r lenosgetpidupdateitemsr shellenviron runbgcommand) r r rmsgoptsscriptmaxmsgenvfullenvs r logzprocesslogger.log;su% s88f   gvg,0Cikk     ?Czz||      ',,fgT::::::rN)__name__ __module__ __qualname____doc__rrr*rr rr/sK >>>...;;;;;rrcL|dt|dSr) setloggerr)r s r uipopulater2Qs$LL-"3"344444r)r.rmercurial.utilsr testedwithrr2r/rr r5su: $$$$$$ # ;;;;;;;;D55555r