version 1.6, 2005/03/05 18:43:55 |
version 1.7, 2005/03/30 17:43:04 |
|
|
|
|
#define CVS_IMPORT_DEFBRANCH "1.1.1" |
#define CVS_IMPORT_DEFBRANCH "1.1.1" |
|
|
|
int cvs_import_options(char *, int, char **, int *); |
|
int cvs_import_sendflags(struct cvsroot *); |
|
int cvs_import_file(CVSFILE *, void *); |
|
|
|
static RCSNUM *bnum; |
|
static char *branch, *module, *vendor, *release; |
|
|
int cvs_import_file(CVSFILE *, void *); |
struct cvs_cmd_info cvs_import = { |
char repo[MAXPATHLEN]; |
cvs_import_options, |
|
cvs_import_sendflags, |
|
cvs_import_file, |
|
NULL, NULL, |
|
CF_RECURSE | CF_IGNORE | CF_NOSYMS, |
|
CVS_REQ_IMPORT, |
|
CVS_CMD_SENDDIR |
|
}; |
|
|
/* |
|
* cvs_import() |
|
* |
|
* Handler for the `cvs import' command. |
|
*/ |
|
int |
int |
cvs_import(int argc, char **argv) |
cvs_import_options(char *opt, int argc, char **argv, int *arg) |
{ |
{ |
int ch, flags; |
int ch; |
char *branch; |
|
struct cvsroot *root; |
|
RCSNUM *bnum; |
|
|
|
branch = CVS_IMPORT_DEFBRANCH; |
while ((ch = getopt(argc, argv, opt)) != -1) { |
flags = CF_RECURSE | CF_IGNORE | CF_NOSYMS; |
|
|
|
while ((ch = getopt(argc, argv, "b:dI:k:m:")) != -1) { |
|
switch (ch) { |
switch (ch) { |
case 'b': |
case 'b': |
branch = optarg; |
branch = optarg; |
|
|
|
|
argc -= optind; |
argc -= optind; |
argv += optind; |
argv += optind; |
|
*arg = optind; |
|
|
if (argc > 4) |
if (argc > 4) |
return (EX_USAGE); |
return (EX_USAGE); |
|
|
cvs_files = cvs_file_get(".", flags); |
module = argv[0]; |
if (cvs_files == NULL) |
vendor = argv[1]; |
return (EX_DATAERR); |
release = argv[2]; |
|
|
root = CVS_DIR_ROOT(cvs_files); |
|
if (root == NULL) { |
|
cvs_log(LP_ERR, |
|
"No CVSROOT specified! Please use the `-d' option"); |
|
cvs_log(LP_ERR, |
|
"or set the CVSROOT environment variable."); |
|
return (EX_USAGE); |
|
} |
|
|
|
if ((cvs_msg == NULL) && |
if ((cvs_msg == NULL) && |
(cvs_msg = cvs_logmsg_get(NULL, NULL, NULL, NULL)) == NULL) |
(cvs_msg = cvs_logmsg_get(NULL, NULL, NULL, NULL)) == NULL) |
return (-1); |
return (-1); |
|
|
if (root->cr_method != CVS_METHOD_LOCAL) { |
return (0); |
if ((cvs_connect(root) < 0) || |
} |
(cvs_sendarg(root, "-b", 0) < 0) || |
|
(cvs_sendarg(root, branch, 0) < 0) || |
|
(cvs_logmsg_send(root, cvs_msg) < 0) || |
|
(cvs_sendarg(root, argv[0], 0) < 0) || |
|
(cvs_sendarg(root, argv[1], 0) < 0) || |
|
(cvs_sendarg(root, argv[2], 0) < 0)) |
|
return (EX_PROTOCOL); |
|
} |
|
|
|
snprintf(repo, sizeof(repo), "%s/%s", root->cr_dir, argv[0]); |
int |
cvs_file_examine(cvs_files, cvs_import_file, NULL); |
cvs_import_sendflags(struct cvsroot *root) |
|
{ |
|
if ((cvs_connect(root) < 0) || |
|
(cvs_sendarg(root, "-b", 0) < 0) || |
|
(cvs_sendarg(root, branch, 0) < 0) || |
|
(cvs_logmsg_send(root, cvs_msg) < 0) || |
|
(cvs_sendarg(root, module, 0) < 0) || |
|
(cvs_sendarg(root, vendor, 0) < 0) || |
|
(cvs_sendarg(root, release, 0) < 0)) |
|
return (EX_PROTOCOL); |
|
|
if (root->cr_method != CVS_METHOD_LOCAL) { |
|
if (cvs_senddir(root, cvs_files) < 0 || |
|
cvs_sendreq(root, CVS_REQ_IMPORT, NULL) < 0) |
|
return (EX_PROTOCOL); |
|
} |
|
|
|
return (0); |
return (0); |
} |
} |
|
|
|
|
int ret; |
int ret; |
struct cvsroot *root; |
struct cvsroot *root; |
char fpath[MAXPATHLEN], repodir[MAXPATHLEN]; |
char fpath[MAXPATHLEN], repodir[MAXPATHLEN]; |
|
char repo[MAXPATHLEN]; |
|
|
root = CVS_DIR_ROOT(cfp); |
root = CVS_DIR_ROOT(cfp); |
|
snprintf(repo, sizeof(repo), "%s/%s", root->cr_dir, module); |
|
|
cvs_file_getpath(cfp, fpath, sizeof(fpath)); |
cvs_file_getpath(cfp, fpath, sizeof(fpath)); |
printf("Importing %s\n", fpath); |
printf("Importing %s\n", fpath); |