Mercurial > hg
changeset 13062:e1002cf9fe54 stable
parsedate: abort on negative dates (issue2513)
catches "hg commit -d '-7654321 3600'" (example)
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Wed, 24 Nov 2010 19:31:43 +0100 |
parents | 7e734ddad2e7 |
children | e98581d44f0b |
files | mercurial/util.py tests/test-commit.t |
diffstat | 2 files changed, 5 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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