version 1.112, 2008/01/31 10:15:05 |
version 1.113, 2008/01/31 19:38:59 |
|
|
#include "remote.h" |
#include "remote.h" |
|
|
static void checkout_check_repository(int, char **); |
static void checkout_check_repository(int, char **); |
|
static int checkout_classify(const char *, const char *); |
static void checkout_repository(const char *, const char *); |
static void checkout_repository(const char *, const char *); |
|
|
extern int print_stdout; |
extern int print_stdout; |
|
|
{ |
{ |
int i; |
int i; |
char repo[MAXPATHLEN]; |
char repo[MAXPATHLEN]; |
struct stat st; |
|
struct cvs_recursion cr; |
struct cvs_recursion cr; |
|
|
build_dirs = print_stdout ? 0 : 1; |
build_dirs = print_stdout ? 0 : 1; |
|
|
(void)xsnprintf(repo, sizeof(repo), "%s/%s", |
(void)xsnprintf(repo, sizeof(repo), "%s/%s", |
current_cvsroot->cr_dir, argv[i]); |
current_cvsroot->cr_dir, argv[i]); |
|
|
if (stat(repo, &st) == -1) { |
switch (checkout_classify(repo, argv[i])) { |
/* check if a single file was requested */ |
case CVS_FILE: |
strlcat(repo, RCS_FILE_EXT, MAXPATHLEN); |
|
|
|
if (stat(repo, &st) == -1) { |
|
cvs_log(LP_ERR, |
|
"cannot find module `%s' - ignored", |
|
argv[i]); |
|
continue; |
|
} |
|
|
|
cr.fileproc = cvs_update_local; |
cr.fileproc = cvs_update_local; |
cr.flags = flags; |
cr.flags = flags; |
|
|
if (build_dirs == 1) |
if (build_dirs == 1) |
cvs_mkpath(dirname(argv[i]), cvs_specified_tag); |
cvs_mkpath(dirname(argv[i]), cvs_specified_tag); |
cvs_file_run(1, &(argv[i]), &cr); |
cvs_file_run(1, &(argv[i]), &cr); |
|
break; |
|
case CVS_DIR: |
|
if (build_dirs == 1) |
|
cvs_mkpath(argv[i], cvs_specified_tag); |
|
checkout_repository(repo, argv[i]); |
|
break; |
|
default: |
|
break; |
|
} |
|
} |
|
} |
|
|
continue; |
static int |
|
checkout_classify(const char *repo, const char *arg) |
|
{ |
|
char *d, *f, fpath[MAXPATHLEN]; |
|
struct stat sb; |
|
|
|
if (stat(repo, &sb) == 0) { |
|
if (!S_ISDIR(sb.st_mode)) { |
|
cvs_log(LP_ERR, "ignoring %s: not a directory", arg); |
|
return 0; |
} |
} |
|
return CVS_DIR; |
|
} |
|
|
if (build_dirs == 1) |
d = dirname(repo); |
cvs_mkpath(argv[i], cvs_specified_tag); |
f = basename(repo); |
checkout_repository(repo, argv[i]); |
|
|
(void)xsnprintf(fpath, sizeof(fpath), "%s/%s%s", d, f, RCS_FILE_EXT); |
|
if (stat(fpath, &sb) == 0) { |
|
if (!S_ISREG(sb.st_mode)) { |
|
cvs_log(LP_ERR, "ignoring %s: not a regular file", arg); |
|
return 0; |
|
} |
|
return CVS_FILE; |
} |
} |
|
|
|
(void)xsnprintf(fpath, sizeof(fpath), "%s/%s/%s%s", |
|
d, CVS_PATH_ATTIC, f, RCS_FILE_EXT); |
|
if (stat(fpath, &sb) == 0) { |
|
if (!S_ISREG(sb.st_mode)) { |
|
cvs_log(LP_ERR, "ignoring %s: not a regular file", arg); |
|
return 0; |
|
} |
|
return CVS_FILE; |
|
} |
|
|
|
cvs_log(LP_ERR, "cannot find module `%s' - ignored", arg); |
|
return 0; |
} |
} |
|
|
static void |
static void |