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

Diff for /src/usr.bin/rcs/ci.c between version 1.125 and 1.126

version 1.125, 2006/03/24 05:14:48 version 1.126, 2006/03/26 12:56:31
Line 463 
Line 463 
          */           */
         pb->frev = pb->file->rf_head;          pb->frev = pb->file->rf_head;
   
           /* Load file contents */
           if ((bp = cvs_buf_load(pb->filename, BUF_AUTOEXT)) == NULL) {
                   rcs_close(pb->file);
                   return (-1);
           }
   
           cvs_buf_putc(bp, '\0');
           filec = (char *)cvs_buf_release(bp);
   
         /* If this is a zero-ending RCSNUM eg 4.0, increment it (eg to 4.1) */          /* If this is a zero-ending RCSNUM eg 4.0, increment it (eg to 4.1) */
         if ((pb->newrev != NULL) && (RCSNUM_ZERO_ENDING(pb->newrev)))          if ((pb->newrev != NULL) && (RCSNUM_ZERO_ENDING(pb->newrev)))
                 pb->newrev = rcsnum_inc(pb->newrev);                  pb->newrev = rcsnum_inc(pb->newrev);
   
         if (checkin_checklock(pb) < 0)          if (checkin_checklock(pb) < 0)
                 return (-1);                  goto fail;
   
         /* If revision passed on command line is less than HEAD, bail.          /* If revision passed on command line is less than HEAD, bail.
          * XXX only applies to ci -r1.2 foo for example if HEAD is > 1.2 and           * XXX only applies to ci -r1.2 foo for example if HEAD is > 1.2 and
Line 481 
Line 490 
                     pb->file->rf_path,                      pb->file->rf_path,
                     rcsnum_tostr(pb->newrev, numb1, sizeof(numb1)),                      rcsnum_tostr(pb->newrev, numb1, sizeof(numb1)),
                     rcsnum_tostr(pb->frev, numb2, sizeof(numb2)));                      rcsnum_tostr(pb->frev, numb2, sizeof(numb2)));
                 rcs_close(pb->file);                  goto fail;
                 return (-1);  
         }          }
   
         /*          /*
Line 491 
Line 499 
          */           */
         if (pb->date == DATE_MTIME          if (pb->date == DATE_MTIME
             && (checkin_mtimedate(pb) < 0))              && (checkin_mtimedate(pb) < 0))
                 return (-1);                  goto fail;
   
         /* Date from argv/mtime must be more recent than HEAD */          /* Date from argv/mtime must be more recent than HEAD */
         if (pb->date != DATE_NOW) {          if (pb->date != DATE_NOW) {
Line 513 
Line 521 
                 }                  }
         }          }
   
         /* Load file contents */  
         if ((bp = cvs_buf_load(pb->filename, BUF_AUTOEXT)) == NULL) {  
                 rcs_close(pb->file);  
                 return (-1);  
         }  
   
         cvs_buf_putc(bp, '\0');  
         filec = (char *)cvs_buf_release(bp);  
   
         /* Get RCS patch */          /* Get RCS patch */
         if ((pb->deltatext = checkin_diff_file(pb)) == NULL) {          if ((pb->deltatext = checkin_diff_file(pb)) == NULL) {
                 cvs_log(LP_ERR, "failed to get diff");                  cvs_log(LP_ERR, "failed to get diff");
                 rcs_close(pb->file);                  goto fail;
                 return (-1);  
         }          }
   
         /*          /*
Line 535 
Line 533 
          */           */
         if (!(pb->flags & FORCE) && (strlen(pb->deltatext) < 1)) {          if (!(pb->flags & FORCE) && (strlen(pb->deltatext) < 1)) {
                 checkin_revert(pb);                  checkin_revert(pb);
                 return (0);                  goto fail;
         }          }
   
         /* If no log message specified, get it interactively. */          /* If no log message specified, get it interactively. */
Line 559 
Line 557 
             (pb->newrev == NULL ? RCS_HEAD_REV : pb->newrev),              (pb->newrev == NULL ? RCS_HEAD_REV : pb->newrev),
             pb->rcs_msg, pb->date, pb->author) != 0) {              pb->rcs_msg, pb->date, pb->author) != 0) {
                 cvs_log(LP_ERR, "failed to add new revision");                  cvs_log(LP_ERR, "failed to add new revision");
                 rcs_close(pb->file);                  goto fail;
                 return (-1);  
         }          }
   
         /*          /*
Line 579 
Line 576 
         /* Attach a symbolic name to this revision if specified. */          /* Attach a symbolic name to this revision if specified. */
         if (pb->symbol != NULL          if (pb->symbol != NULL
             && (checkin_attach_symbol(pb) < 0))              && (checkin_attach_symbol(pb) < 0))
                 return (-1);                  goto fail;
   
         /* Set the state of this revision if specified. */          /* Set the state of this revision if specified. */
         if (pb->state != NULL)          if (pb->state != NULL)
