[PATCH v3] Allow commit date before Unix epoch, clean fix for (issue2513)
Florent Gallaire
fgallaire at gmail.com
Sun Apr 3 07:06:50 EDT 2016
2016-04-03 11:11 GMT+02:00 Adrian Buehlmann <adrian at cadifra.com>:
> Well. It's better to do your patch right - instead of cleaning up
> afterwards.
>
> If you want to clamp to 0x7fffffff, why don't you simplify matters to:
>
> d = t - tz
> if abs(d) > 0x7fffffff:
> d = cmp(d, 0) * 0x7fffffff
> t = datetime.datetime(1970, 1, 1) + datetime.timedelta(seconds=d)
> s = t.strftime(format)
> return s
I agree with you, this is the right way. New patch submitted.
> The catching of OverflowError looks a bit pointless to me. It looks like
> you are trying to preserve the try-block introduced in c208dcd0f709 -
> which I think is no longer needed.
In fact the try-block was broken since the beginning.
Thanks for your attention.
Florent
--
FLOSS Engineer & Lawyer
More information about the Mercurial-devel
mailing list