From patchwork Sat Aug 16 00:33:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3, of, 8] obsstore: add an explicit `date` argument to obsstore.create From: Pierre-Yves David X-Patchwork-Id: 5440 Message-Id: <545b8965d9e13e4f81a6.1408149205@marginatus.alto.octopoid.net> To: mercurial-devel@selenic.com Cc: Pierre-Yves David Date: Fri, 15 Aug 2014 17:33:25 -0700 # HG changeset patch # User Pierre-Yves David # Date 1407995087 25200 # Wed Aug 13 22:44:47 2014 -0700 # Node ID 545b8965d9e13e4f81a61f5fd4715d2916b3a167 # Parent 543cc6d8c5bb067d4a41bb72516ef2933ce6bb77 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. diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py --- a/mercurial/obsolete.py +++ b/mercurial/obsolete.py @@ -257,11 +257,12 @@ class obsstore(object): return len(self._all) 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 * check mandatory metadata * encode metadata @@ -273,11 +274,13 @@ class obsstore(object): already existed (no op). """ 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: if len(succ) != 20: raise ValueError(succ)