]> git.pld-linux.org Git - packages/cvs.git/blame - cvs-debian-date-format.patch
rel 20; rediff patches
[packages/cvs.git] / cvs-debian-date-format.patch
CommitLineData
3a862a5e
AM
1#
2# Add an extra option to set the DateFormat used in log output.
3#
4# Patch by Steve McIntyre <steve@einval.com>
5diff -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}.
12-@end table
13-
14
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.
24+@end table
25
26 @c ---------------------------------------------------------------------
27 @node Environment variables
28diff -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 @@
32 &sec);
33 if (year < 1900)
34 year += 1900;
35- sprintf (buf, "%04d-%02d-%02d %02d:%02d:%02d +0000", year, mon, mday,
36- hour, min, sec);
37+ if ('-' == datesep)
38+ sprintf (buf, "%04d%c%02d%c%02d %02d:%02d:%02d +0000", year, datesep,
39+ mon, datesep, mday, hour, min, sec);
40+ else
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);
44
45 cvs_output_tagged ("text", "; author: ");
46diff -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));
53-
54- if (!my_strftime (buf, sizeof (buf), "%Y-%m-%d %H:%M:%S %z", &ltm, 0, 0))
55- return NULL;
56+ char *format = NULL;
57+
58+ switch (datesep)
59+ {
60+ case '/':
61+ format = "%Y/%m/%d %H:%M:%S";
62+ break;
63+ default:
64+ format = "%Y-%m-%d %H:%M:%S %z";
65+ break;
66+ }
67+ if (my_strftime (buf, sizeof (buf), format, &ltm, 0, 0) == 0)
68+ return NULL;
69
70 return xstrdup (buf);
71 }
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));
76-
77- if (!my_strftime (buf, sizeof (buf), "%Y-%m-%d %H:%M:%S %z", &ltm, 0, 0))
78- return NULL;
79+ char *format = NULL;
80+
81+ switch (datesep)
82+ {
83+ case '/':
84+ format = "%Y/%m/%d %H:%M:%S";
85+ break;
86+ default:
87+ format = "%Y-%m-%d %H:%M:%S %z";
88+ break;
89+ }
90+ if (my_strftime (buf, sizeof (buf), format, &ltm, 0, 0) == 0)
91+ return NULL;
92
93 return xstrdup (buf);
94 }
95diff -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
98@@ -626,6 +626,19 @@
99 retval->logHistory = xstrdup (p);
100 }
101 }
102+ /* grab FreeBSD date format idea */
103+ else if (strcmp (line, "DateFormat") == 0)
104+ {
105+ if (strcmp (p, "old") == 0)
106+ {
107+ datesep = '/';
108+ }
109+ else if (strcmp (p, "iso8601") == 0)
110+ {
111+ datesep = '-';
112+ }
113+ }
114+ /* end grabbing */
115 else if (strcmp (line, "RereadLogAfterVerify") == 0)
116 {
117 if (!strcasecmp (p, "never"))
118diff -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
121@@ -33,6 +33,8 @@
122 # endif
123 #endif
124
125+int datesep = '-';
126+
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
129 prototypes. */
130@@ -3537,8 +3539,8 @@
131 &sec);
132 if (year < 1900)
133 year += 1900;
134- sprintf (buf, "%04d/%02d/%02d %02d:%02d:%02d", year, mon, mday,
135- hour, min, sec);
136+ sprintf (buf, "%04d%c%02d%c%02d %02d:%02d:%02d", year, datesep, mon,
137+ datesep, mday, hour, min, sec);
138 return xstrdup (buf);
139 }
140
141diff -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
144@@ -254,6 +254,7 @@
145 void RCS_setlocalid (const char *, unsigned int, void **, const char *arg);
146 char *make_file_label (const char *, const char *, RCSNode *);
147
148+extern int datesep;
149 extern bool preserve_perms;
150
151 /* From import.c. */
This page took 0.12017 seconds and 4 git commands to generate.