parsedate: abort on negative dates (
issue2513)
catches "hg commit -d '-7654321 3600'" (example)
--- a/mercurial/util.py Wed Dec 01 17:50:49 2010 -0600
+++ b/mercurial/util.py Wed Nov 24 19:31:43 2010 +0100
@@ -1116,6 +1116,8 @@
# to UTC+14
if abs(when) > 0x7fffffff:
raise Abort(_('date exceeds 32 bits: %d') % when)
+ if when < 0:
+ raise Abort(_('negative date value: %d') % when)
if offset < -50400 or offset > 43200:
raise Abort(_('impossible time zone offset: %d') % offset)
return when, offset
--- a/tests/test-commit.t Wed Dec 01 17:50:49 2010 -0600
+++ b/tests/test-commit.t Wed Nov 24 19:31:43 2010 +0100
@@ -22,6 +22,9 @@
$ hg commit -d '111111111111 0' -m commit-7
abort: date exceeds 32 bits: 111111111111
[255]
+ $ hg commit -d '-7654321 3600' -m commit-7
+ abort: negative date value: -7654321
+ [255]
commit added file that has been deleted