Mercurial > hg
comparison hgext/blackbox.py @ 18787:f56278a0a0c5
blackbox: use util.getuser for portability
On Windows, our implementation is more robust than Python's version.
author | Bryan O'Sullivan <bryano@fb.com> |
---|---|
date | Wed, 20 Mar 2013 13:40:06 -0700 |
parents | ed39a8f94e95 |
children | ac0336471ba7 |
comparison
equal
deleted
inserted
replaced
18786:ed39a8f94e95 | 18787:f56278a0a0c5 |
---|---|
23 | 23 |
24 """ | 24 """ |
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) |
32 testedwith = 'internal' | 32 testedwith = 'internal' |
33 lastblackbox = None | 33 lastblackbox = None |
53 # was seen. | 53 # was seen. |
54 blackbox = lastblackbox | 54 blackbox = lastblackbox |
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)) |
62 except IOError, err: | 62 except IOError, err: |
63 self.debug('warning: cannot write to blackbox.log: %s\n' % | 63 self.debug('warning: cannot write to blackbox.log: %s\n' % |