diff options
| author | christos <christos@NetBSD.org> | 2002-11-28 05:59:06 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2002-11-28 05:59:06 +0000 |
| commit | c4b90ab8cd17e5fa36e911fc21baad1220448599 (patch) | |
| tree | de11885c7d0ebe8040083cd1b666c5bff4885313 /gnu/dist/cvs/src/commit.c | |
| parent | 6040caeaed3550e3f1bbf3b5713b7dcbb854ab4f (diff) | |
resolve conflicts. I have not tested ipv6 or gssapi.
Diffstat (limited to 'gnu/dist/cvs/src/commit.c')
| -rw-r--r-- | gnu/dist/cvs/src/commit.c | 102 |
1 files changed, 43 insertions, 59 deletions
diff --git a/gnu/dist/cvs/src/commit.c b/gnu/dist/cvs/src/commit.c index 7073299e26a..f8475cdb275 100644 --- a/gnu/dist/cvs/src/commit.c +++ b/gnu/dist/cvs/src/commit.c @@ -85,13 +85,13 @@ static time_t last_register_time; static const char *const commit_usage[] = { "Usage: %s %s [-nRlf] [-m msg | -F logfile] [-r rev] files...\n", - "\t-n\tDo not run the module program (if any).\n", - "\t-R\tProcess directories recursively.\n", - "\t-l\tLocal directory only (not recursive).\n", - "\t-f\tForce the file to be committed; disables recursion.\n", - "\t-F file\tRead the log message from file.\n", - "\t-m msg\tLog message.\n", - "\t-r rev\tCommit to this branch or trunk revision.\n", + " -n Do not run the module program (if any).\n", + " -R Process directories recursively.\n", + " -l Local directory only (not recursive).\n", + " -f Force the file to be committed; disables recursion.\n", + " -F logfile Read the log message from file.\n", + " -m msg Log message.\n", + " -r rev Commit to this branch or trunk revision.\n", "(Specify the --help global option for a list of other help options)\n", NULL }; @@ -344,16 +344,17 @@ commit (argc, argv) if (geteuid () == (uid_t) 0 # ifdef CLIENT_SUPPORT /* Who we are on the client side doesn't affect logging. */ - && !client_active + && !current_parsed_root->isremote # endif ) { struct passwd *pw; if ((pw = (struct passwd *) getpwnam (getcaller ())) == NULL) - error (1, 0, "you are unknown to this system"); + error (1, 0, "your apparent username (%s) is unknown to this system", + getcaller ()); if (pw->pw_uid == (uid_t) 0) - error (1, 0, "cannot commit files as 'root'"); + error (1, 0, "'root' is not allowed to commit files"); } #endif /* CVS_BADROOT */ @@ -432,7 +433,7 @@ commit (argc, argv) } #ifdef CLIENT_SUPPORT - if (client_active) + if (current_parsed_root->isremote) { struct find_data find_args; @@ -495,11 +496,6 @@ commit (argc, argv) if (use_editor) do_editor (".", &saved_message, (char *)NULL, find_args.ulist); - /* Run the user-defined script to verify/check information in - *the log message - */ - do_verify (saved_message, (char *)NULL); - /* We always send some sort of message, even if empty. */ /* FIXME: is that true? There seems to be some code in do_editor which can leave the message NULL. */ @@ -591,8 +587,7 @@ commit (argc, argv) char *fname; FILE *fp; - fname = cvs_temp_name (); - fp = CVS_FOPEN (fname, "w+"); + fp = cvs_temp_file (&fname); if (fp == NULL) error (1, 0, "cannot create temporary file %s", fname); if (fwrite (saved_message, 1, strlen (saved_message), fp) @@ -601,6 +596,7 @@ commit (argc, argv) if (fclose (fp) < 0) error (0, errno, "cannot close temporary file %s", fname); error (0, 0, "saving log message in %s", fname); + free (fname); } return err; } @@ -615,7 +611,7 @@ commit (argc, argv) wrap_setup (); - lock_tree_for_write (argc, argv, local, aflag); + lock_tree_for_write (argc, argv, local, W_LOCAL, aflag); /* * Set up the master update list and hard link list @@ -663,11 +659,15 @@ commit (argc, argv) Lock_Cleanup (); dellist (&mulist); +#ifdef SERVER_SUPPORT + if (server_active) + return err; +#endif + /* see if we need to sleep before returning to avoid time-stamp races */ if (last_register_time) { - while (time ((time_t *) NULL) == last_register_time) - sleep (1); + sleep_past (last_register_time); } return (err); @@ -778,7 +778,7 @@ check_fileproc (callerdat, finfo) struct commit_info *ci; struct logfile_info *li; - size_t cvsroot_len = strlen (CVSroot_directory); + size_t cvsroot_len = strlen (current_parsed_root->directory); if (!finfo->repository) { @@ -786,7 +786,7 @@ check_fileproc (callerdat, finfo) return (1); } - if (strncmp (finfo->repository, CVSroot_directory, cvsroot_len) == 0 + if (strncmp (finfo->repository, current_parsed_root->directory, cvsroot_len) == 0 && ISDIRSEP (finfo->repository[cvsroot_len]) && strncmp (finfo->repository + cvsroot_len + 1, CVSROOTADM, @@ -810,9 +810,7 @@ check_fileproc (callerdat, finfo) switch (status) { case T_CHECKOUT: -#ifdef SERVER_SUPPORT case T_PATCH: -#endif case T_NEEDS_MERGE: case T_CONFLICT: case T_REMOVE_ENTRY: @@ -829,7 +827,7 @@ check_fileproc (callerdat, finfo) * Also, * - if status is T_REMOVED, can't have a numeric tag * - if status is T_ADDED, rcs file must not exist unless on - * a branch + * a branch or head is dead * - if status is T_ADDED, can't have a non-trunk numeric rev * - if status is T_MODIFIED and a Conflict marker exists, don't * allow the commit if timestamp is identical or if we find @@ -926,29 +924,17 @@ warning: file `%s' seems to still contain conflict indicators", { if (vers->tag == NULL) { - char *rcs; - - rcs = xmalloc (strlen (finfo->repository) - + strlen (finfo->file) - + sizeof RCSEXT - + 5); - - /* Don't look in the attic; if it exists there we - will move it back out in checkaddfile. */ - sprintf(rcs, "%s/%s%s", finfo->repository, finfo->file, - RCSEXT); - if (isreadable (rcs)) + if (finfo->rcs != NULL && + !RCS_isdead (finfo->rcs, finfo->rcs->head)) { error (0, 0, "cannot add file `%s' when RCS file `%s' already exists", - finfo->fullname, rcs); + finfo->fullname, finfo->rcs->path); freevers_ts (&vers); - free (rcs); return (1); } - free (rcs); } - if (vers->tag && isdigit ((unsigned char) *vers->tag) && + else if (isdigit ((unsigned char) *vers->tag) && numdots (vers->tag) > 1) { error (0, 0, @@ -1242,7 +1228,7 @@ commit_fileproc (callerdat, finfo) if (use_editor) do_editor (finfo->update_dir, &saved_message, finfo->repository, ulist); - do_verify (saved_message, finfo->repository); + do_verify (&saved_message, finfo->repository); } p = findnode (cilist, finfo->file); @@ -1313,6 +1299,12 @@ commit_fileproc (callerdat, finfo) /* find the max major rev number in this directory */ maxrev = 0; (void) walklist (finfo->entries, findmaxrev, NULL); + if (finfo->rcs->head) { + /* resurrecting: include dead revision */ + int thisrev = atoi (finfo->rcs->head); + if (thisrev > maxrev) + maxrev = thisrev; + } if (maxrev == 0) maxrev = 1; xrev = xmalloc (20); @@ -1432,12 +1424,12 @@ commit_filesdoneproc (callerdat, err, repository, update_dir, entries) { char *p; - if (strncmp (CVSroot_directory, repository, - strlen (CVSroot_directory)) != 0) + if (strncmp (current_parsed_root->directory, repository, + strlen (current_parsed_root->directory)) != 0) error (0, 0, "internal error: repository (%s) doesn't begin with root (%s)", - repository, CVSroot_directory); - p = repository + strlen (CVSroot_directory); + repository, current_parsed_root->directory); + p = repository + strlen (current_parsed_root->directory); if (*p == '/') ++p; if (strcmp ("CVSROOT", p) == 0 @@ -1558,7 +1550,7 @@ commit_direntproc (callerdat, dir, repos, update_dir, entries) got_message = 1; if (use_editor) do_editor (update_dir, &saved_message, real_repos, ulist); - do_verify (saved_message, real_repos); + do_verify (&saved_message, real_repos); free (real_repos); return (R_PROCESS); } @@ -1581,7 +1573,7 @@ commit_dirleaveproc (callerdat, dir, err, update_dir, entries) this being a confusing feature! */ if (err == 0 && write_dirtag != NULL) { - char *repos = Name_Repository (dir, update_dir); + char *repos = Name_Repository (NULL, update_dir); WriteTag (NULL, write_dirtag, NULL, write_dirnonbranch, update_dir, repos); free (repos); @@ -1598,19 +1590,13 @@ findmaxrev (p, closure) Node *p; void *closure; { - char *cp; int thisrev; Entnode *entdata; entdata = (Entnode *) p->data; if (entdata->type != ENT_FILE) return (0); - cp = strchr (entdata->version, '.'); - if (cp != NULL) - *cp = '\0'; thisrev = atoi (entdata->version); - if (cp != NULL) - *cp = '.'; if (thisrev > maxrev) maxrev = thisrev; return (0); @@ -1821,7 +1807,7 @@ unlockrcs (rcs) { int retcode; - if ((retcode = RCS_unlock (rcs, NULL, 0)) != 0) + if ((retcode = RCS_unlock (rcs, NULL, 1)) != 0) error (retcode == -1 ? 1 : 0, retcode == -1 ? errno : 0, "could not unlock %s", rcs->path); else @@ -1958,10 +1944,8 @@ checkaddfile (file, repository, tag, options, rcsnode) Attic. */ if (!(rcsfile->flags & INATTIC)) { - error (0, 0, "internal error: confused about attic for %s", + error (0, 0, "warning: expected %s to be in Attic", rcsfile->path); - retval = 1; - goto out; } sprintf (rcs, "%s/%s%s", repository, file, RCSEXT); |
