changeset 22217:570f87422f54

obsstore: add an explicit `date` argument to obsstore.create The date will become an official field in the markers (and ultimately in the on-disk format). We start by making it an official argument for the function.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 13 Aug 2014 22:44:47 -0700
parents 9be81b86ca97
children b629397ca15f
files mercurial/obsolete.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/obsolete.py	Thu Aug 14 01:53:07 2014 -0700
+++ b/mercurial/obsolete.py	Wed Aug 13 22:44:47 2014 -0700
@@ -259,7 +259,8 @@
     def __nonzero__(self):
         return bool(self._all)
 
-    def create(self, transaction, prec, succs=(), flag=0, metadata=None):
+    def create(self, transaction, prec, succs=(), flag=0, date=None,
+               metadata=None):
         """obsolete: add a new obsolete marker
 
         * ensuring it is hashable
@@ -275,7 +276,9 @@
         if metadata is None:
             metadata = {}
         if 'date' not in metadata:
-            metadata['date'] = "%d %d" % util.makedate()
+            if date is None:
+                date = util.makedate()
+            metadata['date'] = "%d %d" % date
         if len(prec) != 20:
             raise ValueError(prec)
         for succ in succs: