changeset 3257:c9cd63a6fce9

Add documentation about the date formats allowed in the command line
author Jose M. Prieto <jmprieto@gmx.net>
date Tue, 03 Oct 2006 12:33:22 +0200
parents e5c9a084ffe3
children 03acd01520ac
files doc/hg.1.txt mercurial/util.py tests/test-commit.out tests/test-parse-date.out
diffstat 4 files changed, 43 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/doc/hg.1.txt	Tue Oct 03 12:33:18 2006 +0200
+++ b/doc/hg.1.txt	Tue Oct 03 12:33:22 2006 +0200
@@ -127,6 +127,42 @@
     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
 ---------------------
 
--- a/mercurial/util.py	Tue Oct 03 12:33:18 2006 +0200
+++ b/mercurial/util.py	Tue Oct 03 12:33:22 2006 +0200
@@ -937,7 +937,9 @@
             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
--- a/tests/test-commit.out	Tue Oct 03 12:33:18 2006 +0200
+++ b/tests/test-commit.out	Tue Oct 03 12:33:22 2006 +0200
@@ -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
--- a/tests/test-parse-date.out	Tue Oct 03 12:33:18 2006 +0200
+++ b/tests/test-parse-date.out	Tue Oct 03 12:33:22 2006 +0200
@@ -3,7 +3,7 @@
 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