# HG changeset patch # User Jose M. Prieto # Date 1159871602 -7200 # Node ID c9cd63a6fce91116ae6e97e9537e9ac7bcb81e12 # Parent e5c9a084ffe3607b01052d59a11c03f16508eed0 Add documentation about the date formats allowed in the command line diff --git a/doc/hg.1.txt b/doc/hg.1.txt --- a/doc/hg.1.txt +++ b/doc/hg.1.txt @@ -127,6 +127,42 @@ SPECIFYING MULTIPLE REVISIONS A range acts as a closed interval. This means that a range of 3:5 gives 3, 4 and 5. Similarly, a range of 4:2 gives 4, 3, and 2. +DATE FORMATS +------------ + + Some commands (backout, commit, tag) allow the user to specify a date. + Possible formats for dates are: + +YYYY-mm-dd \HH:MM[:SS] [(+|-)NNNN]:: + This is a subset of ISO 8601, allowing just the recommended notations + for date and time. The last part represents the timezone; if omitted, + local time is assumed. Examples: + + "2005-08-22 03:27 -0700" + + "2006-04-19 21:39:51" + +aaa bbb dd HH:MM:SS YYYY [(+|-)NNNN]:: + This is the date format used by the C library. Here, aaa stands for + abbreviated weekday name and bbb for abbreviated month name. The last + part represents the timezone; if omitted, local time is assumed. + Examples: + + "Mon Aug 22 03:27:00 2005 -0700" + + "Wed Apr 19 21:39:51 2006" + +unixtime offset:: + This is the internal representation format for dates. unixtime is + the number of seconds since the epoch (1970-01-01 00:00 UTC). offset + is the offset of the local timezone, in seconds west of UTC (negative + if the timezone is east of UTC). + Examples: + + "1124706420 25200" (2005-08-22 03:27:00 -0700) + + "1145475591 -7200" (2006-04-19 21:39:51 +0200) + ENVIRONMENT VARIABLES --------------------- diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -937,7 +937,9 @@ def parsedate(string, formats=None): else: break else: - raise ValueError(_('invalid date: %r') % string) + raise ValueError(_('invalid date: %r ' + 'see hg(1) manual page for details') + % string) # validate explicit (probably user-specified) date and # time zone offset. values must fit in signed 32 bits for # current 32-bit linux runtimes. timezones go from UTC-12 diff --git a/tests/test-commit.out b/tests/test-commit.out --- a/tests/test-commit.out +++ b/tests/test-commit.out @@ -1,13 +1,13 @@ abort: impossible time zone offset: 4444444 transaction abort! rollback completed -abort: invalid date: '1\t15.1' +abort: invalid date: '1\t15.1' see hg(1) manual page for details transaction abort! rollback completed -abort: invalid date: 'foo bar' +abort: invalid date: 'foo bar' see hg(1) manual page for details transaction abort! rollback completed -abort: invalid date: ' 1 4444' +abort: invalid date: ' 1 4444' see hg(1) manual page for details transaction abort! rollback completed abort: date exceeds 32 bits: 111111111111 diff --git a/tests/test-parse-date.out b/tests/test-parse-date.out --- a/tests/test-parse-date.out +++ b/tests/test-parse-date.out @@ -3,7 +3,7 @@ changeset 3:107ce1ee2b43 backs out chang merging with changeset 2:e6c3abc120e7 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) -abort: invalid date: 'should fail' +abort: invalid date: 'should fail' see hg(1) manual page for details transaction abort! rollback completed abort: date exceeds 32 bits: 100000000000000000