version 1.125, 2006/03/24 05:14:48 |
version 1.126, 2006/03/26 12:56:31 |
|
|
*/ |
*/ |
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 |
|
|
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); |
|
} |
} |
|
|
/* |
/* |
|
|
*/ |
*/ |
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) { |
|
|
} |
} |
} |
} |
|
|
/* 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); |
|
} |
} |
|
|
/* |
/* |
|
|
*/ |
*/ |
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. */ |
|
|
(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); |
|
} |
} |
|
|
/* |
/* |
|
|
/* 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) |
|
|
pb->rcs_msg = NULL; |
pb->rcs_msg = NULL; |
} |
} |
return (0); |
return (0); |
|
|
|
fail: |
|
xfree(filec); |
|
rcs_close(pb->file); |
|
return (-1); |
} |
} |
|
|
/* |
/* |
|
|
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); |
|
|
*/ |
*/ |
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, |
|
|
(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) |
|
|
/* 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) |
|
|
rcs_close(pb->file); |
rcs_close(pb->file); |
|
|
return (0); |
return (0); |
|
fail: |
|
xfree(filec); |
|
rcs_close(pb->file); |
|
return (-1); |
} |
} |
|
|
/* |
/* |
|
|
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); |
|
|
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); |
|
} |
} |
|
|
/* |
/* |
|
|
|
|
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); |
} |
} |
|
|
|
|
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; |