changeset 7953:8c6f823efcc9

Correct a bug on date formats with '>' or '<' accompanied by space characters.
author Justin Peng <justin.peng.sw@gmail.com>
date Wed, 01 Apr 2009 09:11:00 -0700
parents b214066b7e1d
children b969611064ae
files mercurial/util.py tests/test-parse-date tests/test-parse-date.out
diffstat 3 files changed, 147 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py	Sun Mar 29 14:43:49 2009 +0200
+++ b/mercurial/util.py	Wed Apr 01 09:11:00 2009 -0700
@@ -1315,6 +1315,7 @@
         d["d"] = "28"
         return parsedate(date, extendeddateformats, d)[0]
 
+    date = date.strip()
     if date[0] == "<":
         when = upper(date[1:])
         return lambda x: x <= when
--- a/tests/test-parse-date	Sun Mar 29 14:43:49 2009 +0200
+++ b/tests/test-parse-date	Wed Apr 01 09:11:00 2009 -0700
@@ -43,3 +43,41 @@
 hg debugdate "1000000000 16200"  # -0430
 hg debugdate "Sat Sep 08 21:16:40 2001 +0430"
 hg debugdate "Sat Sep 08 21:16:40 2001 -0430"
+
+#Test date formats with '>' or '<' accompanied by space characters
+hg log -d '>' --template '{date|date}\n'
+hg log -d '<' hg log -d '>' --template '{date|date}\n'
+
+hg log -d ' >' --template '{date|date}\n'
+hg log -d ' <' --template '{date|date}\n'
+
+hg log -d '> ' --template '{date|date}\n'
+hg log -d '< ' --template '{date|date}\n'
+
+hg log -d ' > ' --template '{date|date}\n'
+hg log -d ' < ' --template '{date|date}\n'
+
+
+hg log -d '>02/01' --template '{date|date}\n'
+hg log -d '<02/01' --template '{date|date}\n'
+
+hg log -d ' >02/01' --template '{date|date}\n'
+hg log -d ' <02/01' --template '{date|date}\n'
+
+hg log -d '> 02/01' --template '{date|date}\n'
+hg log -d '< 02/01' --template '{date|date}\n'
+
+hg log -d ' > 02/01' --template '{date|date}\n'
+hg log -d ' < 02/01' --template '{date|date}\n'
+
+hg log -d '>02/01 ' --template '{date|date}\n'
+hg log -d '<02/01 ' --template '{date|date}\n'
+
+hg log -d ' >02/01 ' --template '{date|date}\n'
+hg log -d ' <02/01 ' --template '{date|date}\n'
+
+hg log -d '> 02/01 ' --template '{date|date}\n'
+hg log -d '< 02/01 ' --template '{date|date}\n'
+
+hg log -d ' > 02/01 ' --template '{date|date}\n'
+hg log -d ' < 02/01 ' --template '{date|date}\n'
\ No newline at end of file
--- a/tests/test-parse-date.out	Sun Mar 29 14:43:49 2009 +0200
+++ b/tests/test-parse-date.out	Wed Apr 01 09:11:00 2009 -0700
@@ -34,3 +34,111 @@
 standard: Sat Sep 08 21:16:40 2001 +0430
 internal: 1000000000 16200
 standard: Sat Sep 08 21:16:40 2001 -0430
