diff mercurial/changelog.py @ 1202:71111d796e40

Commit date validation: more stringent checks, more useful error messages.
author Bryan O'Sullivan <bos@serpentine.com>
date Sun, 04 Sep 2005 14:47:02 -0700
parents 8deb69818e4b
children b47f96a178a3
line wrap: on
line diff
--- a/mercurial/changelog.py	Sun Sep 04 14:45:03 2005 -0700
+++ b/mercurial/changelog.py	Sun Sep 04 14:47:02 2005 -0700
@@ -35,7 +35,10 @@
             # validate explicit (probably user-specified) date and
             # time zone offset. values must fit in signed 32 bits for
             # current 32-bit linux runtimes.
-            when, offset = map(int, date.split(' '))
+            try:
+                when, offset = map(int, date.split(' '))
+            except ValueError:
+                raise ValueError('invalid date: %r' % date)
             if abs(when) > 0x7fffffff:
                 raise ValueError('date exceeds 32 bits: %d' % when)
             if abs(offset) >= 43200: