1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
|
/*
* Copyright (c) 1992, Brian Berliner and Jeff Polk
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
* specified in the README file that comes with the CVS source distribution.
*
* Status Information
*/
#include "cvs.h"
static Dtype status_dirproc PROTO ((void *callerdat, const char *dir,
const char *repos, const char *update_dir,
List *entries));
static int status_fileproc PROTO ((void *callerdat, struct file_info *finfo));
static int tag_list_proc PROTO((Node * p, void *closure));
static int local = 0;
static int long_format = 0;
static RCSNode *xrcsnode;
static const char *const status_usage[] =
{
"Usage: %s %s [-vlR] [files...]\n",
"\t-v\tVerbose format; includes tag information for the file\n",
"\t-l\tProcess this directory only (not recursive).\n",
"\t-R\tProcess directories recursively.\n",
"(Specify the --help global option for a list of other help options)\n",
NULL
};
int
cvsstatus (argc, argv)
int argc;
char **argv;
{
int c;
int err = 0;
if (argc == -1)
usage (status_usage);
optind = 0;
while ((c = getopt (argc, argv, "+vlR")) != -1)
{
switch (c)
{
case 'v':
long_format = 1;
break;
case 'l':
local = 1;
break;
case 'R':
local = 0;
break;
case '?':
default:
usage (status_usage);
break;
}
}
argc -= optind;
argv += optind;
wrap_setup ();
#ifdef CLIENT_SUPPORT
if (current_parsed_root->isremote)
{
start_server ();
ign_setup ();
if (long_format)
send_arg("-v");
if (local)
send_arg("-l");
send_arg ("--");
/* For a while, we tried setting SEND_NO_CONTENTS here so this
could be a fast operation. That prevents the
server from updating our timestamp if the timestamp is
changed but the file is unmodified. Worse, it is user-visible
(shows "locally modified" instead of "up to date" if
timestamp is changed but file is not). And there is no good
workaround (you might not want to run "cvs update"; "cvs -n
update" doesn't update CVS/Entries; "cvs diff --brief" or
something perhaps could be made to work but somehow that
seems nonintuitive to me even if so). Given that timestamps
seem to have the potential to get munged for any number of
reasons, it seems better to not rely too much on them. */
send_files (argc, argv, local, 0, 0);
send_file_names (argc, argv, SEND_EXPAND_WILD);
send_to_server ("status\012", 0);
err = get_responses_and_close ();
return err;
}
#endif
/* start the recursion processor */
err = start_recursion (status_fileproc, (FILESDONEPROC) NULL,
status_dirproc, (DIRLEAVEPROC) NULL, NULL,
argc, argv, local,
W_LOCAL, 0, CVS_LOCK_READ, (char *) NULL, 1,
(char *) NULL);
return (err);
}
/*
* display the status of a file
*/
/* ARGSUSED */
static int
status_fileproc (callerdat, finfo)
void *callerdat;
struct file_info *finfo;
{
Ctype status;
char *sstat;
Vers_TS *vers;
status = Classify_File (finfo, (char *) NULL, (char *) NULL, (char *) NULL,
1, 0, &vers, 0);
sstat = "Classify Error";
switch (status)
{
case T_UNKNOWN:
sstat = "Unknown";
break;
case T_CHECKOUT:
sstat = "Needs Checkout";
break;
case T_PATCH:
sstat = "Needs Patch";
break;
case T_CONFLICT:
/* I _think_ that "unresolved" is correct; that if it has
been resolved then the status will change. But I'm not
sure about that. */
sstat = "Unresolved Conflict";
break;
case T_ADDED:
sstat = "Locally Added";
break;
case T_REMOVED:
sstat = "Locally Removed";
break;
case T_MODIFIED:
if ( vers->ts_conflict
&& ( file_has_conflict ( finfo, vers->ts_conflict )
|| file_has_markers ( finfo ) ) )
sstat = "File had conflicts on merge";
else
/* Note that we do not re Register() the file when we spot
* a resolved conflict like update_fileproc() does on the
* premise that status should not alter the sandbox.
*/
sstat = "Locally Modified";
break;
case T_REMOVE_ENTRY:
sstat = "Entry Invalid";
break;
case T_UPTODATE:
sstat = "Up-to-date";
break;
case T_NEEDS_MERGE:
sstat = "Needs Merge";
break;
case T_TITLE:
/* I don't think this case can occur here. Just print
"Classify Error". */
break;
}
cvs_output ("\
===================================================================\n", 0);
if (vers->ts_user == NULL)
{
cvs_output ("File: no file ", 0);
cvs_output (finfo->file, 0);
cvs_output ("\t\tStatus: ", 0);
cvs_output (sstat, 0);
cvs_output ("\n\n", 0);
}
else
{
char *buf;
buf = xmalloc (strlen (finfo->file) + strlen (sstat) + 80);
sprintf (buf, "File: %-17s\tStatus: %s\n\n", finfo->file, sstat);
cvs_output (buf, 0);
free (buf);
}
if (vers->vn_user == NULL)
{
cvs_output (" Working revision:\tNo entry for ", 0);
cvs_output (finfo->file, 0);
cvs_output ("\n", 0);
}
else if (vers->vn_user[0] == '0' && vers->vn_user[1] == '\0')
cvs_output (" Working revision:\tNew file!\n", 0);
#ifdef SERVER_SUPPORT
else if (server_active)
{
cvs_output (" Working revision:\t", 0);
cvs_output (vers->vn_user, 0);
cvs_output ("\n", 0);
}
#endif
else
{
cvs_output (" Working revision:\t", 0);
cvs_output (vers->vn_user, 0);
cvs_output ("\t", 0);
cvs_output (vers->ts_rcs, 0);
cvs_output ("\n", 0);
}
if (vers->vn_rcs == NULL)
cvs_output (" Repository revision:\tNo revision control file\n", 0);
else
{
cvs_output (" Repository revision:\t", 0);
cvs_output (vers->vn_rcs, 0);
cvs_output ("\t", 0);
cvs_output (vers->srcfile->path, 0);
cvs_output ("\n", 0);
}
if (vers->entdata)
{
Entnode *edata;
edata = vers->entdata;
if (edata->tag)
{
if (vers->vn_rcs == NULL)
{
cvs_output (" Sticky Tag:\t\t", 0);
cvs_output (edata->tag, 0);
cvs_output (" - MISSING from RCS file!\n", 0);
}
else
{
if (isdigit ((unsigned char) edata->tag[0]))
{
cvs_output (" Sticky Tag:\t\t", 0);
cvs_output (edata->tag, 0);
cvs_output ("\n", 0);
}
else
{
char *branch = NULL;
if (RCS_nodeisbranch (finfo->rcs, edata->tag))
branch = RCS_whatbranch(finfo->rcs, edata->tag);
cvs_output (" Sticky Tag:\t\t", 0);
cvs_output (edata->tag, 0);
cvs_output (" (", 0);
cvs_output (branch ? "branch" : "revision", 0);
cvs_output (": ", 0);
cvs_output (branch ? branch : vers->vn_rcs, 0);
cvs_output (")\n", 0);
if (branch)
free (branch);
}
}
}
else if (!really_quiet)
cvs_output (" Sticky Tag:\t\t(none)\n", 0);
if (edata->date)
{
cvs_output (" Sticky Date:\t\t", 0);
cvs_output (edata->date, 0);
cvs_output ("\n", 0);
}
else if (!really_quiet)
cvs_output (" Sticky Date:\t\t(none)\n", 0);
if (edata->options && edata->options[0])
{
cvs_output (" Sticky Options:\t", 0);
cvs_output (edata->options, 0);
cvs_output ("\n", 0);
}
else if (!really_quiet)
cvs_output (" Sticky Options:\t(none)\n", 0);
}
if (long_format && vers->srcfile)
{
List *symbols = RCS_symbols(vers->srcfile);
cvs_output ("\n Existing Tags:\n", 0);
if (symbols)
{
xrcsnode = finfo->rcs;
(void) walklist (symbols, tag_list_proc, NULL);
}
else
cvs_output ("\tNo Tags Exist\n", 0);
}
cvs_output ("\n", 0);
freevers_ts (&vers);
return (0);
}
/*
* Print a warm fuzzy message
*/
/* ARGSUSED */
static Dtype
status_dirproc (callerdat, dir, repos, update_dir, entries)
void *callerdat;
const char *dir;
const char *repos;
const char *update_dir;
List *entries;
{
if (!quiet)
error (0, 0, "Examining %s", update_dir);
return (R_PROCESS);
}
/*
* Print out a tag and its type
*/
static int
tag_list_proc (p, closure)
Node *p;
void *closure;
{
char *branch = NULL;
char *buf;
if (RCS_nodeisbranch (xrcsnode, p->key))
branch = RCS_whatbranch(xrcsnode, p->key) ;
buf = xmalloc (80 + strlen (p->key)
+ (branch ? strlen (branch) : strlen (p->data)));
sprintf (buf, "\t%-25s\t(%s: %s)\n", p->key,
branch ? "branch" : "revision",
branch ? branch : (char *)p->data);
cvs_output (buf, 0);
free (buf);
if (branch)
free (branch);
return (0);
}
|