=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rcs/ci.c,v retrieving revision 1.72 retrieving revision 1.73 diff -c -r1.72 -r1.73 *** src/usr.bin/rcs/ci.c 2005/11/28 08:49:25 1.72 --- src/usr.bin/rcs/ci.c 2005/11/28 09:16:32 1.73 *************** *** 1,4 **** ! /* $OpenBSD: ci.c,v 1.72 2005/11/28 08:49:25 xsa Exp $ */ /* * Copyright (c) 2005 Niall O'Higgins * All rights reserved. --- 1,4 ---- ! /* $OpenBSD: ci.c,v 1.73 2005/11/28 09:16:32 xsa Exp $ */ /* * Copyright (c) 2005 Niall O'Higgins * All rights reserved. *************** *** 440,448 **** pb->frev = pb->file->rf_head; ! /* ! * If revision passed on command line is less than HEAD, bail. ! */ if ((pb->newrev != NULL) && (rcsnum_cmp(pb->newrev, pb->frev, 0) > 0)) { cvs_log(LP_ERR, "revision is too low!"); --- 440,446 ---- pb->frev = pb->file->rf_head; ! /* If revision passed on command line is less than HEAD, bail. */ if ((pb->newrev != NULL) && (rcsnum_cmp(pb->newrev, pb->frev, 0) > 0)) { cvs_log(LP_ERR, "revision is too low!"); *************** *** 450,458 **** return (-1); } ! /* ! * Load file contents ! */ if ((bp = cvs_buf_load(pb->filename, BUF_AUTOEXT)) == NULL) { cvs_log(LP_ERR, "failed to load '%s'", pb->filename); return (-1); --- 448,454 ---- return (-1); } ! /* Load file contents */ if ((bp = cvs_buf_load(pb->filename, BUF_AUTOEXT)) == NULL) { cvs_log(LP_ERR, "failed to load '%s'", pb->filename); return (-1); *************** *** 463,471 **** filec = (char *)cvs_buf_release(bp); ! /* ! * Get RCS patch ! */ if ((pb->deltatext = checkin_diff_file(pb)) == NULL) { cvs_log(LP_ERR, "failed to get diff"); return (-1); --- 459,465 ---- filec = (char *)cvs_buf_release(bp); ! /* Get RCS patch */ if ((pb->deltatext = checkin_diff_file(pb)) == NULL) { cvs_log(LP_ERR, "failed to get diff"); return (-1); *************** *** 480,509 **** return (0); } ! /* ! * Check for a lock belonging to this user. If none, ! * abort check-in. ! */ if (checkin_checklock(pb) < 0) return (-1); ! /* ! * If no log message specified, get it interactively. ! */ if (pb->flags & INTERACTIVE) pb->rcs_msg = checkin_getlogmsg(pb->frev, pb->newrev); - /* - * Remove the lock - */ if (rcs_lock_remove(pb->file, pb->frev) < 0) { if (rcs_errno != RCS_ERR_NOENT) cvs_log(LP_WARN, "failed to remove lock"); } ! /* ! * Current head revision gets the RCS patch as rd_text ! */ if (rcs_deltatext_set(pb->file, pb->frev, pb->deltatext) == -1) { cvs_log(LP_ERR, "failed to set new rd_text for head rev"); --- 474,493 ---- return (0); } ! /* Check for a lock belonging to this user. If none, abort check-in. */ if (checkin_checklock(pb) < 0) return (-1); ! /* If no log message specified, get it interactively. */ if (pb->flags & INTERACTIVE) pb->rcs_msg = checkin_getlogmsg(pb->frev, pb->newrev); if (rcs_lock_remove(pb->file, pb->frev) < 0) { if (rcs_errno != RCS_ERR_NOENT) cvs_log(LP_WARN, "failed to remove lock"); } ! /* Current head revision gets the RCS patch as rd_text */ if (rcs_deltatext_set(pb->file, pb->frev, pb->deltatext) == -1) { cvs_log(LP_ERR, "failed to set new rd_text for head rev"); *************** *** 518,526 **** && (checkin_mtimedate(pb) < 0)) return (-1); ! /* ! * Now add our new revision ! */ if (rcs_rev_add(pb->file, (pb->newrev == NULL ? RCS_HEAD_REV : pb->newrev), pb->rcs_msg, pb->date, pb->username) != 0) { --- 502,508 ---- && (checkin_mtimedate(pb) < 0)) return (-1); ! /* Now add our new revision */ if (rcs_rev_add(pb->file, (pb->newrev == NULL ? RCS_HEAD_REV : pb->newrev), pb->rcs_msg, pb->date, pb->username) != 0) { *************** *** 537,561 **** else pb->newrev = pb->file->rf_head; ! /* ! * New head revision has to contain entire file; ! */ ! if (rcs_deltatext_set(pb->file, pb->frev, filec) == -1) { cvs_log(LP_ERR, "failed to set new head revision"); exit(1); } ! /* ! * Attach a symbolic name to this revision if specified. ! */ if (pb->symbol != NULL && (checkin_attach_symbol(pb) < 0)) return (-1); ! /* ! * Set the state of this revision if specified. ! */ if (pb->state != NULL) (void)rcs_state_set(pb->file, pb->newrev, pb->state); --- 519,536 ---- else pb->newrev = pb->file->rf_head; ! /* New head revision has to contain entire file; */ if (rcs_deltatext_set(pb->file, pb->frev, filec) == -1) { cvs_log(LP_ERR, "failed to set new head revision"); exit(1); } ! /* Attach a symbolic name to this revision if specified. */ if (pb->symbol != NULL && (checkin_attach_symbol(pb) < 0)) return (-1); ! /* Set the state of this revision if specified. */ if (pb->state != NULL) (void)rcs_state_set(pb->file, pb->newrev, pb->state); *************** *** 563,571 **** free(filec); (void)unlink(pb->filename); ! /* ! * Do checkout if -u or -l are specified. ! */ if (((pb->flags & CO_LOCK) || (pb->flags & CO_UNLOCK)) && !(pb->flags & CI_DEFAULT)) checkout_rev(pb->file, pb->newrev, pb->filename, pb->flags, --- 538,544 ---- free(filec); (void)unlink(pb->filename); ! /* Do checkout if -u or -l are specified. */ if (((pb->flags & CO_LOCK) || (pb->flags & CO_UNLOCK)) && !(pb->flags & CI_DEFAULT)) checkout_rev(pb->file, pb->newrev, pb->filename, pb->flags, *************** *** 593,601 **** BUF *bp; char *rcs_desc, *filec; ! /* ! * Load file contents ! */ if ((bp = cvs_buf_load(pb->filename, BUF_AUTOEXT)) == NULL) { cvs_log(LP_ERR, "failed to load '%s'", pb->filename); return (-1); --- 566,572 ---- BUF *bp; char *rcs_desc, *filec; ! /* Load file contents */ if ((bp = cvs_buf_load(pb->filename, BUF_AUTOEXT)) == NULL) { cvs_log(LP_ERR, "failed to load '%s'", pb->filename); return (-1); *************** *** 606,620 **** filec = (char *)cvs_buf_release(bp); ! /* ! * Get description from user ! */ rcs_desc = checkin_getdesc(); rcs_desc_set(pb->file, rcs_desc); ! /* ! * Now add our new revision ! */ if (rcs_rev_add(pb->file, RCS_HEAD_REV, LOG_INIT, -1, pb->username) != 0) { cvs_log(LP_ERR, "failed to add new revision"); return (-1); --- 577,587 ---- filec = (char *)cvs_buf_release(bp); ! /* Get description from user */ rcs_desc = checkin_getdesc(); rcs_desc_set(pb->file, rcs_desc); ! /* Now add our new revision */ if (rcs_rev_add(pb->file, RCS_HEAD_REV, LOG_INIT, -1, pb->username) != 0) { cvs_log(LP_ERR, "failed to add new revision"); return (-1); *************** *** 628,659 **** else pb->newrev = pb->file->rf_head; ! /* ! * New head revision has to contain entire file; ! */ if (rcs_deltatext_set(pb->file, pb->file->rf_head, filec) == -1) { cvs_log(LP_ERR, "failed to set new head revision"); return (-1); } ! /* ! * Attach a symbolic name to this revision if specified. ! */ if (pb->symbol != NULL && (checkin_attach_symbol(pb) < 0)) return (-1); ! /* ! * Set the state of this revision if specified. ! */ if (pb->state != NULL) (void)rcs_state_set(pb->file, pb->newrev, pb->state); free(filec); (void)unlink(pb->filename); ! /* ! * Do checkout if -u or -l are specified. ! */ if (((pb->flags & CO_LOCK) || (pb->flags & CO_UNLOCK)) && !(pb->flags & CI_DEFAULT)) checkout_rev(pb->file, pb->newrev, pb->filename, pb->flags, --- 595,618 ---- else pb->newrev = pb->file->rf_head; ! /* New head revision has to contain entire file; */ if (rcs_deltatext_set(pb->file, pb->file->rf_head, filec) == -1) { cvs_log(LP_ERR, "failed to set new head revision"); return (-1); } ! /* Attach a symbolic name to this revision if specified. */ if (pb->symbol != NULL && (checkin_attach_symbol(pb) < 0)) return (-1); ! /* Set the state of this revision if specified. */ if (pb->state != NULL) (void)rcs_state_set(pb->file, pb->newrev, pb->state); free(filec); (void)unlink(pb->filename); ! /* Do checkout if -u or -l are specified. */ if (((pb->flags & CO_LOCK) || (pb->flags & CO_UNLOCK)) && !(pb->flags & CI_DEFAULT)) checkout_rev(pb->file, pb->newrev, pb->filename, pb->flags,