diff mercurial/obsolete.py @ 32449:08d02c1d7e67

devel: use default-date config field when creating obsmarkers Also use the default-date when creating obsmarkers. Currently they are created with the current date and without any option to force their value. To test the feature, we remove some of the many 'glob' used to match obsmarker date in the tests.
author Boris Feld <boris.feld@octobus.net>
date Fri, 19 May 2017 12:08:47 +0200
parents 655f1e2cfa5a
children 176d1a0ce385
line wrap: on
line diff
--- a/mercurial/obsolete.py	Mon May 22 16:59:57 2017 +0200
+++ b/mercurial/obsolete.py	Fri May 19 12:08:47 2017 +0200
@@ -584,7 +584,7 @@
         return self._readonly
 
     def create(self, transaction, prec, succs=(), flag=0, parents=None,
-               date=None, metadata=None):
+               date=None, metadata=None, ui=None):
         """obsolete: add a new obsolete marker
 
         * ensuring it is hashable
@@ -603,6 +603,10 @@
             if 'date' in metadata:
                 # as a courtesy for out-of-tree extensions
                 date = util.parsedate(metadata.pop('date'))
+            elif ui is not None:
+                date = ui.configdate('devel', 'default-date')
+                if date is None:
+                    date = util.makedate()
             else:
                 date = util.makedate()
         if len(prec) != 20:
@@ -1286,7 +1290,8 @@
         for args in markerargs:
             nprec, nsucs, npare, localmetadata = args
             repo.obsstore.create(tr, nprec, nsucs, flag, parents=npare,
-                                 date=date, metadata=localmetadata)
+                                 date=date, metadata=localmetadata,
+                                 ui=repo.ui)
             repo.filteredrevcache.clear()
         tr.close()
     finally: