util: dates cannot consist entirely of whitespace (issue2732)
authorIdan Kamara <idankk86@gmail.com>
Sun, 27 Mar 2011 23:48:58 +0200
changeset 13780 bc7b5d1c1999
parent 13779 c13bfa451656
child 13781 66c54d2ebe72
util: dates cannot consist entirely of whitespace (issue2732)
mercurial/util.py
tests/test-log.t
--- a/mercurial/util.py	Fri Mar 25 15:49:43 2011 -0400
+++ b/mercurial/util.py	Sun Mar 27 23:48:58 2011 +0200
@@ -1215,7 +1215,10 @@
         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] == ">":
--- a/tests/test-log.t	Fri Mar 25 15:49:43 2011 -0400
+++ b/tests/test-log.t	Sun Mar 27 23:48:58 2011 +0200
@@ -512,7 +512,11 @@
   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