Line 603 
Line 600 
                 pb->rcs_msg = NULL;                  pb->rcs_msg = NULL;
         }          }
         return (0);          return (0);
   
   fail:
           xfree(filec);
           rcs_close(pb->file);
           return (-1);
 }  }
   
 /*  /*
Line 654 
Line 656 
                                 cvs_log(LP_ERR,                                  cvs_log(LP_ERR,
                                     "failed to load description file '%s'",                                      "failed to load description file '%s'",
                                     pb->description);                                      pb->description);
                                 xfree(filec);                                  goto fail;
                                 rcs_close(pb->file);  
                                 return (-1);  
                         }                          }
                         cvs_buf_putc(dp, '\0');                          cvs_buf_putc(dp, '\0');
                         rcs_desc = (const char *)cvs_buf_release(dp);                          rcs_desc = (const char *)cvs_buf_release(dp);
Line 678 
Line 678 
          */           */
         if (pb->date == DATE_MTIME          if (pb->date == DATE_MTIME
             && (checkin_mtimedate(pb) < 0))              && (checkin_mtimedate(pb) < 0))
                 return (-1);                  goto fail;
   
         /* Now add our new revision */          /* Now add our new revision */
         if (rcs_rev_add(pb->file,          if (rcs_rev_add(pb->file,
Line 686 
Line 686 
             (pb->rcs_msg == NULL ? "Initial revision" : pb->rcs_msg),              (pb->rcs_msg == NULL ? "Initial revision" : pb->rcs_msg),
             pb->date, pb->author) != 0) {              pb->date, pb->author) != 0) {
                 cvs_log(LP_ERR, "failed to add new revision");                  cvs_log(LP_ERR, "failed to add new revision");
                 rcs_close(pb->file);                  goto fail;
                 return (-1);  
         }          }
         /*          /*
          * If we are checking in to a non-default (ie user-specified)           * If we are checking in to a non-default (ie user-specified)
Line 701 
Line 700 
         /* New head revision has to contain entire file; */          /* New head revision has to contain entire file; */
         if (rcs_deltatext_set(pb->file, pb->file->rf_head, filec) == -1) {          if (rcs_deltatext_set(pb->file, pb->file->rf_head, filec) == -1) {
                 cvs_log(LP_ERR, "failed to set new head revision");                  cvs_log(LP_ERR, "failed to set new head revision");
                 rcs_close(pb->file);                  goto fail;
                 return (-1);  
         }          }
         /* Attach a symbolic name to this revision if specified. */          /* Attach a symbolic name to this revision if specified. */
         if (pb->symbol != NULL          if (pb->symbol != NULL
             && (checkin_attach_symbol(pb) < 0))              && (checkin_attach_symbol(pb) < 0))
                 return (-1);                  goto fail;
   
         /* Set the state of this revision if specified. */          /* Set the state of this revision if specified. */
         if (pb->state != NULL)          if (pb->state != NULL)
Line 731 
Line 729 
         rcs_close(pb->file);          rcs_close(pb->file);
   
         return (0);          return (0);
   fail:
           xfree(filec);
           rcs_close(pb->file);
           return (-1);
 }  }
   
 /*  /*
Line 755 
Line 757 
                 cvs_log(LP_ERR,                  cvs_log(LP_ERR,
                     "symbolic name %s already bound to %s",                      "symbolic name %s already bound to %s",
                     pb->symbol, rbuf);                      pb->symbol, rbuf);
                 rcs_close(pb->file);  
                 return (-1);                  return (-1);
         } else if (ret == -1) {          } else if (ret == -1) {
                 cvs_log(LP_ERR, "problem adding symbol: %s",                  cvs_log(LP_ERR, "problem adding symbol: %s",
                     pb->symbol);                      pb->symbol);
                 rcs_close(pb->file);  
                 return (-1);                  return (-1);
         }          }
         return (0);          return (0);
Line 788 
Line 788 
                 checkout_rev(pb->file, pb->frev, pb->filename,                  checkout_rev(pb->file, pb->frev, pb->filename,
                     pb->flags, pb->username, pb->author, NULL, NULL);                      pb->flags, pb->username, pb->author, NULL, NULL);
         rcs_lock_remove(pb->file, pb->username, pb->frev);          rcs_lock_remove(pb->file, pb->username, pb->frev);
         rcs_close(pb->file);  
 }  }
   
 /*  /*
Line 810 
Line 809 
   
         cvs_log(LP_ERR,          cvs_log(LP_ERR,
             "%s: no lock set by %s", pb->file->rf_path, pb->username);              "%s: no lock set by %s", pb->file->rf_path, pb->username);
         rcs_close(pb->file);  
         return (-1);          return (-1);
 }  }
   
Line 828 
Line 826 
         struct stat sb;          struct stat sb;
         if (stat(pb->filename, &sb) != 0) {          if (stat(pb->filename, &sb) != 0) {
                 cvs_log(LP_ERRNO, "failed to stat `%s'", pb->filename);                  cvs_log(LP_ERRNO, "failed to stat `%s'", pb->filename);
                 rcs_close(pb->file);  
                 return (-1);                  return (-1);
         }          }
         pb->date = (time_t)sb.st_mtimespec.tv_sec;          pb->date = (time_t)sb.st_mtimespec.tv_sec;

Legend:
Removed from v.1.125  
changed lines
  Added in v.1.126