changeset 36234:48783333f45c stable

date: fix parsing months Thanks nemo for discovering this on #mercurial IRC channel. Test Plan: Add a test. It fails before this patch: ``` + hg: parse error: invalid date: 'Feb 2018' + hg: parse error: invalid date: 'Apr 2018' + hg: parse error: invalid date: 'Jun 2018' + hg: parse error: invalid date: 'Sep 2018' + hg: parse error: invalid date: 'Nov 2018' ``` Differential Revision: https://phab.mercurial-scm.org/D2289
author Jun Wu <quark@fb.com>
date Fri, 16 Feb 2018 13:25:39 -0800
parents 9f454a717c43
children d879aab17786 e978e0c13252
files mercurial/util.py tests/test-parse-date.t
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py	Tue Feb 13 18:12:26 2018 +0800
+++ b/mercurial/util.py	Fri Feb 16 13:25:39 2018 -0800
@@ -2179,7 +2179,7 @@
             try:
                 d["d"] = days
                 return parsedate(date, extendeddateformats, d)[0]
-            except Abort:
+            except error.ParseError:
                 pass
         d["d"] = "28"
         return parsedate(date, extendeddateformats, d)[0]
--- a/tests/test-parse-date.t	Tue Feb 13 18:12:26 2018 +0800
+++ b/tests/test-parse-date.t	Fri Feb 16 13:25:39 2018 -0800
@@ -286,3 +286,9 @@
   $ hg debugdate "2016-07-27 121021Z"
   internal: 1469621421 0
   standard: Wed Jul 27 12:10:21 2016 +0000
+
+Test parsing months
+
+  $ for i in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec; do
+  >   hg log -d "$i 2018" -r null
+  > done