# HG changeset patch # User Kevin Gessner # Date 1316793747 25200 # Node ID c208dcd0f70957ce871fdacbf8d1432021de79b5 # Parent 94b200a11cf7adfee75bb865d238a077ee75b79c util: fix crash converting an invalid future date to string Post-2038 timestamps cannot be handled on 32-bit architectures. Clamp such dates to the maximum 32-bit timestamp. diff -r 94b200a11cf7 -r c208dcd0f709 mercurial/util.py --- a/mercurial/util.py Wed Sep 21 22:52:00 2011 +0200 +++ b/mercurial/util.py Fri Sep 23 09:02:27 2011 -0700 @@ -891,7 +891,12 @@ minutes = abs(tz) // 60 format = format.replace("%1", "%c%02d" % (sign, minutes // 60)) format = format.replace("%2", "%02d" % (minutes % 60)) - s = time.strftime(format, time.gmtime(float(t) - tz)) + try: + t = time.gmtime(float(t) - tz) + except ValueError: + # time was out of range + t = time.gmtime(sys.maxint) + s = time.strftime(format, t) return s def shortdate(date=None):