version 1.55, 2006/05/27 03:30:30 |
version 1.56, 2006/05/27 06:16:14 |
|
|
{ |
{ |
BUF *b; |
BUF *b; |
char *d, *f, rbuf[16]; |
char *d, *f, rbuf[16]; |
|
CVSENTRIES *entlist; |
|
|
cvs_log(LP_TRACE, "cvs_commit_local(%s)", cf->file_path); |
cvs_log(LP_TRACE, "cvs_commit_local(%s)", cf->file_path); |
cvs_file_classify(cf); |
cvs_file_classify(cf); |
|
|
rcsnum_tostr(cf->file_rcs->rf_head, rbuf, sizeof(rbuf)); |
if (cf->file_status == FILE_MODIFIED || |
|
cf->file_status == FILE_REMOVED) |
|
rcsnum_tostr(cf->file_rcs->rf_head, rbuf, sizeof(rbuf)); |
|
|
cvs_printf("Checking in %s:\n", cf->file_path); |
cvs_printf("Checking in %s:\n", cf->file_path); |
cvs_printf("%s <- %s\n", cf->file_rpath, cf->file_path); |
cvs_printf("%s <- %s\n", cf->file_rpath, cf->file_path); |
|
|
|
|
d = commit_diff_file(cf); |
d = commit_diff_file(cf); |
|
|
if ((b = cvs_buf_load(cf->file_path, BUF_AUTOEXT)) == NULL) |
if (cf->file_status == FILE_REMOVED) { |
fatal("cvs_commit_local: failed to load file"); |
b = rcs_getrev(cf->file_rcs, cf->file_rcs->rf_head); |
|
if (b == NULL) |
|
fatal("cvs_commit_local: failed to get HEAD"); |
|
} else if (cf->file_status == FILE_MODIFIED) { |
|
if ((b = cvs_buf_load(cf->file_path, BUF_AUTOEXT)) == NULL) |
|
fatal("cvs_commit_local: failed to load file"); |
|
} |
|
|
cvs_buf_putc(b, '\0'); |
cvs_buf_putc(b, '\0'); |
f = cvs_buf_release(b); |
f = cvs_buf_release(b); |
|
|
xfree(f); |
xfree(f); |
xfree(d); |
xfree(d); |
|
|
|
if (cf->file_status == FILE_REMOVED) { |
|
if (rcs_state_set(cf->file_rcs, |
|
cf->file_rcs->rf_head, RCS_STATE_DEAD) == -1) |
|
fatal("cvs_commit_local: failed to set state"); |
|
} |
|
|
rcs_write(cf->file_rcs); |
rcs_write(cf->file_rcs); |
|
|
rcsnum_tostr(cf->file_rcs->rf_head, rbuf, sizeof(rbuf)); |
if (cf->file_status == FILE_REMOVED) { |
|
strlcpy(rbuf, "Removed", sizeof(rbuf)); |
|
} else if (cf->file_status == FILE_MODIFIED) { |
|
rcsnum_tostr(cf->file_rcs->rf_head, rbuf, sizeof(rbuf)); |
|
} |
|
|
cvs_printf("new revision: %s\n", rbuf); |
cvs_printf("new revision: %s\n", rbuf); |
|
|
(void)unlink(cf->file_path); |
(void)unlink(cf->file_path); |
(void)close(cf->fd); |
(void)close(cf->fd); |
cf->fd = -1; |
cf->fd = -1; |
cvs_checkout_file(cf, cf->file_rcs->rf_head, 0); |
|
|
|
|
if (cf->file_status != FILE_REMOVED) { |
|
cvs_checkout_file(cf, cf->file_rcs->rf_head, 0); |
|
} else { |
|
entlist = cvs_ent_open(cf->file_wd); |
|
cvs_ent_remove(entlist, cf->file_name); |
|
cvs_ent_close(entlist, ENT_SYNC); |
|
} |
|
|
cvs_printf("done\n"); |
cvs_printf("done\n"); |
|
|
} |
} |
|
|
char*delta, *p1, *p2; |
char*delta, *p1, *p2; |
BUF *b1, *b2, *b3; |
BUF *b1, *b2, *b3; |
|
|
if ((b1 = cvs_buf_load(cf->file_path, BUF_AUTOEXT)) == NULL) |
if (cf->file_status == FILE_MODIFIED) { |
fatal("commit_diff_file: failed to load '%s'", cf->file_path); |
if ((b1 = cvs_buf_load(cf->file_path, BUF_AUTOEXT)) == NULL) |
|
fatal("commit_diff_file: failed to load '%s'", |
|
cf->file_path); |
|
} else if (cf->file_status == FILE_REMOVED) { |
|
b1 = rcs_getrev(cf->file_rcs, cf->file_rcs->rf_head); |
|
if (b1 == NULL) |
|
fatal("commit_diff_file: failed to load HEAD"); |
|
b1 = rcs_kwexp_buf(b1, cf->file_rcs, cf->file_rcs->rf_head); |
|
} |
|
|
if ((b2 = rcs_getrev(cf->file_rcs, cf->file_rcs->rf_head)) == NULL) |
if ((b2 = rcs_getrev(cf->file_rcs, cf->file_rcs->rf_head)) == NULL) |
fatal("commit_diff_file: failed to load HEAD for '%s'", |
fatal("commit_diff_file: failed to load HEAD for '%s'", |