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.
--- 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: