tests/test-parse-date.t
author Manuel Jacob <me@manueljacob.de>
Thu, 15 Sep 2022 01:48:38 +0200
changeset 49494 c96ed4029fda
parent 46419 6894c9ef4dcd
permissions -rw-r--r--
templates: add filter to reverse list The filter supports only lists because for lists, it’s straightforward to implement. Reversing text doesn’t seem very useful and is hard to implement. Reversing the bytes would break multi-bytes encodings. Reversing the code points would break characters consisting of multiple code points. Reversing graphemes is non-trivial without using a library not included in the standard library.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12123
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
     1
This runs with TZ="GMT"
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
     2
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
     3
  $ hg init
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
     4
  $ echo "test-parse-date" > a
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
     5
  $ hg add a
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
     6
  $ hg ci -d "2006-02-01 13:00:30" -m "rev 0"
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
     7
  $ echo "hi!" >> a
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
     8
  $ hg ci -d "2006-02-01 13:00:30 -0500" -m "rev 1"
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
     9
  $ hg tag -d "2006-04-15 13:30" "Hi"
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    10
  $ hg backout --merge -d "2006-04-15 13:30 +0200" -m "rev 3" 1
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    11
  reverting a
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    12
  created new head
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    13
  changeset 3:107ce1ee2b43 backs out changeset 1:25a1420a55f8
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    14
  merging with changeset 3:107ce1ee2b43
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    15
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    16
  (branch merge, don't forget to commit)
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    17
  $ hg ci -d "1150000000 14400" -m "rev 4 (merge)"
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    18
  $ echo "fail" >> a
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    19
  $ hg ci -d "should fail" -m "fail"
32462
bb18728ea617 util: raise ParseError when parsing dates (BC)
Boris Feld <boris.feld@octobus.net>
parents: 29977
diff changeset
    20
  hg: parse error: invalid date: 'should fail'
45895
fc4fb2f17dd4 errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 38080
diff changeset
    21
  [10]
12123
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    22
  $ hg ci -d "100000000000000000 1400" -m "fail"
32462
bb18728ea617 util: raise ParseError when parsing dates (BC)
Boris Feld <boris.feld@octobus.net>
parents: 29977
diff changeset
    23
  hg: parse error: date exceeds 32 bits: 100000000000000000
45895
fc4fb2f17dd4 errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 38080
diff changeset
    24
  [10]
12123
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    25
  $ hg ci -d "100000 1400000" -m "fail"
32462
bb18728ea617 util: raise ParseError when parsing dates (BC)
Boris Feld <boris.feld@octobus.net>
parents: 29977
diff changeset
    26
  hg: parse error: impossible time zone offset: 1400000
45895
fc4fb2f17dd4 errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 38080
diff changeset
    27
  [10]
12123
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    28
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    29
Check with local timezone other than GMT and with DST
2522
85f796baab10 Allow the use of human readable dates (issue 251)
Jose M. Prieto <jmprieto@gmx.net>
parents:
diff changeset
    30
28441
79d8e7926a04 test-parse-date: defines explicit start/end dates for DST
Sébastien Brissaud <sebastien@brissaud.name>
parents: 23917
diff changeset
    31
  $ TZ="PST+8PDT+7,M4.1.0/02:00:00,M10.5.0/02:00:00"
12123
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    32
  $ export TZ
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    33
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    34
PST=UTC-8 / PDT=UTC-7
28441
79d8e7926a04 test-parse-date: defines explicit start/end dates for DST
Sébastien Brissaud <sebastien@brissaud.name>
parents: 23917
diff changeset
    35
Summer time begins on April's first Sunday at 2:00am,
79d8e7926a04 test-parse-date: defines explicit start/end dates for DST
Sébastien Brissaud <sebastien@brissaud.name>
parents: 23917
diff changeset
    36
and ends on October's last Sunday at 2:00am.
12123
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    37
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    38
  $ hg debugrebuildstate
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    39
  $ echo "a" > a
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    40
  $ hg ci -d "2006-07-15 13:30" -m "summer@UTC-7"
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    41
  $ hg debugrebuildstate
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    42
  $ echo "b" > a
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    43
  $ hg ci -d "2006-07-15 13:30 +0500" -m "summer@UTC+5"
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    44
  $ hg debugrebuildstate
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    45
  $ echo "c" > a
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    46
  $ hg ci -d "2006-01-15 13:30" -m "winter@UTC-8"
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    47
  $ hg debugrebuildstate
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    48
  $ echo "d" > a
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    49
  $ hg ci -d "2006-01-15 13:30 +0500" -m "winter@UTC+5"
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    50
  $ hg log --template '{date|date}\n'
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    51
  Sun Jan 15 13:30:00 2006 +0500
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    52
  Sun Jan 15 13:30:00 2006 -0800
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    53
  Sat Jul 15 13:30:00 2006 +0500
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    54
  Sat Jul 15 13:30:00 2006 -0700
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    55
  Sun Jun 11 00:26:40 2006 -0400
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    56
  Sat Apr 15 13:30:00 2006 +0200
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    57
  Sat Apr 15 13:30:00 2006 +0000
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    58
  Wed Feb 01 13:00:30 2006 -0500
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    59
  Wed Feb 01 13:00:30 2006 +0000
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    60
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    61
Test issue1014 (fractional timezones)
3255
e96d2956eb4a util.strdate: compute timestamp using UTC, not local timezone
Jose M. Prieto <jmprieto@gmx.net>
parents: 2524
diff changeset
    62
12123
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    63
  $ hg debugdate "1000000000 -16200" # 0430
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    64
  internal: 1000000000 -16200
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    65
  standard: Sun Sep 09 06:16:40 2001 +0430
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    66
  $ hg debugdate "1000000000 -15300" # 0415
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    67
  internal: 1000000000 -15300
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    68
  standard: Sun Sep 09 06:01:40 2001 +0415
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    69
  $ hg debugdate "1000000000 -14400" # 0400
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    70
  internal: 1000000000 -14400
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    71
  standard: Sun Sep 09 05:46:40 2001 +0400
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    72
  $ hg debugdate "1000000000 0"      # GMT
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    73
  internal: 1000000000 0
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    74
  standard: Sun Sep 09 01:46:40 2001 +0000
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    75
  $ hg debugdate "1000000000 14400"  # -0400
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    76
  internal: 1000000000 14400
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    77
  standard: Sat Sep 08 21:46:40 2001 -0400
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    78
  $ hg debugdate "1000000000 15300"  # -0415
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    79
  internal: 1000000000 15300
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    80
  standard: Sat Sep 08 21:31:40 2001 -0415
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    81
  $ hg debugdate "1000000000 16200"  # -0430
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    82
  internal: 1000000000 16200
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    83
  standard: Sat Sep 08 21:16:40 2001 -0430
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    84
  $ hg debugdate "Sat Sep 08 21:16:40 2001 +0430"
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    85
  internal: 999967600 -16200
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    86
  standard: Sat Sep 08 21:16:40 2001 +0430
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    87
  $ hg debugdate "Sat Sep 08 21:16:40 2001 -0430"
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    88
  internal: 1000000000 16200
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    89
  standard: Sat Sep 08 21:16:40 2001 -0430
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    90
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    91
Test 12-hours times
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    92
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    93
  $ hg debugdate "2006-02-01 1:00:30PM +0000"
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    94
  internal: 1138798830 0
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    95
  standard: Wed Feb 01 13:00:30 2006 +0000
12365
22f3353bcc36 tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12316
diff changeset
    96
  $ hg debugdate "1:00:30PM" > /dev/null
12123
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
    97
16923
dfaf869824f8 test-parse-date: move remaining date parsing tests from test-log
Martin Geisler <mg@aragost.com>
parents: 16921
diff changeset
    98
Normal range
dfaf869824f8 test-parse-date: move remaining date parsing tests from test-log
Martin Geisler <mg@aragost.com>
parents: 16921
diff changeset
    99
dfaf869824f8 test-parse-date: move remaining date parsing tests from test-log
Martin Geisler <mg@aragost.com>
parents: 16921
diff changeset
   100
  $ hg log -d -1
dfaf869824f8 test-parse-date: move remaining date parsing tests from test-log
Martin Geisler <mg@aragost.com>
parents: 16921
diff changeset
   101
dfaf869824f8 test-parse-date: move remaining date parsing tests from test-log
Martin Geisler <mg@aragost.com>
parents: 16921
diff changeset
   102
Negative range
dfaf869824f8 test-parse-date: move remaining date parsing tests from test-log
Martin Geisler <mg@aragost.com>
parents: 16921
diff changeset
   103
dfaf869824f8 test-parse-date: move remaining date parsing tests from test-log
Martin Geisler <mg@aragost.com>
parents: 16921
diff changeset
   104
  $ hg log -d "--2"
29977
73b1c328a7da util: use single quotes in use warning
timeless <timeless@mozdev.org>
parents: 29638
diff changeset
   105
  abort: -2 must be nonnegative (see 'hg help dates')
46419
6894c9ef4dcd errors: use InputError for incorrectly formatted dates
Martin von Zweigbergk <martinvonz@google.com>
parents: 45895
diff changeset
   106
  [10]
16923
dfaf869824f8 test-parse-date: move remaining date parsing tests from test-log
Martin Geisler <mg@aragost.com>
parents: 16921
diff changeset
   107
dfaf869824f8 test-parse-date: move remaining date parsing tests from test-log
Martin Geisler <mg@aragost.com>
parents: 16921
diff changeset
   108
Whitespace only
dfaf869824f8 test-parse-date: move remaining date parsing tests from test-log
Martin Geisler <mg@aragost.com>
parents: 16921
diff changeset
   109
dfaf869824f8 test-parse-date: move remaining date parsing tests from test-log
Martin Geisler <mg@aragost.com>
parents: 16921
diff changeset
   110
  $ hg log -d " "
dfaf869824f8 test-parse-date: move remaining date parsing tests from test-log
Martin Geisler <mg@aragost.com>
parents: 16921
diff changeset
   111
  abort: dates cannot consist entirely of whitespace
46419
6894c9ef4dcd errors: use InputError for incorrectly formatted dates
Martin von Zweigbergk <martinvonz@google.com>
parents: 45895
diff changeset
   112
  [10]
16923
dfaf869824f8 test-parse-date: move remaining date parsing tests from test-log
Martin Geisler <mg@aragost.com>
parents: 16921
diff changeset
   113
12123
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   114
Test date formats with '>' or '<' accompanied by space characters
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   115
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   116
  $ hg log -d '>' --template '{date|date}\n'
13886
fe48c57390f2 help/dates: use DATE as place-holder in help and abort texts
Martin Geisler <mg@aragost.com>
parents: 13869
diff changeset
   117
  abort: invalid day spec, use '>DATE'
46419
6894c9ef4dcd errors: use InputError for incorrectly formatted dates
Martin von Zweigbergk <martinvonz@google.com>
parents: 45895
diff changeset
   118
  [10]
16921
8627e9ceec08 test-parse-date: remove cruft from 8c6f823efcc9
Martin Geisler <mg@aragost.com>
parents: 13886
diff changeset
   119
  $ hg log -d '<' --template '{date|date}\n'
8627e9ceec08 test-parse-date: remove cruft from 8c6f823efcc9
Martin Geisler <mg@aragost.com>
parents: 13886
diff changeset
   120
  abort: invalid day spec, use '<DATE'
46419
6894c9ef4dcd errors: use InputError for incorrectly formatted dates
Martin von Zweigbergk <martinvonz@google.com>
parents: 45895
diff changeset
   121
  [10]
12123
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   122
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   123
  $ hg log -d ' >' --template '{date|date}\n'
13886
fe48c57390f2 help/dates: use DATE as place-holder in help and abort texts
Martin Geisler <mg@aragost.com>
parents: 13869
diff changeset
   124
  abort: invalid day spec, use '>DATE'
46419
6894c9ef4dcd errors: use InputError for incorrectly formatted dates
Martin von Zweigbergk <martinvonz@google.com>
parents: 45895
diff changeset
   125
  [10]
12123
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   126
  $ hg log -d ' <' --template '{date|date}\n'
13886
fe48c57390f2 help/dates: use DATE as place-holder in help and abort texts
Martin Geisler <mg@aragost.com>
parents: 13869
diff changeset
   127
  abort: invalid day spec, use '<DATE'
46419
6894c9ef4dcd errors: use InputError for incorrectly formatted dates
Martin von Zweigbergk <martinvonz@google.com>
parents: 45895
diff changeset
   128
  [10]
6236
ad6b123de1c7 Add tests for the fixes to issue1014 (fractional timezones)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3256
diff changeset
   129
12123
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   130
  $ hg log -d '> ' --template '{date|date}\n'
13886
fe48c57390f2 help/dates: use DATE as place-holder in help and abort texts
Martin Geisler <mg@aragost.com>
parents: 13869
diff changeset
   131
  abort: invalid day spec, use '>DATE'
46419
6894c9ef4dcd errors: use InputError for incorrectly formatted dates
Martin von Zweigbergk <martinvonz@google.com>
parents: 45895
diff changeset
   132
  [10]
12123
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   133
  $ hg log -d '< ' --template '{date|date}\n'
13886
fe48c57390f2 help/dates: use DATE as place-holder in help and abort texts
Martin Geisler <mg@aragost.com>
parents: 13869
diff changeset
   134
  abort: invalid day spec, use '<DATE'
46419
6894c9ef4dcd errors: use InputError for incorrectly formatted dates
Martin von Zweigbergk <martinvonz@google.com>
parents: 45895
diff changeset
   135
  [10]
12123
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   136
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   137
  $ hg log -d ' > ' --template '{date|date}\n'
13886
fe48c57390f2 help/dates: use DATE as place-holder in help and abort texts
Martin Geisler <mg@aragost.com>
parents: 13869
diff changeset
   138
  abort: invalid day spec, use '>DATE'
46419
6894c9ef4dcd errors: use InputError for incorrectly formatted dates
Martin von Zweigbergk <martinvonz@google.com>
parents: 45895
diff changeset
   139
  [10]
12123
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   140
  $ hg log -d ' < ' --template '{date|date}\n'
13886
fe48c57390f2 help/dates: use DATE as place-holder in help and abort texts
Martin Geisler <mg@aragost.com>
parents: 13869
diff changeset
   141
  abort: invalid day spec, use '<DATE'
46419
6894c9ef4dcd errors: use InputError for incorrectly formatted dates
Martin von Zweigbergk <martinvonz@google.com>
parents: 45895
diff changeset
   142
  [10]
7953
8c6f823efcc9 Correct a bug on date formats with '>' or '<' accompanied by space characters.
Justin Peng <justin.peng.sw@gmail.com>
parents: 6236
diff changeset
   143
12123
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   144
  $ hg log -d '>02/01' --template '{date|date}\n'
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   145
  $ hg log -d '<02/01' --template '{date|date}\n'
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   146
  Sun Jan 15 13:30:00 2006 +0500
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   147
  Sun Jan 15 13:30:00 2006 -0800
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   148
  Sat Jul 15 13:30:00 2006 +0500
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   149
  Sat Jul 15 13:30:00 2006 -0700
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   150
  Sun Jun 11 00:26:40 2006 -0400
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   151
  Sat Apr 15 13:30:00 2006 +0200
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   152
  Sat Apr 15 13:30:00 2006 +0000
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   153
  Wed Feb 01 13:00:30 2006 -0500
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   154
  Wed Feb 01 13:00:30 2006 +0000
9384
d91078a2652f test-parse-date: test 12-hours time formats (issue1804)
Patrick Mezard <pmezard@gmail.com>
parents: 7953
diff changeset
   155
12123
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   156
  $ hg log -d ' >02/01' --template '{date|date}\n'
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   157
  $ hg log -d ' <02/01' --template '{date|date}\n'
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   158
  Sun Jan 15 13:30:00 2006 +0500
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   159
  Sun Jan 15 13:30:00 2006 -0800
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   160
  Sat Jul 15 13:30:00 2006 +0500
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   161
  Sat Jul 15 13:30:00 2006 -0700
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   162
  Sun Jun 11 00:26:40 2006 -0400
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   163
  Sat Apr 15 13:30:00 2006 +0200
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   164
  Sat Apr 15 13:30:00 2006 +0000
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   165
  Wed Feb 01 13:00:30 2006 -0500
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   166
  Wed Feb 01 13:00:30 2006 +0000
7953
8c6f823efcc9 Correct a bug on date formats with '>' or '<' accompanied by space characters.
Justin Peng <justin.peng.sw@gmail.com>
parents: 6236
diff changeset
   167
12123
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   168
  $ hg log -d '> 02/01' --template '{date|date}\n'
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   169
  $ hg log -d '< 02/01' --template '{date|date}\n'
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   170
  Sun Jan 15 13:30:00 2006 +0500
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   171
  Sun Jan 15 13:30:00 2006 -0800
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   172
  Sat Jul 15 13:30:00 2006 +0500
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   173
  Sat Jul 15 13:30:00 2006 -0700
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   174
  Sun Jun 11 00:26:40 2006 -0400
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   175
  Sat Apr 15 13:30:00 2006 +0200
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   176
  Sat Apr 15 13:30:00 2006 +0000
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   177
  Wed Feb 01 13:00:30 2006 -0500
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   178
  Wed Feb 01 13:00:30 2006 +0000
7953
8c6f823efcc9 Correct a bug on date formats with '>' or '<' accompanied by space characters.
Justin Peng <justin.peng.sw@gmail.com>
parents: 6236
diff changeset
   179
12123
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   180
  $ hg log -d ' > 02/01' --template '{date|date}\n'
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   181
  $ hg log -d ' < 02/01' --template '{date|date}\n'
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   182
  Sun Jan 15 13:30:00 2006 +0500
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   183
  Sun Jan 15 13:30:00 2006 -0800
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   184
  Sat Jul 15 13:30:00 2006 +0500
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   185
  Sat Jul 15 13:30:00 2006 -0700
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   186
  Sun Jun 11 00:26:40 2006 -0400
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   187
  Sat Apr 15 13:30:00 2006 +0200
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   188
  Sat Apr 15 13:30:00 2006 +0000
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   189
  Wed Feb 01 13:00:30 2006 -0500
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   190
  Wed Feb 01 13:00:30 2006 +0000
7953
8c6f823efcc9 Correct a bug on date formats with '>' or '<' accompanied by space characters.
Justin Peng <justin.peng.sw@gmail.com>
parents: 6236
diff changeset
   191
12123
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   192
  $ hg log -d '>02/01 ' --template '{date|date}\n'
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   193
  $ hg log -d '<02/01 ' --template '{date|date}\n'
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   194
  Sun Jan 15 13:30:00 2006 +0500
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   195
  Sun Jan 15 13:30:00 2006 -0800
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   196
  Sat Jul 15 13:30:00 2006 +0500
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   197
  Sat Jul 15 13:30:00 2006 -0700
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   198
  Sun Jun 11 00:26:40 2006 -0400
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   199
  Sat Apr 15 13:30:00 2006 +0200
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   200
  Sat Apr 15 13:30:00 2006 +0000
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   201
  Wed Feb 01 13:00:30 2006 -0500
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   202
  Wed Feb 01 13:00:30 2006 +0000
7953
8c6f823efcc9 Correct a bug on date formats with '>' or '<' accompanied by space characters.
Justin Peng <justin.peng.sw@gmail.com>
parents: 6236
diff changeset
   203
12123
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   204
  $ hg log -d ' >02/01 ' --template '{date|date}\n'
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   205
  $ hg log -d ' <02/01 ' --template '{date|date}\n'
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   206
  Sun Jan 15 13:30:00 2006 +0500
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   207
  Sun Jan 15 13:30:00 2006 -0800
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   208
  Sat Jul 15 13:30:00 2006 +0500
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   209
  Sat Jul 15 13:30:00 2006 -0700
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   210
  Sun Jun 11 00:26:40 2006 -0400
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   211
  Sat Apr 15 13:30:00 2006 +0200
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   212
  Sat Apr 15 13:30:00 2006 +0000
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   213
  Wed Feb 01 13:00:30 2006 -0500
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   214
  Wed Feb 01 13:00:30 2006 +0000
7953
8c6f823efcc9 Correct a bug on date formats with '>' or '<' accompanied by space characters.
Justin Peng <justin.peng.sw@gmail.com>
parents: 6236
diff changeset
   215
12123
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   216
  $ hg log -d '> 02/01 ' --template '{date|date}\n'
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   217
  $ hg log -d '< 02/01 ' --template '{date|date}\n'
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   218
  Sun Jan 15 13:30:00 2006 +0500
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   219
  Sun Jan 15 13:30:00 2006 -0800
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   220
  Sat Jul 15 13:30:00 2006 +0500
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   221
  Sat Jul 15 13:30:00 2006 -0700
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   222
  Sun Jun 11 00:26:40 2006 -0400
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   223
  Sat Apr 15 13:30:00 2006 +0200
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   224
  Sat Apr 15 13:30:00 2006 +0000
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   225
  Wed Feb 01 13:00:30 2006 -0500
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   226
  Wed Feb 01 13:00:30 2006 +0000
7953
8c6f823efcc9 Correct a bug on date formats with '>' or '<' accompanied by space characters.
Justin Peng <justin.peng.sw@gmail.com>
parents: 6236
diff changeset
   227
12123
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   228
  $ hg log -d ' > 02/01 ' --template '{date|date}\n'
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   229
  $ hg log -d ' < 02/01 ' --template '{date|date}\n'
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   230
  Sun Jan 15 13:30:00 2006 +0500
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   231
  Sun Jan 15 13:30:00 2006 -0800
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   232
  Sat Jul 15 13:30:00 2006 +0500
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   233
  Sat Jul 15 13:30:00 2006 -0700
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   234
  Sun Jun 11 00:26:40 2006 -0400
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   235
  Sat Apr 15 13:30:00 2006 +0200
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   236
  Sat Apr 15 13:30:00 2006 +0000
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   237
  Wed Feb 01 13:00:30 2006 -0500
323292c2e566 tests: unify test-parse-date
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10282
diff changeset
   238
  Wed Feb 01 13:00:30 2006 +0000
18537
ae60735e37d2 dates: support 'today' and 'yesterday' in parsedate (issue3764)
Paul Cavallaro <ptc@fb.com>
parents: 16923
diff changeset
   239
ae60735e37d2 dates: support 'today' and 'yesterday' in parsedate (issue3764)
Paul Cavallaro <ptc@fb.com>
parents: 16923
diff changeset
   240
Test issue 3764 (interpreting 'today' and 'yesterday')
ae60735e37d2 dates: support 'today' and 'yesterday' in parsedate (issue3764)
Paul Cavallaro <ptc@fb.com>
parents: 16923
diff changeset
   241
  $ echo "hello" >> a
ae60735e37d2 dates: support 'today' and 'yesterday' in parsedate (issue3764)
Paul Cavallaro <ptc@fb.com>
parents: 16923
diff changeset
   242
  >>> import datetime
ae60735e37d2 dates: support 'today' and 'yesterday' in parsedate (issue3764)
Paul Cavallaro <ptc@fb.com>
parents: 16923
diff changeset
   243
  >>> today = datetime.date.today().strftime("%b %d")
ae60735e37d2 dates: support 'today' and 'yesterday' in parsedate (issue3764)
Paul Cavallaro <ptc@fb.com>
parents: 16923
diff changeset
   244
  >>> yesterday = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%b %d")
ae60735e37d2 dates: support 'today' and 'yesterday' in parsedate (issue3764)
Paul Cavallaro <ptc@fb.com>
parents: 16923
diff changeset
   245
  >>> dates = open('dates', 'w')
38080
0a10f142299d py3: suppress the output from .write() calls in few tests
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36234
diff changeset
   246
  >>> dates.write(today + '\n') and None
0a10f142299d py3: suppress the output from .write() calls in few tests
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36234
diff changeset
   247
  >>> dates.write(yesterday + '\n') and None
18537
ae60735e37d2 dates: support 'today' and 'yesterday' in parsedate (issue3764)
Paul Cavallaro <ptc@fb.com>
parents: 16923
diff changeset
   248
  >>> dates.close()
ae60735e37d2 dates: support 'today' and 'yesterday' in parsedate (issue3764)
Paul Cavallaro <ptc@fb.com>
parents: 16923
diff changeset
   249
  $ hg ci -d "`sed -n '1p' dates`" -m "today is a good day to code"
ae60735e37d2 dates: support 'today' and 'yesterday' in parsedate (issue3764)
Paul Cavallaro <ptc@fb.com>
parents: 16923
diff changeset
   250
  $ hg log -d today --template '{desc}\n'
ae60735e37d2 dates: support 'today' and 'yesterday' in parsedate (issue3764)
Paul Cavallaro <ptc@fb.com>
parents: 16923
diff changeset
   251
  today is a good day to code
ae60735e37d2 dates: support 'today' and 'yesterday' in parsedate (issue3764)
Paul Cavallaro <ptc@fb.com>
parents: 16923
diff changeset
   252
  $ echo "goodbye" >> a
ae60735e37d2 dates: support 'today' and 'yesterday' in parsedate (issue3764)
Paul Cavallaro <ptc@fb.com>
parents: 16923
diff changeset
   253
  $ hg ci -d "`sed -n '2p' dates`" -m "the time traveler's code"
ae60735e37d2 dates: support 'today' and 'yesterday' in parsedate (issue3764)
Paul Cavallaro <ptc@fb.com>
parents: 16923
diff changeset
   254
  $ hg log -d yesterday --template '{desc}\n'
ae60735e37d2 dates: support 'today' and 'yesterday' in parsedate (issue3764)
Paul Cavallaro <ptc@fb.com>
parents: 16923
diff changeset
   255
  the time traveler's code
18614
b2586e2cc67a parsedate: understand "now" as a shortcut for the current time
Augie Fackler <raf@durin42.com>
parents: 18537
diff changeset
   256
  $ echo "foo" >> a
b2586e2cc67a parsedate: understand "now" as a shortcut for the current time
Augie Fackler <raf@durin42.com>
parents: 18537
diff changeset
   257
  $ hg commit -d now -m 'Explicitly committed now.'
b2586e2cc67a parsedate: understand "now" as a shortcut for the current time
Augie Fackler <raf@durin42.com>
parents: 18537
diff changeset
   258
  $ hg log -d today --template '{desc}\n'
b2586e2cc67a parsedate: understand "now" as a shortcut for the current time
Augie Fackler <raf@durin42.com>
parents: 18537
diff changeset
   259
  Explicitly committed now.
b2586e2cc67a parsedate: understand "now" as a shortcut for the current time
Augie Fackler <raf@durin42.com>
parents: 18537
diff changeset
   260
  today is a good day to code
29638
491ee264b9f6 date: accept broader range of ISO 8601 time specs
Matt Mackall <mpm@selenic.com>
parents: 28441
diff changeset
   261
491ee264b9f6 date: accept broader range of ISO 8601 time specs
Matt Mackall <mpm@selenic.com>
parents: 28441
diff changeset
   262
Test parsing various ISO8601 forms
491ee264b9f6 date: accept broader range of ISO 8601 time specs
Matt Mackall <mpm@selenic.com>
parents: 28441
diff changeset
   263
491ee264b9f6 date: accept broader range of ISO 8601 time specs
Matt Mackall <mpm@selenic.com>
parents: 28441
diff changeset
   264
  $ hg debugdate "2016-07-27T12:10:21"
491ee264b9f6 date: accept broader range of ISO 8601 time specs
Matt Mackall <mpm@selenic.com>
parents: 28441
diff changeset
   265
  internal: 1469646621 * (glob)
491ee264b9f6 date: accept broader range of ISO 8601 time specs
Matt Mackall <mpm@selenic.com>
parents: 28441
diff changeset
   266
  standard: Wed Jul 27 12:10:21 2016 -0700
491ee264b9f6 date: accept broader range of ISO 8601 time specs
Matt Mackall <mpm@selenic.com>
parents: 28441
diff changeset
   267
  $ hg debugdate "2016-07-27T12:10:21Z"
491ee264b9f6 date: accept broader range of ISO 8601 time specs
Matt Mackall <mpm@selenic.com>
parents: 28441
diff changeset
   268
  internal: 1469621421 0
491ee264b9f6 date: accept broader range of ISO 8601 time specs
Matt Mackall <mpm@selenic.com>
parents: 28441
diff changeset
   269
  standard: Wed Jul 27 12:10:21 2016 +0000
491ee264b9f6 date: accept broader range of ISO 8601 time specs
Matt Mackall <mpm@selenic.com>
parents: 28441
diff changeset
   270
  $ hg debugdate "2016-07-27T12:10:21+00:00"
491ee264b9f6 date: accept broader range of ISO 8601 time specs
Matt Mackall <mpm@selenic.com>
parents: 28441
diff changeset
   271
  internal: 1469621421 0
491ee264b9f6 date: accept broader range of ISO 8601 time specs
Matt Mackall <mpm@selenic.com>
parents: 28441
diff changeset
   272
  standard: Wed Jul 27 12:10:21 2016 +0000
491ee264b9f6 date: accept broader range of ISO 8601 time specs
Matt Mackall <mpm@selenic.com>
parents: 28441
diff changeset
   273
  $ hg debugdate "2016-07-27T121021Z"
491ee264b9f6 date: accept broader range of ISO 8601 time specs
Matt Mackall <mpm@selenic.com>
parents: 28441
diff changeset
   274
  internal: 1469621421 0
491ee264b9f6 date: accept broader range of ISO 8601 time specs
Matt Mackall <mpm@selenic.com>
parents: 28441
diff changeset
   275
  standard: Wed Jul 27 12:10:21 2016 +0000
491ee264b9f6 date: accept broader range of ISO 8601 time specs
Matt Mackall <mpm@selenic.com>
parents: 28441
diff changeset
   276
491ee264b9f6 date: accept broader range of ISO 8601 time specs
Matt Mackall <mpm@selenic.com>
parents: 28441
diff changeset
   277
  $ hg debugdate "2016-07-27 12:10:21"
491ee264b9f6 date: accept broader range of ISO 8601 time specs
Matt Mackall <mpm@selenic.com>
parents: 28441
diff changeset
   278
  internal: 1469646621 * (glob)
491ee264b9f6 date: accept broader range of ISO 8601 time specs
Matt Mackall <mpm@selenic.com>
parents: 28441
diff changeset
   279
  standard: Wed Jul 27 12:10:21 2016 -0700
491ee264b9f6 date: accept broader range of ISO 8601 time specs
Matt Mackall <mpm@selenic.com>
parents: 28441
diff changeset
   280
  $ hg debugdate "2016-07-27 12:10:21Z"
491ee264b9f6 date: accept broader range of ISO 8601 time specs
Matt Mackall <mpm@selenic.com>
parents: 28441
diff changeset
   281
  internal: 1469621421 0
491ee264b9f6 date: accept broader range of ISO 8601 time specs
Matt Mackall <mpm@selenic.com>
parents: 28441
diff changeset
   282
  standard: Wed Jul 27 12:10:21 2016 +0000
491ee264b9f6 date: accept broader range of ISO 8601 time specs
Matt Mackall <mpm@selenic.com>
parents: 28441
diff changeset
   283
  $ hg debugdate "2016-07-27 12:10:21+00:00"
491ee264b9f6 date: accept broader range of ISO 8601 time specs
Matt Mackall <mpm@selenic.com>
parents: 28441
diff changeset
   284
  internal: 1469621421 0
491ee264b9f6 date: accept broader range of ISO 8601 time specs
Matt Mackall <mpm@selenic.com>
parents: 28441
diff changeset
   285
  standard: Wed Jul 27 12:10:21 2016 +0000
491ee264b9f6 date: accept broader range of ISO 8601 time specs
Matt Mackall <mpm@selenic.com>
parents: 28441
diff changeset
   286
  $ hg debugdate "2016-07-27 121021Z"
491ee264b9f6 date: accept broader range of ISO 8601 time specs
Matt Mackall <mpm@selenic.com>
parents: 28441
diff changeset
   287
  internal: 1469621421 0
491ee264b9f6 date: accept broader range of ISO 8601 time specs
Matt Mackall <mpm@selenic.com>
parents: 28441
diff changeset
   288
  standard: Wed Jul 27 12:10:21 2016 +0000
36234
48783333f45c date: fix parsing months
Jun Wu <quark@fb.com>
parents: 32462
diff changeset
   289
48783333f45c date: fix parsing months
Jun Wu <quark@fb.com>
parents: 32462
diff changeset
   290
Test parsing months
48783333f45c date: fix parsing months
Jun Wu <quark@fb.com>
parents: 32462
diff changeset
   291
48783333f45c date: fix parsing months
Jun Wu <quark@fb.com>
parents: 32462
diff changeset
   292
  $ for i in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec; do
48783333f45c date: fix parsing months
Jun Wu <quark@fb.com>
parents: 32462
diff changeset
   293
  >   hg log -d "$i 2018" -r null
48783333f45c date: fix parsing months
Jun Wu <quark@fb.com>
parents: 32462
diff changeset
   294
  > done