hgext/logtoprocess.py
changeset 30638 1c5cbf28f007
parent 30332 318a24b52eeb
child 31601 8e7feaad2d8d
equal deleted inserted replaced
30637:344e68882cd3 30638:1c5cbf28f007
    37 import itertools
    37 import itertools
    38 import os
    38 import os
    39 import platform
    39 import platform
    40 import subprocess
    40 import subprocess
    41 import sys
    41 import sys
       
    42 
       
    43 from mercurial import encoding
    42 
    44 
    43 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
    45 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
    44 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
    46 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
    45 # be specifying the version(s) of Mercurial they are tested with, or
    47 # be specifying the version(s) of Mercurial they are tested with, or
    46 # leave the attribute unspecified.
    48 # leave the attribute unspecified.
   115                     for i, m in enumerate(messages, 1))
   117                     for i, m in enumerate(messages, 1))
   116                 # keyword arguments get prefixed with OPT_ and uppercased
   118                 # keyword arguments get prefixed with OPT_ and uppercased
   117                 optpairs = (
   119                 optpairs = (
   118                     ('OPT_{0}'.format(key.upper()), str(value))
   120                     ('OPT_{0}'.format(key.upper()), str(value))
   119                     for key, value in opts.iteritems())
   121                     for key, value in opts.iteritems())
   120                 env = dict(itertools.chain(os.environ.items(),
   122                 env = dict(itertools.chain(encoding.environ.items(),
   121                                            msgpairs, optpairs),
   123                                            msgpairs, optpairs),
   122                            EVENT=event, HGPID=str(os.getpid()))
   124                            EVENT=event, HGPID=str(os.getpid()))
   123                 # Connect stdin to /dev/null to prevent child processes messing
   125                 # Connect stdin to /dev/null to prevent child processes messing
   124                 # with mercurial's stdin.
   126                 # with mercurial's stdin.
   125                 runshellcommand(script, env)
   127                 runshellcommand(script, env)