comparison hgext/logtoprocess.py @ 43076:2372284d9457

formatting: blacken the codebase This is using my patch to black (https://github.com/psf/black/pull/826) so we don't un-wrap collection literals. Done with: hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S # skip-blame mass-reformatting only # no-check-commit reformats foo_bar functions Differential Revision: https://phab.mercurial-scm.org/D6971
author Augie Fackler <augie@google.com>
date Sun, 06 Oct 2019 09:45:02 -0400
parents 691c68bc1222
children 687b865b95ad
comparison
equal deleted inserted replaced
43075:57875cf423c9 43076:2372284d9457
34 34
35 from __future__ import absolute_import 35 from __future__ import absolute_import
36 36
37 import os 37 import os
38 38
39 from mercurial.utils import ( 39 from mercurial.utils import procutil
40 procutil,
41 )
42 40
43 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for 41 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
44 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should 42 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
45 # be specifying the version(s) of Mercurial they are tested with, or 43 # be specifying the version(s) of Mercurial they are tested with, or
46 # leave the attribute unspecified. 44 # leave the attribute unspecified.
47 testedwith = 'ships-with-hg-core' 45 testedwith = 'ships-with-hg-core'
46
48 47
49 class processlogger(object): 48 class processlogger(object):
50 """Map log events to external commands 49 """Map log events to external commands
51 50
52 Arguments are passed on as environment variables. 51 Arguments are passed on as environment variables.
64 b'EVENT': event, 63 b'EVENT': event,
65 b'HGPID': os.getpid(), 64 b'HGPID': os.getpid(),
66 b'MSG1': msg, 65 b'MSG1': msg,
67 } 66 }
68 # keyword arguments get prefixed with OPT_ and uppercased 67 # keyword arguments get prefixed with OPT_ and uppercased
69 env.update((b'OPT_%s' % key.upper(), value) 68 env.update(
70 for key, value in opts.items()) 69 (b'OPT_%s' % key.upper(), value) for key, value in opts.items()
70 )
71 fullenv = procutil.shellenviron(env) 71 fullenv = procutil.shellenviron(env)
72 procutil.runbgcommand(script, fullenv, shell=True) 72 procutil.runbgcommand(script, fullenv, shell=True)
73 73
74
74 def uipopulate(ui): 75 def uipopulate(ui):
75 ui.setlogger(b'logtoprocess', processlogger(ui)) 76 ui.setlogger(b'logtoprocess', processlogger(ui))