Patchwork D2289: date: fix parsing months

login
register
mail settings
Submitter phabricator
Date Feb. 16, 2018, 9:26 p.m.
Message ID <differential-rev-PHID-DREV-dkb34vu7ppasq35oeasg-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/27994/
State Superseded
Headers show

Comments

phabricator - Feb. 16, 2018, 9:26 p.m.
quark created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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'

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2289

AFFECTED FILES
  mercurial/util.py
  tests/test-parse-date.t

CHANGE DETAILS




To: quark, #hg-reviewers
Cc: mercurial-devel
phabricator - Feb. 16, 2018, 9:28 p.m.
martinvonz added a comment.


  Queuing for stable

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2289

To: quark, #hg-reviewers, martinvonz
Cc: mercurial-devel

Patch

diff --git a/tests/test-parse-date.t b/tests/test-parse-date.t
--- a/tests/test-parse-date.t
+++ b/tests/test-parse-date.t
@@ -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
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -2212,7 +2212,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]