]>
Commit | Line | Data |
---|---|---|
76652ff6 AM |
1 | --- cvs-1.12.13.orig/debian/patches/67_date_format_option |
2 | +++ cvs-1.12.13/debian/patches/67_date_format_option | |
3 | @@ -0,0 +1,151 @@ | |
4 | +# | |
5 | +# Add an extra option to set the DateFormat used in log output. | |
6 | +# | |
7 | +# Patch by Steve McIntyre <steve@einval.com> | |
8 | +diff -ruN cvs-1.12.13-old/doc/cvs.texinfo cvs-1.12.13/doc/cvs.texinfo | |
9 | +--- cvs-1.12.13-old/doc/cvs.texinfo 2005-09-23 10:02:53.000000000 +0800 | |
10 | ++++ cvs-1.12.13/doc/cvs.texinfo 2006-02-26 23:03:05.000000000 +0800 | |
11 | +@@ -14840,9 +14840,17 @@ | |
12 | + group to using @code{cvs admin} to change the default keyword | |
13 | + substitution mode, lock revisions, unlock revisions, and | |
14 | + replace the log message, use @samp{UserAdminOptions=klum}. | |
15 | +-@end table | |
16 | +- | |
17 | + | |
18 | ++@cindex DateFormat, in CVSROOT/config | |
19 | ++@item DateFormat=@var{value} | |
20 | ++Control the output format of dates from cvs. cvs version 1.12.x | |
21 | ++changed the default format to use ``iso8601'' dates, which are | |
22 | ++better for many reasons. However, old scripts/programs written to | |
23 | ++parse the output of various cvs commands (especially cvs log) may | |
24 | ++not cope with the change in date format (e.g. gcvs). The default | |
25 | ++value of DateFormat will be ``iso8601'', but if you need temporary | |
26 | ++backwards-compatibility set DateFormat=old. | |
27 | ++@end table | |
28 | + | |
29 | + @c --------------------------------------------------------------------- | |
30 | + @node Environment variables | |
31 | +diff -ruN cvs-1.12.13-old/src/log.c cvs-1.12.13/src/log.c | |
32 | +--- cvs-1.12.13-old/src/log.c 2005-03-22 21:19:57.000000000 +0800 | |
33 | ++++ cvs-1.12.13/src/log.c 2006-02-26 23:03:05.000000000 +0800 | |
34 | +@@ -1607,8 +1607,12 @@ | |
35 | + &sec); | |
36 | + if (year < 1900) | |
37 | + year += 1900; | |
38 | +- sprintf (buf, "%04d-%02d-%02d %02d:%02d:%02d +0000", year, mon, mday, | |
39 | +- hour, min, sec); | |
40 | ++ if ('-' == datesep) | |
41 | ++ sprintf (buf, "%04d%c%02d%c%02d %02d:%02d:%02d +0000", year, datesep, | |
42 | ++ mon, datesep, mday, hour, min, sec); | |
43 | ++ else | |
44 | ++ sprintf (buf, "%04d%c%02d%c%02d %02d:%02d:%02d", year, datesep, | |
45 | ++ mon, datesep, mday, hour, min, sec); | |
46 | + cvs_output_tagged ("date", buf); | |
47 | + | |
48 | + cvs_output_tagged ("text", "; author: "); | |
49 | +diff -ruN cvs-1.12.13-old/src/main.c cvs-1.12.13/src/main.c | |
50 | +--- cvs-1.12.13-old/src/main.c 2006-02-26 23:03:04.000000000 +0800 | |
51 | ++++ cvs-1.12.13/src/main.c 2006-02-26 23:10:12.000000000 +0800 | |
52 | +@@ -1371,9 +1371,19 @@ | |
53 | + static char buf[sizeof ("yyyy-mm-dd HH:MM:SS -HHMM")]; | |
54 | + /* Convert to a time in the local time zone. */ | |
55 | + struct tm ltm = *(localtime (&unixtime)); | |
56 | +- | |
57 | +- if (!my_strftime (buf, sizeof (buf), "%Y-%m-%d %H:%M:%S %z", <m, 0, 0)) | |
58 | +- return NULL; | |
59 | ++ char *format = NULL; | |
60 | ++ | |
61 | ++ switch (datesep) | |
62 | ++ { | |
63 | ++ case '/': | |
64 | ++ format = "%Y/%m/%d %H:%M:%S"; | |
65 | ++ break; | |
66 | ++ default: | |
67 | ++ format = "%Y-%m-%d %H:%M:%S %z"; | |
68 | ++ break; | |
69 | ++ } | |
70 | ++ if (my_strftime (buf, sizeof (buf), format, <m, 0, 0) == 0) | |
71 | ++ return NULL; | |
72 | + | |
73 | + return xstrdup (buf); | |
74 | + } | |
75 | +@@ -1388,9 +1398,19 @@ | |
76 | + static char buf[sizeof ("yyyy-mm-dd HH:MM:SS -HHMM")]; | |
77 | + /* Convert to a time in the local time zone. */ | |
78 | + struct tm ltm = *(gmtime (&unixtime)); | |
79 | +- | |
80 | +- if (!my_strftime (buf, sizeof (buf), "%Y-%m-%d %H:%M:%S %z", <m, 0, 0)) | |
81 | +- return NULL; | |
82 | ++ char *format = NULL; | |
83 | ++ | |
84 | ++ switch (datesep) | |
85 | ++ { | |
86 | ++ case '/': | |
87 | ++ format = "%Y/%m/%d %H:%M:%S"; | |
88 | ++ break; | |
89 | ++ default: | |
90 | ++ format = "%Y-%m-%d %H:%M:%S %z"; | |
91 | ++ break; | |
92 | ++ } | |
93 | ++ if (my_strftime (buf, sizeof (buf), format, <m, 0, 0) == 0) | |
94 | ++ return NULL; | |
95 | + | |
96 | + return xstrdup (buf); | |
97 | + } | |
98 | +diff -ruN cvs-1.12.13-old/src/parseinfo.c cvs-1.12.13/src/parseinfo.c | |
99 | +--- cvs-1.12.13-old/src/parseinfo.c 2005-09-06 12:40:37.000000000 +0800 | |
100 | ++++ cvs-1.12.13/src/parseinfo.c 2006-02-26 23:03:05.000000000 +0800 | |
101 | +@@ -626,6 +626,19 @@ | |
102 | + retval->logHistory = xstrdup (p); | |
103 | + } | |
104 | + } | |
105 | ++ /* grab FreeBSD date format idea */ | |
106 | ++ else if (strcmp (line, "DateFormat") == 0) | |
107 | ++ { | |
108 | ++ if (strcmp (p, "old") == 0) | |
109 | ++ { | |
110 | ++ datesep = '/'; | |
111 | ++ } | |
112 | ++ else if (strcmp (p, "iso8601") == 0) | |
113 | ++ { | |
114 | ++ datesep = '-'; | |
115 | ++ } | |
116 | ++ } | |
117 | ++ /* end grabbing */ | |
118 | + else if (strcmp (line, "RereadLogAfterVerify") == 0) | |
119 | + { | |
120 | + if (!strcasecmp (p, "never")) | |
121 | +diff -ruN cvs-1.12.13-old/src/rcs.c cvs-1.12.13/src/rcs.c | |
122 | +--- cvs-1.12.13-old/src/rcs.c 2006-02-26 23:03:04.000000000 +0800 | |
123 | ++++ cvs-1.12.13/src/rcs.c 2006-02-26 23:03:05.000000000 +0800 | |
124 | +@@ -33,6 +33,8 @@ | |
125 | + # endif | |
126 | + #endif | |
127 | + | |
128 | ++int datesep = '-'; | |
129 | ++ | |
130 | + /* The RCS -k options, and a set of enums that must match the array. | |
131 | + These come first so that we can use enum kflag in function | |
132 | + prototypes. */ | |
133 | +@@ -3537,8 +3539,8 @@ | |
134 | + &sec); | |
135 | + if (year < 1900) | |
136 | + year += 1900; | |
137 | +- sprintf (buf, "%04d/%02d/%02d %02d:%02d:%02d", year, mon, mday, | |
138 | +- hour, min, sec); | |
139 | ++ sprintf (buf, "%04d%c%02d%c%02d %02d:%02d:%02d", year, datesep, mon, | |
140 | ++ datesep, mday, hour, min, sec); | |
141 | + return xstrdup (buf); | |
142 | + } | |
143 | + | |
144 | +diff -ruN cvs-1.12.13-old/src/rcs.h cvs-1.12.13/src/rcs.h | |
145 | +--- cvs-1.12.13-old/src/rcs.h 2005-03-18 06:36:24.000000000 +0800 | |
146 | ++++ cvs-1.12.13/src/rcs.h 2006-02-26 23:03:05.000000000 +0800 | |
147 | +@@ -254,6 +254,7 @@ | |
148 | + void RCS_setlocalid (const char *, unsigned int, void **, const char *arg); | |
149 | + char *make_file_label (const char *, const char *, RCSNode *); | |
150 | + | |
151 | ++extern int datesep; | |
152 | + extern bool preserve_perms; | |
153 | + | |
154 | + /* From import.c. */ |