[BACK]Return to commit.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / cvs

Diff for /src/usr.bin/cvs/commit.c between version 1.142 and 1.143

version 1.142, 2008/06/14 04:34:08 version 1.143, 2008/06/15 04:38:52
Line 366 
Line 366 
                         brev = rcs_translate_tag(tag, cf->file_rcs);                          brev = rcs_translate_tag(tag, cf->file_rcs);
   
                         if (brev == NULL) {                          if (brev == NULL) {
                                   if (cf->file_status == FILE_ADDED)
                                           goto next;
                                 fatal("failed to resolve tag: %s",                                  fatal("failed to resolve tag: %s",
                                     cf->file_ent->ce_tag);                                      cf->file_ent->ce_tag);
                         }                          }
Line 432 
Line 434 
 {  {
         char *tag;          char *tag;
         BUF *b, *d;          BUF *b, *d;
         int onbranch, isnew, histtype;          int onbranch, isnew, histtype, branchadded;
         RCSNUM *nrev, *crev, *rrev, *brev;          RCSNUM *nrev, *crev, *rrev, *brev;
         int openflags, rcsflags;          int openflags, rcsflags;
         char rbuf[CVS_REV_BUFSZ], nbuf[CVS_REV_BUFSZ];          char rbuf[CVS_REV_BUFSZ], nbuf[CVS_REV_BUFSZ];
Line 449 
Line 451 
         if (cf->file_type != CVS_FILE)          if (cf->file_type != CVS_FILE)
                 fatal("cvs_commit_local: '%s' is not a file", cf->file_path);                  fatal("cvs_commit_local: '%s' is not a file", cf->file_path);
   
         if (cf->file_status != FILE_MODIFIED &&          tag = cvs_directory_tag;
             cf->file_status != FILE_ADDED &&          if (cf->file_ent != NULL && cf->file_ent->ce_tag != NULL)
             cf->file_status != FILE_REMOVED) {                  tag = cf->file_ent->ce_tag;
   
           branchadded = 0;
           switch (cf->file_status) {
           case FILE_ADDED:
                   if (cf->file_rcs == NULL && tag != NULL) {
                           branchadded = 1;
                           cvs_add_tobranch(cf, tag);
                   }
                   break;
           case FILE_MODIFIED:
           case FILE_REMOVED:
                   if (cf->file_rcs == NULL) {
                           cvs_log(LP_ERR, "RCS file for %s got lost",
                               cf->file_path);
                           return;
                   }
                   break;
           default:
                 cvs_log(LP_ERR, "skipping bogus file `%s'", cf->file_path);                  cvs_log(LP_ERR, "skipping bogus file `%s'", cf->file_path);
                 return;                  return;
         }          }
Line 466 
Line 486 
                 cf->file_rcs->rf_branch = NULL;                  cf->file_rcs->rf_branch = NULL;
         }          }
   
         if (cf->file_status == FILE_MODIFIED ||          if (cf->file_rcs != NULL) {
             cf->file_status == FILE_REMOVED || (cf->file_status == FILE_ADDED  
             && cf->file_rcs != NULL && cf->file_rcs->rf_dead == 1)) {  
                 rrev = rcs_head_get(cf->file_rcs);                  rrev = rcs_head_get(cf->file_rcs);
                 crev = rcs_head_get(cf->file_rcs);                  crev = rcs_head_get(cf->file_rcs);
                 if (crev == NULL || rrev == NULL)                  if (crev == NULL || rrev == NULL)
                         fatal("no head revision in RCS file for %s",                          fatal("no head revision in RCS file for %s",
                             cf->file_path);                              cf->file_path);
   
                 tag = cvs_directory_tag;  
                 if (cf->file_ent != NULL && cf->file_ent->ce_tag != NULL)  
                         tag = cf->file_ent->ce_tag;  
   
                 if (tag != NULL) {                  if (tag != NULL) {
                         rcsnum_free(crev);                          rcsnum_free(crev);
                         rcsnum_free(rrev);                          rcsnum_free(rrev);
Line 524 
Line 538 
         if (cf->file_status == FILE_ADDED) {          if (cf->file_status == FILE_ADDED) {
                 isnew = 1;                  isnew = 1;
                 rcsflags = RCS_CREATE;                  rcsflags = RCS_CREATE;
                 openflags = O_CREAT | O_TRUNC | O_WRONLY;                  openflags = O_CREAT | O_RDONLY;
                 if (cf->file_rcs != NULL) {                  if (cf->file_rcs != NULL) {
                         if (cf->in_attic == 0)                          if (!onbranch) {
                                 cvs_log(LP_ERR, "warning: expected %s "                                  if (cf->in_attic == 0)
                                     "to be in the Attic", cf->file_path);                                          cvs_log(LP_ERR, "warning: expected %s "
                                               "to be in the Attic",
                                               cf->file_path);
   
                         if (cf->file_rcs->rf_dead == 0)                                  if (cf->file_rcs->rf_dead == 0)
                                 cvs_log(LP_ERR, "warning: expected %s "                                          cvs_log(LP_ERR, "warning: expected %s "
                                     "to be dead", cf->file_path);                                              "to be dead", cf->file_path);
   
                         cvs_get_repository_path(cf->file_wd, repo, MAXPATHLEN);                                  cvs_get_repository_path(cf->file_wd, repo,
                         (void)xsnprintf(rcsfile, MAXPATHLEN, "%s/%s%s",                                      MAXPATHLEN);
                             repo, cf->file_name, RCS_FILE_EXT);                                  (void)xsnprintf(rcsfile, MAXPATHLEN, "%s/%s%s",
                                       repo, cf->file_name, RCS_FILE_EXT);
   
                         if (rename(cf->file_rpath, rcsfile) == -1)                                  if (rename(cf->file_rpath, rcsfile) == -1)
                                 fatal("cvs_commit_local: failed to move %s "                                          fatal("cvs_commit_local: failed to "
                                     "outside the Attic: %s", cf->file_path,                                              "move %s outside the Attic: %s",
                                     strerror(errno));                                              cf->file_path, strerror(errno));
   
                         xfree(cf->file_rpath);                                  xfree(cf->file_rpath);
                         cf->file_rpath = xstrdup(rcsfile);                                  cf->file_rpath = xstrdup(rcsfile);
                                   isnew = 0;
                           }
   
                         rcsflags = RCS_READ | RCS_PARSE_FULLY;                          rcsflags = RCS_READ | RCS_PARSE_FULLY;
                         openflags = O_RDONLY;                          openflags = O_RDONLY;
                         rcs_close(cf->file_rcs);                          rcs_close(cf->file_rcs);
                         isnew = 0;  
                 }                  }
   
                 cf->repo_fd = open(cf->file_rpath, openflags);                  cf->repo_fd = open(cf->file_rpath, openflags);
Line 563 
Line 581 
                             "for %s", cf->file_path);                              "for %s", cf->file_path);
   
                 commit_desc_set(cf);                  commit_desc_set(cf);
   
                   if (branchadded)
                           strlcpy(rbuf, "Non-existent", sizeof(rbuf));
         }          }
   
         if (verbosity > 1) {          if (verbosity > 1) {

Legend:
Removed from v.1.142  
changed lines
  Added in v.1.143