[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.199 and 1.200

version 1.199, 2007/06/12 06:09:38 version 1.200, 2007/06/26 02:21:02
Line 92 
Line 92 
 static void      checkin_parsekeyword(char *, RCSNUM **, time_t *, char **,  static void      checkin_parsekeyword(char *, RCSNUM **, time_t *, char **,
     char **);      char **);
 static int       checkin_update(struct checkin_params *);  static int       checkin_update(struct checkin_params *);
 static void      checkin_revert(struct checkin_params *);  static int       checkin_revert(struct checkin_params *);
   
 void  void
 checkin_usage(void)  checkin_usage(void)
Line 452 
Line 452 
   
         /* Load file contents */          /* Load file contents */
         if ((bp = rcs_buf_load(pb->filename, BUF_AUTOEXT)) == NULL)          if ((bp = rcs_buf_load(pb->filename, BUF_AUTOEXT)) == NULL)
                 goto fail;                  return (-1);
   
         /* 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)
                 goto fail;                  return (-1);
   
         /* 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 471 
Line 471 
                     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)));
                 goto fail;                  return (-1);
         }          }
   
         /*          /*
Line 504 
Line 504 
         /* Get RCS patch */          /* Get RCS patch */
         if ((pb->deltatext = checkin_diff_file(pb)) == NULL) {          if ((pb->deltatext = checkin_diff_file(pb)) == NULL) {
                 warnx("failed to get diff");                  warnx("failed to get diff");
                 goto fail;                  return (-1);
         }          }
   
         /*          /*
Line 512 
Line 512 
          * the user and revert to latest version.           * the user and revert to latest version.
          */           */
         if (!(pb->flags & FORCE) && (rcs_buf_len(pb->deltatext) < 1)) {          if (!(pb->flags & FORCE) && (rcs_buf_len(pb->deltatext) < 1)) {
                 checkin_revert(pb);                  if (checkin_revert(pb) == -1)
                 goto out;                          return (-1);
                   else
                           return (0);
         }          }
   
         /* If no log message specified, get it interactively. */          /* If no log message specified, get it interactively. */
Line 549 
Line 551 
             (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) {
                 warnx("failed to add new revision");                  warnx("failed to add new revision");
                 goto fail;                  return (-1);
         }          }
   
         /*          /*
Line 569 
Line 571 
         /* 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))
                 goto fail;                  return (-1);
   
         /* 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 598 
Line 600 
                 xfree(pb->rcs_msg);     /* free empty log message */                  xfree(pb->rcs_msg);     /* free empty log message */
                 pb->rcs_msg = NULL;                  pb->rcs_msg = NULL;
         }          }
 out:  
         return (0);  
   
 fail:          return (0);
         return (-1);  
 }  }
   
 /*  /*
Line 629 
Line 628 
   
         /* Load file contents */          /* Load file contents */
         if ((bp = rcs_buf_load(pb->filename, BUF_AUTOEXT)) == NULL)          if ((bp = rcs_buf_load(pb->filename, BUF_AUTOEXT)) == NULL)
                 goto fail;                  return (-1);
   
         /* Get default values from working copy if -k specified */          /* Get default values from working copy if -k specified */
         if (pb->flags & CI_KEYWORDSCAN)          if (pb->flags & CI_KEYWORDSCAN)
Line 643 
Line 642 
         if (pb->description == NULL &&          if (pb->description == NULL &&
             rcs_set_description(pb->file, NULL) == -1) {              rcs_set_description(pb->file, NULL) == -1) {
                 warn("%s", pb->filename);                  warn("%s", pb->filename);
                 goto fail;                  return (-1);
         }          }
   
 skipdesc:  skipdesc:
Line 671 
Line 670 
             (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) {
                 warnx("failed to add new revision");                  warnx("failed to add new revision");
                 goto fail;                  return (-1);
         }          }
   
         /*          /*
Line 687 
Line 686 
         /* 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, bp) == -1) {          if (rcs_deltatext_set(pb->file, pb->file->rf_head, bp) == -1) {
                 warnx("failed to set new head revision");                  warnx("failed to set new head revision");
                 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 && checkin_attach_symbol(pb) < 0)          if (pb->symbol != NULL && checkin_attach_symbol(pb) < 0)
                 goto fail;                  return (-1);
   
         /* 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 724 
Line 723 
         }          }
   
         return (0);          return (0);
 fail:  
         return (-1);  
 }  }
   
 /*  /*
Line 771 
Line 768 
  * warn the user.   * warn the user.
  *   *
  */   */
 static void  static int
 checkin_revert(struct checkin_params *pb)  checkin_revert(struct checkin_params *pb)
 {  {
         char rbuf[16];          char rbuf[16];
Line 782 
Line 779 
                 (void)fprintf(stderr, "file is unchanged; reverting "                  (void)fprintf(stderr, "file is unchanged; reverting "
                     "to previous revision %s\n", rbuf);                      "to previous revision %s\n", rbuf);
   
           /* Attach a symbolic name to this revision if specified. */
           if (pb->symbol != NULL) {
                   if (checkin_checklock(pb) == -1)
                           return (-1);
   
                   pb->newrev = pb->frev;
                   if (checkin_attach_symbol(pb) == -1)
                           return (-1);
           }
   
         pb->flags |= CO_REVERT;          pb->flags |= CO_REVERT;
         (void)close(workfile_fd);          (void)close(workfile_fd);
         (void)unlink(pb->filename);          (void)unlink(pb->filename);
   
           /* If needed, write out RCSFILE before calling checkout_rev() */
           if (pb->symbol != NULL)
                   rcs_write(pb->file);
   
         if ((pb->flags & CO_LOCK) || (pb->flags & CO_UNLOCK))          if ((pb->flags & CO_LOCK) || (pb->flags & CO_UNLOCK))
                 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);
   
           return (0);
 }  }
   
 /*  /*

Legend:
Removed from v.1.199  
changed lines
  Added in v.1.200