comparison hgext/blackbox.py @ 28027:14033c5dd261

util: enable getpid to be replaced This will enable tests to write stable process ids.
author timeless <timeless@mozdev.org>
date Wed, 03 Feb 2016 09:11:22 +0000
parents a6db1163befa
children 8113c88b8e6d
comparison
equal deleted inserted replaced
28026:a6db1163befa 28027:14033c5dd261
29 29
30 """ 30 """
31 31
32 from mercurial import util, cmdutil 32 from mercurial import util, cmdutil
33 from mercurial.i18n import _ 33 from mercurial.i18n import _
34 import errno, os, re 34 import errno, re
35 35
36 cmdtable = {} 36 cmdtable = {}
37 command = cmdutil.command(cmdtable) 37 command = cmdutil.command(cmdtable)
38 # Note for extension authors: ONLY specify testedwith = 'internal' for 38 # Note for extension authors: ONLY specify testedwith = 'internal' for
39 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should 39 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
105 blackbox = lastblackbox 105 blackbox = lastblackbox
106 106
107 if blackbox: 107 if blackbox:
108 date = util.datestr(None, '%Y/%m/%d %H:%M:%S') 108 date = util.datestr(None, '%Y/%m/%d %H:%M:%S')
109 user = util.getuser() 109 user = util.getuser()
110 pid = str(os.getpid()) 110 pid = str(util.getpid())
111 formattedmsg = msg[0] % msg[1:] 111 formattedmsg = msg[0] % msg[1:]
112 try: 112 try:
113 blackbox.write('%s %s (%s)> %s' % 113 blackbox.write('%s %s (%s)> %s' %
114 (date, user, pid, formattedmsg)) 114 (date, user, pid, formattedmsg))
115 blackbox.flush() 115 blackbox.flush()