log: abort for -d '>' or -d '<' (
issue2749)
--- a/mercurial/util.py Mon Apr 04 00:05:41 2011 +0200
+++ b/mercurial/util.py Mon Apr 04 00:23:21 2011 +0800
@@ -1222,9 +1222,13 @@
if not date:
raise Abort(_("dates cannot consist entirely of whitespace"))
elif date[0] == "<":
+ if not date[1:]:
+ raise Abort(_("invalid day spec. use '<{datetime}' "))
when = upper(date[1:])
return lambda x: x <= when
elif date[0] == ">":
+ if not date[1:]:
+ raise Abort(_("invalid day spec. use '>{datetime}' "))
when = lower(date[1:])
return lambda x: x >= when
elif date[0] == "-":
--- a/tests/test-log.t Mon Apr 04 00:05:41 2011 +0200
+++ b/tests/test-log.t Mon Apr 04 00:23:21 2011 +0800
@@ -522,6 +522,18 @@
$ hg log -d -1
+log -d ">"
+
+ $ hg log -d ">"
+ abort: invalid day spec. use '>{datetime}'
+ [255]
+
+log -d "<"
+
+ $ hg log -d "<"
+ abort: invalid day spec. use '<{datetime}'
+ [255]
+
log -p -l2 --color=always