obsstore: add an explicit `date` argument to obsstore.create
authorPierre-Yves David <pierre-yves.david@fb.com>
Wed, 13 Aug 2014 22:44:47 -0700
changeset 22217 570f87422f54
parent 22216 9be81b86ca97
child 22218 b629397ca15f
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.
mercurial/obsolete.py
--- 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: