Patchwork [1,of,2,v2] synthrepo: synthesized dates must be positive, fit in 32-bit signed ints

login
register
mail settings
Submitter adgar@google.com
Date Nov. 7, 2014, 3:07 p.m.
Message ID <2ba7af12f8c59172e230.1415372850@adgar.nyc.corp.google.com>
Download mbox | patch
Permalink /patch/6632/
State Accepted
Headers show

Comments

adgar@google.com - Nov. 7, 2014, 3:07 p.m.
# HG changeset patch
# User Mike Edgar <adgar@google.com>
# Date 1413827953 14400
#      Mon Oct 20 13:59:13 2014 -0400
# Node ID 2ba7af12f8c59172e230295a238183400b19faf6
# Parent  2d54aa5397cdb1c697673ba10b7618d5ac25c69e
synthrepo: synthesized dates must be positive, fit in 32-bit signed ints

Patch

diff -r 2d54aa5397cd -r 2ba7af12f8c5 contrib/synthrepo.py
--- a/contrib/synthrepo.py	Sat Oct 18 01:09:41 2014 -0700
+++ b/contrib/synthrepo.py	Mon Oct 20 13:59:13 2014 -0400
@@ -428,6 +428,8 @@ 
             date = repo['tip'].date()[0] + pick(interarrival)
         else:
             date = time.time() - (86400 * count)
+        # dates in mercurial must be positive, fit in 32-bit signed integers.
+        date = min(0x7fffffff, max(0, date))
         user = random.choice(words) + '@' + random.choice(words)
         mc = context.memctx(repo, pl, makeline(minimum=2),
                             sorted(changes.iterkeys()),