Patchwork [3,of,8] devel: add a config field to force dates to timestamp 0

login
register
mail settings
Submitter Boris Feld
Date May 22, 2017, 6:46 p.m.
Message ID <007ae7c431a3a049ec4c.1495478783@FB>
Download mbox | patch
Permalink /patch/20830/
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 1495189105 -7200
#      Fri May 19 12:18:25 2017 +0200
# Node ID 007ae7c431a3a049ec4c2faf676eda8ed1b0d5f6
# Parent  1738d2fb32fe1ccf2f54ef2382df0a929c50be77
# EXP-Topic develforcedate
devel: add a config field to force dates to timestamp 0

Add a new config field named default-date under the devel section to force all
implicits date to a specific value. If a explicit date is passed, it will
override the default.

This patch only affect changesets. Other usages (blackbox, obsmarkers) are
updated in later patchs.

The test runner is setting a bunch of alias to force the '--date' argument. We
will replace theses aliases in a later patch.

Patch

diff -r 1738d2fb32fe1ccf2f54ef2382df0a929c50be77 -r 007ae7c431a3a049ec4c2faf676eda8ed1b0d5f6 mercurial/context.py
--- a/mercurial/context.py	Fri May 19 12:07:41 2017 +0200
+++ b/mercurial/context.py	Fri May 19 12:18:25 2017 +0200
@@ -1353,7 +1353,11 @@ 
 
     @propertycache
     def _date(self):
-        return util.makedate()
+        ui = self._repo.ui
+        date = ui.configdate('devel', 'default-date')
+        if date is None:
+            date = util.makedate()
+        return date
 
     def subrev(self, subpath):
         return None