[At the protocol level this would be a good application of tagged text. That way the server wouldn't need so many special cases, and the -b or -bb options could be implemented in the client. Of course there is still the issue of whether CVS needs Yet Another Option (particularly in the context of interactive use; in the context of scripting there are various choices for how to design the interface). Test case and documentation, of course (but those are details if there is still no clarity on the design of the feature in the first place). I have unpacked the patch from the original gzipped version, but otherwise have not modified it. -kingdon] Date: Tue, 25 Aug 1998 21:43:56 -0500 From: "Eric M. Hopper" To: bug-cvs@gnu.org Subject: Patch to cvs stat command This patch allows the '-b', or '-bb' option to the stat command. Using one '-b', stat prints out the filename followed by a :, it's status, and a possible '', nothing more. Using two '-b', stat does everything it does with one -b, and also omits files who's status is 'Up-to-date'. I'm submitting this patch at the urging of my co-workers at Global Maintech. They have found it enormously useful when attempting to figure out what they've changed in the course of a bugfix in order to better plan their checkins. It's also useful to assess the impact of an update before doing one. Since it's output is easily parsed by a shell tool, it adds a lot of flexibility. It's terser output is also more readable than status' normal output. Have fun (if at all possible), -- Its name is Public Opinion. It is held in reverence. It settles everything. Some think it is the voice of God. Loyalty to petrified opinion never yet broke a chain or freed a human soul. ---Mark Twain --Eric Hopper (hopper@omnifarious.mn.org - http://www.wavefront.com/~hopper)-- Index: gnu/cvs/src/ChangeLog-96 diff -c gnu/cvs/src/ChangeLog-96:1.1.1.1 gnu/cvs/src/ChangeLog-96:1.2 *** gnu/cvs/src/ChangeLog-96:1.1.1.1 Thu Jun 26 10:28:23 1997 --- gnu/cvs/src/ChangeLog-96 Thu Jun 26 10:57:18 1997 *************** *** 356,361 **** --- 356,365 ---- * main.c (main): If HAVE_TZSET is #defined, call tzset. This is harmless on all systems I know of, and required on some. + Sat Oct 26 06:20:04 1996 Eric M. Hopper + + * status.c: Added 'brief' format to status command. + Fri Oct 25 13:20:44 1996 Ian Lance Taylor * diff.c (diff_file_nodiff): When setting use_rev1, only return Index: gnu/cvs/src/status.c diff -c gnu/cvs/src/status.c:1.1.1.7 gnu/cvs/src/status.c:1.4 *** gnu/cvs/src/status.c:1.1.1.7 Tue Aug 25 20:55:27 1998 --- gnu/cvs/src/status.c Tue Aug 25 21:18:56 1998 *************** *** 18,29 **** 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", --- 18,31 ---- static int local = 0; static int long_format = 0; + static int brief_format = 0; static RCSNode *xrcsnode; static const char *const status_usage[] = { ! "Usage: %s %s [-vblR] [files...]\n", "\t-v\tVerbose format; includes tag information for the file\n", + "\t-b\tBrief format; only name & status. Two b's skips 'Up-to-date' files\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", *************** *** 42,53 **** usage (status_usage); optind = 0; ! while ((c = getopt (argc, argv, "+vlR")) != -1) { switch (c) { case 'v': long_format = 1; break; case 'l': local = 1; --- 44,60 ---- usage (status_usage); optind = 0; ! while ((c = getopt (argc, argv, "+vblR")) != -1) { switch (c) { case 'v': long_format = 1; + brief_format = 0; + break; + case 'b': + brief_format++; + long_format = 0; break; case 'l': local = 1; *************** *** 73,79 **** ign_setup (); if (long_format) ! send_arg("-v"); if (local) send_arg("-l"); --- 80,95 ---- ign_setup (); if (long_format) ! send_arg("-v"); ! else if (brief_format) ! { ! int i; ! ! for (i = 0; i < brief_format; i++) ! { ! send_arg("-b"); ! } ! } if (local) send_arg("-l"); *************** *** 162,167 **** --- 178,188 ---- break; case T_UPTODATE: sstat = "Up-to-date"; + if (brief_format > 1) + { + freevers_ts (&vers); + return(0); + } break; case T_NEEDS_MERGE: sstat = "Needs Merge"; *************** *** 172,195 **** 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) { --- 193,241 ---- break; } ! if (!brief_format) ! { ! cvs_output ("\ ===================================================================\n", 0); + } if (vers->ts_user == NULL) { ! if (brief_format) ! { ! cvs_output(finfo->fullname, 0); ! cvs_output("\t\t\t: ", 0); ! cvs_output(sstat, 0); ! cvs_output(" \n", 0); ! } ! if (!brief_format) ! { ! 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); ! if (brief_format) ! { ! sprintf (buf, "%-31s\t: %s\n", finfo->fullname, sstat); ! } ! else ! { ! sprintf (buf, "File: %-17s\tStatus: %s\n\n", finfo->file, sstat); ! } cvs_output (buf, 0); free (buf); } + if (brief_format) + { + freevers_ts (&vers); + return(0); + } if (vers->vn_user == NULL) { *************** *** 353,355 **** --- 399,402 ---- return (0); } +