Patchwork [6,of,8] devel: update blackbox to use default-date

login
register
mail settings
Submitter Boris Feld
Date May 22, 2017, 6:46 p.m.
Message ID <ac0b3a1ed91a847242bd.1495478786@FB>
Download mbox | patch
Permalink /patch/20832/
State Accepted
Headers show

Comments

Boris Feld - May 22, 2017, 6:46 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1494952568 -7200
#      Tue May 16 18:36:08 2017 +0200
# Node ID ac0b3a1ed91a847242bdc1c722f383030eaea369
# Parent  6b36945e7ac9b0c32098e382ee6b100080d8deec
# EXP-Topic develforcedate
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.

Patch

diff -r 6b36945e7ac9b0c32098e382ee6b100080d8deec -r ac0b3a1ed91a847242bdc1c722f383030eaea369 hgext/blackbox.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:]
diff -r 6b36945e7ac9b0c32098e382ee6b100080d8deec -r ac0b3a1ed91a847242bdc1c722f383030eaea369 tests/mockblackbox.py
--- 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