devel: update blackbox to use default-date
authorBoris Feld <boris.feld@octobus.net>
Tue, 16 May 2017 18:36:08 +0200
changeset 32412 043948c84647
parent 32411 08d02c1d7e67
child 32413 d6be5b5cc325
devel: update blackbox to use default-date Blackbox now obeys the 'devel.default-date' option. As a side effect we can delete the mock for blackblox related tests.
hgext/blackbox.py
tests/mockblackbox.py
--- a/hgext/blackbox.py	Fri May 19 12:08:47 2017 +0200
+++ b/hgext/blackbox.py	Tue May 16 18:36:08 2017 +0200
@@ -171,7 +171,8 @@
                 return
             try:
                 ui._bbinlog = True
-                date = util.datestr(None, '%Y/%m/%d %H:%M:%S')
+                default = self.configdate('devel', 'default-date')
+                date = util.datestr(default, '%Y/%m/%d %H:%M:%S')
                 user = util.getuser()
                 pid = '%d' % util.getpid()
                 formattedmsg = msg[0] % msg[1:]
--- a/tests/mockblackbox.py	Fri May 19 12:08:47 2017 +0200
+++ b/tests/mockblackbox.py	Tue May 16 18:36:08 2017 +0200
@@ -3,8 +3,7 @@
     util,
 )
 
-def makedate():
-    return 0, 0
+# XXX: we should probably offer a devel option to do this in blackbox directly
 def getuser():
     return 'bob'
 def getpid():
@@ -12,6 +11,5 @@
 
 # mock the date and user apis so the output is always the same
 def uisetup(ui):
-    util.makedate = makedate
     util.getuser = getuser
     util.getpid = getpid