[PATCH] util: dates cannot consist entirely of whitespace (issue2732)
Idan Kamara
idankk86 at gmail.com
Sun Mar 27 16:51:10 CDT 2011
# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1301262538 -7200
# Node ID ebd8eb596a44fcf449fcb4372336ad767a5b07c0
# Parent 1ce0e80799c081be3267b4a67a42bbd72f2215c1
util: dates cannot consist entirely of whitespace (issue2732)
diff -r 1ce0e80799c0 -r ebd8eb596a44 mercurial/util.py
--- a/mercurial/util.py Sun Mar 27 12:59:25 2011 +0200
+++ 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] == ">":
diff -r 1ce0e80799c0 -r ebd8eb596a44 tests/test-log.t
--- a/tests/test-log.t Sun Mar 27 12:59:25 2011 +0200
+++ 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
More information about the Mercurial-devel
mailing list