diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -440,7 +440,14 @@ def versiontuple(v=None, n=4): # used by parsedate defaultdateformats = ( - '%Y-%m-%d %H:%M:%S', + '%Y-%m-%dT%H:%M:%S', # the 'real' ISO8601 + '%Y-%m-%dT%H:%M', # without seconds + '%Y-%m-%dT%H%M%S', # another awful but legal variant without : + '%Y-%m-%dT%H%M', # without seconds + '%Y-%m-%d %H:%M:%S', # our common legal variant + '%Y-%m-%d %H:%M', # without seconds + '%Y-%m-%d %H%M%S', # without : + '%Y-%m-%d %H%M', # without seconds '%Y-%m-%d %I:%M:%S%p', '%Y-%m-%d %H:%M', '%Y-%m-%d %I:%M%p', 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 @@ -258,3 +258,31 @@ Test issue 3764 (interpreting 'today' an $ hg log -d today --template '{desc}\n' Explicitly committed now. today is a good day to code + +Test parsing various ISO8601 forms + + $ hg debugdate "2016-07-27T12:10:21" + internal: 1469646621 * (glob) + standard: Wed Jul 27 12:10:21 2016 -0700 + $ hg debugdate "2016-07-27T12:10:21Z" + internal: 1469621421 0 + standard: Wed Jul 27 12:10:21 2016 +0000 + $ hg debugdate "2016-07-27T12:10:21+00:00" + internal: 1469621421 0 + standard: Wed Jul 27 12:10:21 2016 +0000 + $ hg debugdate "2016-07-27T121021Z" + internal: 1469621421 0 + standard: Wed Jul 27 12:10:21 2016 +0000 + + $ hg debugdate "2016-07-27 12:10:21" + internal: 1469646621 * (glob) + standard: Wed Jul 27 12:10:21 2016 -0700 + $ hg debugdate "2016-07-27 12:10:21Z" + internal: 1469621421 0 + standard: Wed Jul 27 12:10:21 2016 +0000 + $ hg debugdate "2016-07-27 12:10:21+00:00" + internal: 1469621421 0 + standard: Wed Jul 27 12:10:21 2016 +0000 + $ hg debugdate "2016-07-27 121021Z" + internal: 1469621421 0 + standard: Wed Jul 27 12:10:21 2016 +0000