comparison mercurial/obsolete.py @ 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 79c686267486
comparison
equal deleted inserted replaced
22216:9be81b86ca97 22217:570f87422f54
257 return len(self._all) 257 return len(self._all)
258 258
259 def __nonzero__(self): 259 def __nonzero__(self):
260 return bool(self._all) 260 return bool(self._all)
261 261
262 def create(self, transaction, prec, succs=(), flag=0, metadata=None): 262 def create(self, transaction, prec, succs=(), flag=0, date=None,
263 metadata=None):
263 """obsolete: add a new obsolete marker 264 """obsolete: add a new obsolete marker
264 265
265 * ensuring it is hashable 266 * ensuring it is hashable
266 * check mandatory metadata 267 * check mandatory metadata
267 * encode metadata 268 * encode metadata
273 already existed (no op). 274 already existed (no op).
274 """ 275 """
275 if metadata is None: 276 if metadata is None:
276 metadata = {} 277 metadata = {}
277 if 'date' not in metadata: 278 if 'date' not in metadata:
278 metadata['date'] = "%d %d" % util.makedate() 279 if date is None:
280 date = util.makedate()
281 metadata['date'] = "%d %d" % date
279 if len(prec) != 20: 282 if len(prec) != 20:
280 raise ValueError(prec) 283 raise ValueError(prec)
281 for succ in succs: 284 for succ in succs:
282 if len(succ) != 20: 285 if len(succ) != 20:
283 raise ValueError(succ) 286 raise ValueError(succ)