summaryrefslogtreecommitdiffstats
path: root/contrib/cvs/src/history.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/cvs/src/history.c')
-rw-r--r--contrib/cvs/src/history.c61
1 files changed, 39 insertions, 22 deletions
diff --git a/contrib/cvs/src/history.c b/contrib/cvs/src/history.c
index 076a9b1..8e8d607 100644
--- a/contrib/cvs/src/history.c
+++ b/contrib/cvs/src/history.c
@@ -21,6 +21,7 @@
* F "Release" cmd.
* W "Update" cmd - No User file, Remove from Entries file.
* U "Update" cmd - File was checked out over User file.
+ * P "Update" cmd - User file was patched.
* G "Update" cmd - File was merged successfully.
* C "Update" cmd - File was merged and shows overlaps.
* M "Commit" cmd - "Modified" file.
@@ -34,9 +35,9 @@
*
* CurDir The directory where the action occurred. This should be the
* absolute path of the directory which is at the same level as
- * the "Repository" field (for W,U,G,C & M,A,R).
+ * the "Repository" field (for W,U,P,G,C & M,A,R).
*
- * Repository For record types [W,U,G,C,M,A,R] this field holds the
+ * Repository For record types [W,U,P,G,C,M,A,R] this field holds the
* repository read from the administrative data where the
* command was typed.
* T "A" --> New Tag, "D" --> Delete Tag
@@ -48,11 +49,11 @@
* O,E The Tag or Date, if specified, else "" (null field).
* F "" (null field)
* W The Tag or Date, if specified, else "" (null field).
- * U The Revision checked out over the User file.
+ * U,P The Revision checked out over the User file.
* G,C The Revision(s) involved in merge.
* M,A,R RCS Revision affected.
*
- * argument The module (for [TOEUF]) or file (for [WUGCMAR]) affected.
+ * argument The module (for [TOEF]) or file (for [WUPGCMAR]) affected.
*
*
*** Report categories: "User" and "Since" modifiers apply to all reports.
@@ -60,7 +61,7 @@
*
* Extract list of record types
*
- * -e, -x [TOEFWUGCMAR]
+ * -e, -x [TOEFWUPGCMAR]
*
* Extracted records are simply printed, No analysis is performed.
* All "field" modifiers apply. -e chooses all types.
@@ -93,7 +94,7 @@
* modules are remembered. Only records matching exactly those
* files and repositories are shown. Sorting by "module", then
* filename, is implied. If -l ("last modified") is specified,
- * then "update" records (types WUCG), tag and release records
+ * then "update" records (types WUPCG), tag and release records
* are ignored and the last (by date) "modified" record.
*
* TAG history
@@ -170,7 +171,7 @@
* cvs hi -e -u user
*
*** Dump (eXtract) specified record types
- * cvs hi -x [TOFWUGCMAR]
+ * cvs hi -x [TOEFWUPGCMAR]
*
*
* FUTURE: J[Join], I[Import] (Not currently implemented.)
@@ -178,6 +179,7 @@
*/
#include "cvs.h"
+#include "history.h"
#include "savecwd.h"
static struct hrec
@@ -208,7 +210,6 @@ static void save_file PROTO((char *dir, char *name, char *module));
static void save_module PROTO((char *module));
static void save_user PROTO((char *name));
-#define ALL_REC_TYPES "TOEFWUCGMAR"
#define USER_INCREMENT 2
#define FILE_INCREMENT 128
#define MODULE_INCREMENT 5
@@ -217,6 +218,7 @@ static void save_user PROTO((char *name));
static short report_count;
static short extract;
+static short extract_all;
static short v_checkout;
static short modified;
static short tag_report;
@@ -234,7 +236,7 @@ static short tz_local;
static time_t tz_seconds_east_of_GMT;
static char *tz_name = "+0000";
-char *logHistory = ALL_REC_TYPES;
+char *logHistory = ALL_HISTORY_REC_TYPES;
/* -r, -t, or -b options, malloc'd. These are "" if the option in
question is not specified or is overridden by another option. The
@@ -290,7 +292,7 @@ static const char *const history_usg[] =
" -c Committed (Modified) files\n",
" -o Checked out modules\n",
" -m <module> Look for specified module (repeatable)\n",
- " -x [TOEFWUCGMAR] Extract by record type\n",
+ " -x [" ALL_HISTORY_REC_TYPES "] Extract by record type\n",
" -e Everything (same as -x, but all record types)\n",
" Flags:\n",
" -a All users (Default is self)\n",
@@ -399,9 +401,9 @@ history (argc, argv)
break;
case 'e':
report_count++;
- extract++;
+ extract_all++;
free (rec_types);
- rec_types = xstrdup (ALL_REC_TYPES);
+ rec_types = xstrdup (ALL_HISTORY_REC_TYPES);
break;
case 'l': /* Find Last file record */
last_entry = 1;
@@ -482,7 +484,7 @@ history (argc, argv)
char *cp;
for (cp = optarg; *cp; cp++)
- if (!strchr (ALL_REC_TYPES, *cp))
+ if (!strchr (ALL_HISTORY_REC_TYPES, *cp))
error (1, 0, "%c is not a valid report type", *cp);
}
free (rec_types);
@@ -584,6 +586,8 @@ history (argc, argv)
option_with_arg ("-t", since_tag);
for (mod = user_list; mod < &user_list[user_count]; ++mod)
option_with_arg ("-u", *mod);
+ if (extract_all)
+ send_arg("-e");
if (extract)
option_with_arg ("-x", rec_types);
option_with_arg ("-z", tz_name);
@@ -607,7 +611,7 @@ history (argc, argv)
(void) strcat (rec_types, "T");
}
}
- else if (extract)
+ else if (extract || extract_all)
{
if (user_list)
user_sort++;
@@ -636,7 +640,7 @@ history (argc, argv)
else if (module_report)
{
free (rec_types);
- rec_types = xstrdup (last_entry ? "OMAR" : ALL_REC_TYPES);
+ rec_types = xstrdup (last_entry ? "OMAR" : ALL_HISTORY_REC_TYPES);
module_sort++;
repos_sort++;
file_sort++;
@@ -697,22 +701,25 @@ history (argc, argv)
void
history_write (type, update_dir, revs, name, repository)
int type;
- char *update_dir;
- char *revs;
- char *name;
- char *repository;
+ const char *update_dir;
+ const char *revs;
+ const char *name;
+ const char *repository;
{
char *fname;
char *workdir;
char *username = getcaller ();
int fd;
char *line;
- char *slash = "", *cp, *cp2, *repos;
+ char *slash = "", *cp;
+ const char *cp2, *repos;
int i;
static char *tilde = "";
static char *PrCurDir = NULL;
- if (logoff) /* History is turned off by cmd line switch */
+ if (logoff) /* History is turned off by noexec or
+ * readonlyfs.
+ */
return;
if ( strchr(logHistory, type) == NULL )
return;
@@ -722,6 +729,15 @@ history_write (type, update_dir, revs, name, repository)
CVSROOTADM, CVSROOTADM_HISTORY);
/* turn off history logging if the history file does not exist */
+ /* FIXME: This should check for write permissions instead. This way,
+ * O_CREATE could be added back into the call to open() below and
+ * there would be no race condition involved in log rotation.
+ *
+ * Note that the new method of turning off logging would be either via
+ * the CVSROOT/config file (probably the quicker method, but would need
+ * to be added, or at least checked for, too) or by creating a dummy
+ * history file with 0444 permissions.
+ */
if (!isfile (fname))
{
logoff = 1;
@@ -733,7 +749,7 @@ history_write (type, update_dir, revs, name, repository)
CLIENT_SERVER_STR, fname);
if (noexec)
goto out;
- fd = CVS_OPEN (fname, O_WRONLY | O_APPEND | O_CREAT | OPEN_BINARY, 0666);
+ fd = CVS_OPEN (fname, O_WRONLY | O_APPEND | OPEN_BINARY, 0666);
if (fd < 0)
{
if (! really_quiet)
@@ -1524,6 +1540,7 @@ report_hrecs ()
break;
case 'W':
case 'U':
+ case 'P':
case 'C':
case 'G':
case 'M':
OpenPOWER on IntegriCloud