version 1.14, 2005/04/12 14:58:40 |
version 1.15, 2005/04/12 16:13:59 |
|
|
#include "proto.h" |
#include "proto.h" |
|
|
|
|
|
#define CVS_STATUS_SEP \ |
|
"===================================================================" |
|
|
|
|
const char *cvs_statstr[] = { |
const char *cvs_statstr[] = { |
"Unknown", |
"Unknown", |
"Up to date", |
"Up-to-date", |
"Locally Modified", |
"Locally Modified", |
"Added", |
"Added", |
"Removed", |
"Removed", |
"Conflict", |
"Conflict", |
"Patched", |
"Patched", |
|
"Lost", |
}; |
}; |
|
|
|
|
int cvs_status_file(CVSFILE *, void *); |
int cvs_status_file (CVSFILE *, void *); |
int cvs_status_options(char *, int, char **, int *); |
int cvs_status_local (CVSFILE *, void *); |
int cvs_status_sendflags(struct cvsroot *); |
int cvs_status_options (char *, int, char **, int *); |
|
int cvs_status_sendflags (struct cvsroot *); |
|
|
struct cvs_cmd_info cvs_status = { |
struct cvs_cmd_info cvs_status = { |
cvs_status_options, |
cvs_status_options, |
|
|
cvs_status_file(CVSFILE *cfp, void *arg) |
cvs_status_file(CVSFILE *cfp, void *arg) |
{ |
{ |
int ret; |
int ret; |
char *repo, fpath[MAXPATHLEN], rcspath[MAXPATHLEN]; |
char *repo, fpath[MAXPATHLEN]; |
RCSFILE *rf; |
RCSFILE *rf; |
struct cvs_ent *entp; |
struct cvs_ent *entp; |
struct cvsroot *root; |
struct cvsroot *root; |
|
|
repo = CVS_DIR_REPO(cfp); |
repo = CVS_DIR_REPO(cfp); |
|
|
if (cfp->cf_type == DT_DIR) { |
if (cfp->cf_type == DT_DIR) { |
if (root->cr_method != CVS_METHOD_LOCAL) { |
if (cfp->cf_cvstat == CVS_FST_UNKNOWN) |
if (cfp->cf_cvstat == CVS_FST_UNKNOWN) |
ret = cvs_sendreq(root, CVS_REQ_QUESTIONABLE, |
ret = cvs_sendreq(root, CVS_REQ_QUESTIONABLE, |
CVS_FILE_NAME(cfp)); |
CVS_FILE_NAME(cfp)); |
else |
else |
ret = cvs_senddir(root, cfp); |
ret = cvs_senddir(root, cfp); |
|
} |
|
|
|
return (ret); |
return (ret); |
} |
} |
|
|
cvs_file_getpath(cfp, fpath, sizeof(fpath)); |
cvs_file_getpath(cfp, fpath, sizeof(fpath)); |
entp = cvs_ent_getent(fpath); |
entp = cvs_ent_getent(fpath); |
|
|
if (root->cr_method != CVS_METHOD_LOCAL) { |
if ((entp != NULL) && (cvs_sendentry(root, entp) < 0)) { |
if ((entp != NULL) && (cvs_sendentry(root, entp) < 0)) { |
cvs_ent_free(entp); |
cvs_ent_free(entp); |
return (-1); |
return (CVS_EX_PROTO); |
} |
} |
|
|
|
switch (cfp->cf_cvstat) { |
switch (cfp->cf_cvstat) { |
case CVS_FST_UNKNOWN: |
case CVS_FST_UNKNOWN: |
ret = cvs_sendreq(root, CVS_REQ_QUESTIONABLE, |
ret = cvs_sendreq(root, CVS_REQ_QUESTIONABLE, |
CVS_FILE_NAME(cfp)); |
CVS_FILE_NAME(cfp)); |
break; |
break; |
case CVS_FST_UPTODATE: |
case CVS_FST_UPTODATE: |
ret = cvs_sendreq(root, CVS_REQ_UNCHANGED, |
ret = cvs_sendreq(root, CVS_REQ_UNCHANGED, |
CVS_FILE_NAME(cfp)); |
CVS_FILE_NAME(cfp)); |
break; |
break; |
case CVS_FST_MODIFIED: |
case CVS_FST_MODIFIED: |
ret = cvs_sendreq(root, CVS_REQ_MODIFIED, |
ret = cvs_sendreq(root, CVS_REQ_MODIFIED, |
CVS_FILE_NAME(cfp)); |
CVS_FILE_NAME(cfp)); |
if (ret == 0) |
if (ret == 0) |
ret = cvs_sendfile(root, fpath); |
ret = cvs_sendfile(root, fpath); |
default: |
default: |
break; |
break; |
} |
} |
} else { |
|
if (cfp->cf_cvstat == CVS_FST_UNKNOWN) { |
|
cvs_log(LP_WARN, "I know nothing about %s", fpath); |
|
return (0); |
|
} |
|
|
|
snprintf(rcspath, sizeof(rcspath), "%s/%s/%s%s", |
if (entp != NULL) |
root->cr_dir, repo, CVS_FILE_NAME(cfp), RCS_FILE_EXT); |
cvs_ent_free(entp); |
|
return (ret); |
|
} |
|
|
rf = rcs_open(rcspath, RCS_READ); |
int |
if (rf == NULL) { |
cvs_status_local(CVSFILE *cfp, void *arg) |
if (entp != NULL) |
{ |
cvs_ent_free(entp); |
char *repo, numbuf[64], fpath[MAXPATHLEN], rcspath[MAXPATHLEN]; |
return (CVS_EX_DATA); |
RCSFILE *rf; |
} |
struct cvs_ent *entp; |
|
struct cvsroot *root; |
|
|
rcs_close(rf); |
if (cfp->cf_type == DT_DIR) |
|
return (0); |
|
|
|
root = CVS_DIR_ROOT(cfp); |
|
repo = CVS_DIR_REPO(cfp); |
|
|
|
cvs_file_getpath(cfp, fpath, sizeof(fpath)); |
|
entp = cvs_ent_getent(fpath); |
|
|
|
if (cfp->cf_cvstat == CVS_FST_UNKNOWN) { |
|
cvs_log(LP_WARN, "I know nothing about %s", fpath); |
|
return (0); |
} |
} |
|
|
|
snprintf(rcspath, sizeof(rcspath), "%s/%s/%s%s", |
|
root->cr_dir, repo, CVS_FILE_NAME(cfp), RCS_FILE_EXT); |
|
|
|
rf = rcs_open(rcspath, RCS_READ); |
|
if (rf == NULL) { |
|
if (entp != NULL) |
|
cvs_ent_free(entp); |
|
return (-1); |
|
} |
|
|
|
cvs_printf(CVS_STATUS_SEP "\nFile: %-18sStatus: %s\n\n", |
|
CVS_FILE_NAME(cfp), cvs_statstr[cfp->cf_cvstat]); |
|
|
|
rcsnum_tostr(entp->ce_rev, numbuf, sizeof(numbuf)); |
|
cvs_printf(" Working revision: %s %s\n", numbuf, "date here"); |
|
rcsnum_tostr(rf->rf_head, numbuf, sizeof(numbuf)); |
|
cvs_printf(" Repository revision: %s %s\n", numbuf, rcspath); |
|
cvs_printf(" Sticky Tag: %s\n", "(none)"); |
|
cvs_printf(" Sticky Date: %s\n", "(none)"); |
|
cvs_printf(" Sticky Options: %s\n", "(none)"); |
|
|
|
rcs_close(rf); |
|
|
if (entp != NULL) |
if (entp != NULL) |
cvs_ent_free(entp); |
cvs_ent_free(entp); |
return (ret); |
return (0); |
} |
} |