##// END OF EJS Templates
blackbox: use util.getuser for portability...
Bryan O'Sullivan -
r18787:f56278a0 default
parent child Browse files
Show More
@@ -25,7 +25,7 b' Examples:'
25
25
26 from mercurial import util, cmdutil
26 from mercurial import util, cmdutil
27 from mercurial.i18n import _
27 from mercurial.i18n import _
28 import os, getpass, re
28 import os, re
29
29
30 cmdtable = {}
30 cmdtable = {}
31 command = cmdutil.command(cmdtable)
31 command = cmdutil.command(cmdtable)
@@ -55,7 +55,7 b' def wrapui(ui):'
55
55
56 if blackbox:
56 if blackbox:
57 date = util.datestr(None, '%Y/%m/%d %H:%M:%S')
57 date = util.datestr(None, '%Y/%m/%d %H:%M:%S')
58 user = getpass.getuser()
58 user = util.getuser()
59 formattedmsg = msg[0] % msg[1:]
59 formattedmsg = msg[0] % msg[1:]
60 try:
60 try:
61 blackbox.write('%s %s> %s' % (date, user, formattedmsg))
61 blackbox.write('%s %s> %s' % (date, user, formattedmsg))
@@ -1,7 +1,6 b''
1 setup
1 setup
2 $ cat > mock.py <<EOF
2 $ cat > mock.py <<EOF
3 > from mercurial import util
3 > from mercurial import util
4 > import getpass
5 >
4 >
6 > def makedate():
5 > def makedate():
7 > return 0, 0
6 > return 0, 0
@@ -10,7 +9,7 b' setup'
10 > # mock the date and user apis so the output is always the same
9 > # mock the date and user apis so the output is always the same
11 > def uisetup(ui):
10 > def uisetup(ui):
12 > util.makedate = makedate
11 > util.makedate = makedate
13 > getpass.getuser = getuser
12 > util.getuser = getuser
14 > EOF
13 > EOF
15 $ cat >> $HGRCPATH <<EOF
14 $ cat >> $HGRCPATH <<EOF
16 > [extensions]
15 > [extensions]
General Comments 0
You need to be logged in to leave comments. Login now