[PATCH 3 of 3 STABLE] date: accept broader range of ISO 8601 time specs
Kevin Bullock
kbullock+mercurial at ringworld.org
Wed Jul 27 18:10:15 EDT 2016
> On Jul 27, 2016, at 15:48, Matt Mackall <mpm at selenic.com> wrote:
>
> # HG changeset patch
> # User Matt Mackall <mpm at selenic.com>
> # Date 1469650956 18000
> # Wed Jul 27 15:22:36 2016 -0500
> # Branch stable
> # Node ID 114728123ca15c6e614ad4ad7d6c719ba9f0ac7b
> # Parent a8d5ca11a21b8c833577e9265b3a16f78a528c63
> date: accept broader range of ISO 8601 time specs
>
> The "normal" ISO date/time includes a T between date and time. It also
> allows dropping the colons and seconds from the timespec. Add new
> patterns for these forms as well as tests.
>
> diff -r a8d5ca11a21b -r 114728123ca1 mercurial/util.py
> --- a/mercurial/util.py Wed Jul 27 15:20:34 2016 -0500
> +++ b/mercurial/util.py Wed Jul 27 15:22:36 2016 -0500
> @@ -440,7 +440,14 @@
>
> # 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',
> @@ -1764,7 +1771,7 @@
> if s.endswith("Z") and s[-2:-1].isdigit():
> return 0, s[:-1]
>
> - # ISO8601-style [+-]hh:mm
> + # ISO860-style [+-]hh:mm
Errr...?
pacem in terris / мир / शान्ति / سَلاَم / 平和
Kevin R. Bullock
More information about the Mercurial-devel
mailing list