version 1.66, 2006/05/31 01:26:21 |
version 1.67, 2006/05/31 23:27:38 |
|
|
cvs_commit_local(struct cvs_file *cf) |
cvs_commit_local(struct cvs_file *cf) |
{ |
{ |
BUF *b; |
BUF *b; |
|
int isnew; |
int l, openflags, rcsflags; |
int l, openflags, rcsflags; |
char *d, *f, rbuf[24]; |
char *d, *f, rbuf[24]; |
CVSENTRIES *entlist; |
CVSENTRIES *entlist; |
|
|
else |
else |
strlcpy(rbuf, "Non-existent", sizeof(rbuf)); |
strlcpy(rbuf, "Non-existent", sizeof(rbuf)); |
|
|
|
isnew = 0; |
if (cf->file_status == FILE_ADDED) { |
if (cf->file_status == FILE_ADDED) { |
|
isnew = 1; |
rcsflags = RCS_CREATE; |
rcsflags = RCS_CREATE; |
openflags = O_CREAT | O_TRUNC | O_WRONLY; |
openflags = O_CREAT | O_TRUNC | O_WRONLY; |
if (cf->file_rcs != NULL) { |
if (cf->file_rcs != NULL) { |
|
|
rcsflags = RCS_READ | RCS_PARSE_FULLY; |
rcsflags = RCS_READ | RCS_PARSE_FULLY; |
openflags = O_RDONLY; |
openflags = O_RDONLY; |
rcs_close(cf->file_rcs); |
rcs_close(cf->file_rcs); |
|
isnew = 0; |
} |
} |
|
|
cf->repo_fd = open(cf->file_rpath, openflags); |
cf->repo_fd = open(cf->file_rpath, openflags); |
|
|
cvs_printf("%s <- %s\n", cf->file_rpath, cf->file_path); |
cvs_printf("%s <- %s\n", cf->file_rpath, cf->file_path); |
cvs_printf("old revision: %s; ", rbuf); |
cvs_printf("old revision: %s; ", rbuf); |
|
|
if (cf->file_status != FILE_ADDED) |
if (isnew == 0) |
d = commit_diff_file(cf); |
d = commit_diff_file(cf); |
|
|
if (cf->file_status == FILE_REMOVED) { |
if (cf->file_status == FILE_REMOVED) { |
|
|
cvs_buf_putc(b, '\0'); |
cvs_buf_putc(b, '\0'); |
f = cvs_buf_release(b); |
f = cvs_buf_release(b); |
|
|
if (cf->file_status != FILE_ADDED) { |
if (isnew == 0) { |
if (rcs_deltatext_set(cf->file_rcs, |
if (rcs_deltatext_set(cf->file_rcs, |
cf->file_rcs->rf_head, d) == -1) |
cf->file_rcs->rf_head, d) == -1) |
fatal("cvs_commit_local: failed to set delta"); |
fatal("cvs_commit_local: failed to set delta"); |
|
|
|
|
xfree(f); |
xfree(f); |
|
|
if (cf->file_status != FILE_ADDED) |
if (isnew == 0) |
xfree(d); |
xfree(d); |
|
|
if (cf->file_status == FILE_REMOVED) { |
if (cf->file_status == FILE_REMOVED) { |