util: add an optional timestamp parameter to makedate
This will be used by the upcoming shelve extension.
--- a/mercurial/util.py Mon Jun 03 17:20:44 2013 -0700
+++ b/mercurial/util.py Mon Jun 03 17:20:45 2013 -0700
@@ -997,10 +997,11 @@
limit -= len(s)
yield s
-def makedate():
- '''Return the current time as a (unixtime, offset) tuple based off
- the local timezone.'''
- timestamp = time.time()
+def makedate(timestamp=None):
+ '''Return a unix timestamp (or the current time) as a (unixtime,
+ offset) tuple based off the local timezone.'''
+ if timestamp is None:
+ timestamp = time.time()
if timestamp < 0:
hint = _("check your clock")
raise Abort(_("negative timestamp: %d") % timestamp, hint=hint)