version 1.43, 2006/05/28 07:56:44 |
version 1.44, 2006/05/28 10:15:35 |
|
|
void |
void |
cvs_add_local(struct cvs_file *cf) |
cvs_add_local(struct cvs_file *cf) |
{ |
{ |
|
int stop, l; |
|
char *entry, revbuf[16]; |
|
CVSENTRIES *entlist; |
|
|
cvs_log(LP_TRACE, "cvs_add_local(%s)", cf->file_path); |
cvs_log(LP_TRACE, "cvs_add_local(%s)", cf->file_path); |
|
|
cvs_file_classify(cf, 0); |
cvs_file_classify(cf, 0); |
|
|
|
if (cf->file_rcs != NULL) |
|
rcsnum_tostr(cf->file_rcs->rf_head, revbuf, sizeof(revbuf)); |
|
|
|
stop = 0; |
switch (cf->file_status) { |
switch (cf->file_status) { |
case FILE_ADDED: |
case FILE_ADDED: |
cvs_log(LP_NOTICE, "%s has already been entered", |
cvs_log(LP_NOTICE, "%s has already been entered", |
cf->file_path); |
cf->file_path); |
|
stop = 1; |
break; |
break; |
|
case FILE_UPTODATE: |
|
if (cf->file_rcs != NULL && cf->file_rcs->rf_dead == 0) { |
|
cvs_log(LP_NOTICE, "%s already exists, with version " |
|
"number %s", cf->file_path, revbuf); |
|
stop = 1; |
|
} |
|
break; |
case FILE_UNKNOWN: |
case FILE_UNKNOWN: |
cvs_log(LP_NOTICE, "%s is unknown to us so far", |
if (cf->file_rcs != NULL && cf->file_rcs->rf_dead == 1) { |
cf->file_path); |
cvs_log(LP_NOTICE, "re-adding file %s " |
|
"(instead of dead revision %s)", |
|
cf->file_path, revbuf); |
|
} else { |
|
cvs_log(LP_NOTICE, "scheduling file '%s' for addition", |
|
cf->file_path); |
|
} |
break; |
break; |
default: |
default: |
break; |
break; |
} |
} |
|
|
|
if (stop == 1) |
|
return; |
|
|
|
entry = xmalloc(CVS_ENT_MAXLINELEN); |
|
l = snprintf(entry, CVS_ENT_MAXLINELEN, "/%s/0/Initial %s//", |
|
cf->file_name, cf->file_name); |
|
|
|
entlist = cvs_ent_open(cf->file_wd); |
|
cvs_ent_add(entlist, entry); |
|
cvs_ent_close(entlist, ENT_SYNC); |
|
|
|
xfree(entry); |
|
|
|
cvs_log(LP_NOTICE, "use commit to add this file permanently"); |
} |
} |