log: abort for -d '>' or -d '<' (issue2749)
authorYun Lee <yunlee.bj@gmail.com>
Mon, 04 Apr 2011 00:23:21 +0800
changeset 13867 28f557e8b419
parent 13866 2f93a4a10144
child 13868 38906cf9d15c
log: abort for -d '>' or -d '<' (issue2749)
mercurial/util.py
tests/test-log.t
--- 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