# HG changeset patch # User Idan Kamara # Date 2011-03-27 21:48:58 # Node ID bc7b5d1c1999d577996d1be43e845d034e9fc2a4 # Parent c13bfa451656f5fd9d677f7524d3693c83aa86fc util: dates cannot consist entirely of whitespace (issue2732) diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -1215,7 +1215,10 @@ def matchdate(date): return parsedate(date, extendeddateformats, d)[0] date = date.strip() - if date[0] == "<": + + if not date: + raise Abort(_("dates cannot consist entirely of whitespace")) + elif date[0] == "<": when = upper(date[1:]) return lambda x: x <= when elif date[0] == ">": diff --git a/tests/test-log.t b/tests/test-log.t --- a/tests/test-log.t +++ b/tests/test-log.t @@ -512,7 +512,11 @@ log -k r1 date: Thu Jan 01 00:00:01 1970 +0000 summary: r1 +log -d " " (whitespaces only) + $ hg log -d " " + abort: dates cannot consist entirely of whitespace + [255] log -d -1