2 # Add an extra option to set the DateFormat used in log output.
4 # Patch by Steve McIntyre <steve@einval.com>
5 diff -ruN cvs-1.12.13-old/doc/cvs.texinfo cvs-1.12.13/doc/cvs.texinfo
6 --- cvs-1.12.13-old/doc/cvs.texinfo 2005-09-23 10:02:53.000000000 +0800
7 +++ cvs-1.12.13/doc/cvs.texinfo 2006-02-26 23:03:05.000000000 +0800
8 @@ -14840,9 +14840,17 @@
9 group to using @code{cvs admin} to change the default keyword
10 substitution mode, lock revisions, unlock revisions, and
11 replace the log message, use @samp{UserAdminOptions=klum}.
15 +@cindex DateFormat, in CVSROOT/config
16 +@item DateFormat=@var{value}
17 +Control the output format of dates from cvs. cvs version 1.12.x
18 +changed the default format to use ``iso8601'' dates, which are
19 +better for many reasons. However, old scripts/programs written to
20 +parse the output of various cvs commands (especially cvs log) may
21 +not cope with the change in date format (e.g. gcvs). The default
22 +value of DateFormat will be ``iso8601'', but if you need temporary
23 +backwards-compatibility set DateFormat=old.
26 @c ---------------------------------------------------------------------
27 @node Environment variables
28 diff -ruN cvs-1.12.13-old/src/log.c cvs-1.12.13/src/log.c
29 --- cvs-1.12.13-old/src/log.c 2005-03-22 21:19:57.000000000 +0800
30 +++ cvs-1.12.13/src/log.c 2006-02-26 23:03:05.000000000 +0800
31 @@ -1607,8 +1607,12 @@
35 - sprintf (buf, "%04d-%02d-%02d %02d:%02d:%02d +0000", year, mon, mday,
38 + sprintf (buf, "%04d%c%02d%c%02d %02d:%02d:%02d +0000", year, datesep,
39 + mon, datesep, mday, hour, min, sec);
41 + sprintf (buf, "%04d%c%02d%c%02d %02d:%02d:%02d", year, datesep,
42 + mon, datesep, mday, hour, min, sec);
43 cvs_output_tagged ("date", buf);
45 cvs_output_tagged ("text", "; author: ");
46 diff -ruN cvs-1.12.13-old/src/main.c cvs-1.12.13/src/main.c
47 --- cvs-1.12.13-old/src/main.c 2006-02-26 23:03:04.000000000 +0800
48 +++ cvs-1.12.13/src/main.c 2006-02-26 23:10:12.000000000 +0800
49 @@ -1371,9 +1371,19 @@
50 static char buf[sizeof ("yyyy-mm-dd HH:MM:SS -HHMM")];
51 /* Convert to a time in the local time zone. */
52 struct tm ltm = *(localtime (&unixtime));
54 - if (!my_strftime (buf, sizeof (buf), "%Y-%m-%d %H:%M:%S %z", <m, 0, 0))
56 + char *format = NULL;
61 + format = "%Y/%m/%d %H:%M:%S";
64 + format = "%Y-%m-%d %H:%M:%S %z";
67 + if (my_strftime (buf, sizeof (buf), format, <m, 0, 0) == 0)
72 @@ -1388,9 +1398,19 @@
73 static char buf[sizeof ("yyyy-mm-dd HH:MM:SS -HHMM")];
74 /* Convert to a time in the local time zone. */
75 struct tm ltm = *(gmtime (&unixtime));
77 - if (!my_strftime (buf, sizeof (buf), "%Y-%m-%d %H:%M:%S %z", <m, 0, 0))
79 + char *format = NULL;
84 + format = "%Y/%m/%d %H:%M:%S";
87 + format = "%Y-%m-%d %H:%M:%S %z";
90 + if (my_strftime (buf, sizeof (buf), format, <m, 0, 0) == 0)
95 diff -ruN cvs-1.12.13-old/src/parseinfo.c cvs-1.12.13/src/parseinfo.c
96 --- cvs-1.12.13-old/src/parseinfo.c 2005-09-06 12:40:37.000000000 +0800
97 +++ cvs-1.12.13/src/parseinfo.c 2006-02-26 23:03:05.000000000 +0800
99 retval->logHistory = xstrdup (p);
102 + /* grab FreeBSD date format idea */
103 + else if (strcmp (line, "DateFormat") == 0)
105 + if (strcmp (p, "old") == 0)
109 + else if (strcmp (p, "iso8601") == 0)
115 else if (strcmp (line, "RereadLogAfterVerify") == 0)
117 if (!strcasecmp (p, "never"))
118 diff -ruN cvs-1.12.13-old/src/rcs.c cvs-1.12.13/src/rcs.c
119 --- cvs-1.12.13-old/src/rcs.c 2006-02-26 23:03:04.000000000 +0800
120 +++ cvs-1.12.13/src/rcs.c 2006-02-26 23:03:05.000000000 +0800
127 /* The RCS -k options, and a set of enums that must match the array.
128 These come first so that we can use enum kflag in function
130 @@ -3537,8 +3539,8 @@
134 - sprintf (buf, "%04d/%02d/%02d %02d:%02d:%02d", year, mon, mday,
136 + sprintf (buf, "%04d%c%02d%c%02d %02d:%02d:%02d", year, datesep, mon,
137 + datesep, mday, hour, min, sec);
138 return xstrdup (buf);
141 diff -ruN cvs-1.12.13-old/src/rcs.h cvs-1.12.13/src/rcs.h
142 --- cvs-1.12.13-old/src/rcs.h 2005-03-18 06:36:24.000000000 +0800
143 +++ cvs-1.12.13/src/rcs.h 2006-02-26 23:03:05.000000000 +0800
145 void RCS_setlocalid (const char *, unsigned int, void **, const char *arg);
146 char *make_file_label (const char *, const char *, RCSNode *);
149 extern bool preserve_perms;