version 1.45, 2005/10/18 01:22:14 |
version 1.46, 2005/10/18 01:39:47 |
|
|
int |
int |
checkin_main(int argc, char **argv) |
checkin_main(int argc, char **argv) |
{ |
{ |
int found, notlocked; |
int found, notlocked, ret; |
int i, ch, force, lkmode, interactive, rflag, status, symforce; |
int i, ch, force, lkmode, interactive, rflag, status, symforce; |
mode_t fmode; |
mode_t fmode; |
time_t date; |
time_t date; |
RCSFILE *file; |
RCSFILE *file; |
RCSNUM *frev, *newrev; |
RCSNUM *frev, *newrev; |
char fpath[MAXPATHLEN]; |
char fpath[MAXPATHLEN]; |
char *rcs_msg, *filec, *deltatext, *username; |
char *rcs_msg, *filec, *deltatext, *username, rbuf[16]; |
const char *symbol = NULL; |
const char *symbol = NULL; |
struct rcs_lock *lkp; |
struct rcs_lock *lkp; |
BUF *bp; |
BUF *bp; |
|
|
|
|
frev = file->rf_head; |
frev = file->rf_head; |
|
|
cvs_printf("%s <-- %s\n", fpath, argv[i]); |
if (verbose == 1) |
|
printf("%s <-- %s\n", fpath, argv[i]); |
|
|
/* |
/* |
* If revision passed on command line is less than HEAD, bail. |
* If revision passed on command line is less than HEAD, bail. |
|
|
* user and revert to latest version. |
* user and revert to latest version. |
*/ |
*/ |
if ((!force) && (strlen(deltatext) < 1)) { |
if ((!force) && (strlen(deltatext) < 1)) { |
char buf[16]; |
rcsnum_tostr(frev, rbuf, sizeof(rbuf)); |
rcsnum_tostr(frev, buf, sizeof(buf)); |
|
cvs_log(LP_WARN, |
cvs_log(LP_WARN, |
"file is unchanged; reverting to previous revision %s", |
"file is unchanged; reverting to previous revision %s", |
buf); |
rbuf); |
(void)unlink(argv[i]); |
(void)unlink(argv[i]); |
if (lkmode != 0) |
if (lkmode != 0) |
checkout_rev(file, frev, argv[i], lkmode, |
checkout_rev(file, frev, argv[i], lkmode, |
username, 0); |
username, 0); |
rcs_lock_remove(file, frev); |
rcs_lock_remove(file, frev); |
rcs_close(file); |
rcs_close(file); |
cvs_printf("done\n"); |
if (verbose == 1) |
|
printf("done\n"); |
continue; |
continue; |
} |
} |
|
|
|
|
* Attach a symbolic name to this revision if specified. |
* Attach a symbolic name to this revision if specified. |
*/ |
*/ |
if (symbol != NULL) { |
if (symbol != NULL) { |
cvs_printf("symbol: %s\n", symbol); |
if (verbose == 1) |
int ret = 0; |
printf("symbol: %s\n", symbol); |
if (symforce) |
if (symforce) |
rcs_sym_remove(file, symbol); |
rcs_sym_remove(file, symbol); |
if ((ret = rcs_sym_add(file, symbol, newrev) == -1) |
if ((ret = rcs_sym_add(file, symbol, newrev) == -1) |
&& (rcs_errno == RCS_ERR_DUPENT)) { |
&& (rcs_errno == RCS_ERR_DUPENT)) { |
char tmp[16]; |
|
rcsnum_tostr(rcs_sym_getrev(file, symbol), |
rcsnum_tostr(rcs_sym_getrev(file, symbol), |
tmp, sizeof(tmp)); |
rbuf, sizeof(rbuf)); |
cvs_log(LP_ERR, |
cvs_log(LP_ERR, |
"symbolic name %s already bound to %s", |
"symbolic name %s already bound to %s", |
symbol, tmp); |
symbol, rbuf); |
status = 1; |
status = 1; |
rcs_close(file); |
rcs_close(file); |
continue; |
continue; |
} else if (ret == -1) { |
} else if (ret == -1) { |
cvs_printf("problem adding symbol: %s\n", |
cvs_log(LP_ERR, "problem adding symbol: %s", |
symbol); |
symbol); |
status = 1; |
status = 1; |
rcs_close(file); |
rcs_close(file); |
|
|
return (NULL); |
return (NULL); |
} |
} |
|
|
cvs_printf("new revision: %s; previous revision: %s\n", nrev, prev); |
printf("new revision: %s; previous revision: %s\n", nrev, prev); |
cvs_printf("enter log message, terminated with single " |
printf("enter log message, terminated with single " |
"'.' or end of file:\n"); |
"'.' or end of file:\n"); |
cvs_printf(">> "); |
printf(">> "); |
|
|
for (;;) { |
for (;;) { |
fgets(buf, (int)sizeof(buf), stdin); |
fgets(buf, (int)sizeof(buf), stdin); |
if (feof(stdin) || ferror(stdin) || buf[0] == '.') |
if (feof(stdin) || ferror(stdin) || buf[0] == '.') |
break; |
break; |
cvs_buf_append(logbuf, buf, strlen(buf)); |
cvs_buf_append(logbuf, buf, strlen(buf)); |
cvs_printf(">> "); |
printf(">> "); |
} |
} |
|
|
cvs_buf_putc(logbuf, '\0'); |
cvs_buf_putc(logbuf, '\0'); |