+Sun Jan 15 13:30:00 2006 +0500
+Sun Jan 15 13:30:00 2006 -0800
+Sat Jul 15 13:30:00 2006 +0500
+Sat Jul 15 13:30:00 2006 -0700
+Sun Jun 11 00:26:40 2006 -0400
+Sat Apr 15 13:30:00 2006 +0200
+Sat Apr 15 13:30:00 2006 +0000
+Wed Feb 01 13:00:30 2006 -0500
+Wed Feb 01 13:00:30 2006 +0000
+Sun Jan 15 13:30:00 2006 +0500
+Sun Jan 15 13:30:00 2006 -0800
+Sat Jul 15 13:30:00 2006 +0500
+Sat Jul 15 13:30:00 2006 -0700
+Sun Jun 11 00:26:40 2006 -0400
+Sat Apr 15 13:30:00 2006 +0200
+Sat Apr 15 13:30:00 2006 +0000
+Wed Feb 01 13:00:30 2006 -0500
+Wed Feb 01 13:00:30 2006 +0000
+Sun Jan 15 13:30:00 2006 +0500
+Sun Jan 15 13:30:00 2006 -0800
+Sat Jul 15 13:30:00 2006 +0500
+Sat Jul 15 13:30:00 2006 -0700
+Sun Jun 11 00:26:40 2006 -0400
+Sat Apr 15 13:30:00 2006 +0200
+Sat Apr 15 13:30:00 2006 +0000
+Wed Feb 01 13:00:30 2006 -0500
+Wed Feb 01 13:00:30 2006 +0000
+Sun Jan 15 13:30:00 2006 +0500
+Sun Jan 15 13:30:00 2006 -0800
+Sat Jul 15 13:30:00 2006 +0500
+Sat Jul 15 13:30:00 2006 -0700
+Sun Jun 11 00:26:40 2006 -0400
+Sat Apr 15 13:30:00 2006 +0200
+Sat Apr 15 13:30:00 2006 +0000
+Wed Feb 01 13:00:30 2006 -0500
+Wed Feb 01 13:00:30 2006 +0000
+Sun Jan 15 13:30:00 2006 +0500
+Sun Jan 15 13:30:00 2006 -0800
+Sat Jul 15 13:30:00 2006 +0500
+Sat Jul 15 13:30:00 2006 -0700
+Sun Jun 11 00:26:40 2006 -0400
+Sat Apr 15 13:30:00 2006 +0200
+Sat Apr 15 13:30:00 2006 +0000
+Wed Feb 01 13:00:30 2006 -0500
+Wed Feb 01 13:00:30 2006 +0000
+Sun Jan 15 13:30:00 2006 +0500
+Sun Jan 15 13:30:00 2006 -0800
+Sat Jul 15 13:30:00 2006 +0500
+Sat Jul 15 13:30:00 2006 -0700
+Sun Jun 11 00:26:40 2006 -0400
+Sat Apr 15 13:30:00 2006 +0200
+Sat Apr 15 13:30:00 2006 +0000
+Wed Feb 01 13:00:30 2006 -0500
+Wed Feb 01 13:00:30 2006 +0000
+Sun Jan 15 13:30:00 2006 +0500
+Sun Jan 15 13:30:00 2006 -0800
+Sat Jul 15 13:30:00 2006 +0500
+Sat Jul 15 13:30:00 2006 -0700
+Sun Jun 11 00:26:40 2006 -0400
+Sat Apr 15 13:30:00 2006 +0200
+Sat Apr 15 13:30:00 2006 +0000
+Wed Feb 01 13:00:30 2006 -0500
+Wed Feb 01 13:00:30 2006 +0000
+Sun Jan 15 13:30:00 2006 +0500
+Sun Jan 15 13:30:00 2006 -0800
+Sat Jul 15 13:30:00 2006 +0500
+Sat Jul 15 13:30:00 2006 -0700
+Sun Jun 11 00:26:40 2006 -0400
+Sat Apr 15 13:30:00 2006 +0200
+Sat Apr 15 13:30:00 2006 +0000
+Wed Feb 01 13:00:30 2006 -0500
+Wed Feb 01 13:00:30 2006 +0000
+Sun Jan 15 13:30:00 2006 +0500
+Sun Jan 15 13:30:00 2006 -0800
+Sat Jul 15 13:30:00 2006 +0500
+Sat Jul 15 13:30:00 2006 -0700
+Sun Jun 11 00:26:40 2006 -0400
+Sat Apr 15 13:30:00 2006 +0200
+Sat Apr 15 13:30:00 2006 +0000
+Wed Feb 01 13:00:30 2006 -0500
+Wed Feb 01 13:00:30 2006 +0000
+Sun Jan 15 13:30:00 2006 +0500
+Sun Jan 15 13:30:00 2006 -0800
+Sat Jul 15 13:30:00 2006 +0500
+Sat Jul 15 13:30:00 2006 -0700
+Sun Jun 11 00:26:40 2006 -0400
+Sat Apr 15 13:30:00 2006 +0200
+Sat Apr 15 13:30:00 2006 +0000
+Wed Feb 01 13:00:30 2006 -0500
+Wed Feb 01 13:00:30 2006 +0000
+Sun Jan 15 13:30:00 2006 +0500
+Sun Jan 15 13:30:00 2006 -0800
+Sat Jul 15 13:30:00 2006 +0500
+Sat Jul 15 13:30:00 2006 -0700
+Sun Jun 11 00:26:40 2006 -0400
+Sat Apr 15 13:30:00 2006 +0200
+Sat Apr 15 13:30:00 2006 +0000
+Wed Feb 01 13:00:30 2006 -0500
+Wed Feb 01 13:00:30 2006 +0000
+Sun Jan 15 13:30:00 2006 +0500
+Sun Jan 15 13:30:00 2006 -0800
+Sat Jul 15 13:30:00 2006 +0500
+Sat Jul 15 13:30:00 2006 -0700
+Sun Jun 11 00:26:40 2006 -0400
+Sat Apr 15 13:30:00 2006 +0200
+Sat Apr 15 13:30:00 2006 +0000
+Wed Feb 01 13:00:30 2006 -0500
+Wed Feb 01 13:00:30 2006 +0000