Submitter | adgar@google.com |
---|---|
Date | Nov. 6, 2014, 10:27 p.m. |
Message ID | <f917db22b2b3dcedfc16.1415312865@adgar.nyc.corp.google.com> |
Download | mbox | patch |
Permalink | /patch/6616/ |
State | Superseded |
Headers | show |
Comments
On Thu Nov 06 2014 at 2:28:04 PM Mike Edgar <adgar@google.com> wrote: > # HG changeset patch > # User Mike Edgar <adgar@google.com> > # Date 1413827953 14400 > # Mon Oct 20 13:59:13 2014 -0400 > # Node ID f917db22b2b3dcedfc16877254e3a8314936e3e2 > # Parent 2d54aa5397cdb1c697673ba10b7618d5ac25c69e > synthrepo: synthesized dates must fit in 32-bit signed ints > > diff -r 2d54aa5397cd -r f917db22b2b3 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 fit in 32-bit signed integers. > + date = min(0x7fffffff, date) > Was the problem that the date got too large? Can 'count' two lines up get large enough (~50k?) that the date instead becomes too small?
On Fri, Nov 7, 2014 at 2:06 AM, Martin von Zweigbergk <martinvonz@google.com > wrote: > > > On Thu Nov 06 2014 at 2:28:04 PM Mike Edgar <adgar@google.com> wrote: > >> # HG changeset patch >> # User Mike Edgar <adgar@google.com> >> # Date 1413827953 14400 >> # Mon Oct 20 13:59:13 2014 -0400 >> # Node ID f917db22b2b3dcedfc16877254e3a8314936e3e2 >> # Parent 2d54aa5397cdb1c697673ba10b7618d5ac25c69e >> synthrepo: synthesized dates must fit in 32-bit signed ints >> >> diff -r 2d54aa5397cd -r f917db22b2b3 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 fit in 32-bit signed integers. >> + date = min(0x7fffffff, date) >> > > Was the problem that the date got too large? Can 'count' two lines up get > large enough (~50k?) that the date instead becomes too small? > It was that it got too large - it hits Y2037. You're right that it could become too small: negative dates are also disallowed. Sending a v2 which checks that too.
Patch
diff -r 2d54aa5397cd -r f917db22b2b3 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 fit in 32-bit signed integers. + date = min(0x7fffffff, date) user = random.choice(words) + '@' + random.choice(words) mc = context.memctx(repo, pl, makeline(minimum=2), sorted(changes.iterkeys()),