version 1.122, 2008/02/03 20:01:37 |
version 1.123, 2008/02/03 22:50:28 |
|
|
checkout_check_repository(int argc, char **argv) |
checkout_check_repository(int argc, char **argv) |
{ |
{ |
int i; |
int i; |
char *wdir; |
char *wdir, *d; |
char repo[MAXPATHLEN]; |
|
struct cvs_recursion cr; |
struct cvs_recursion cr; |
struct module_checkout *mc; |
struct module_checkout *mc; |
|
struct cvs_ignpat *ip; |
|
struct cvs_filelist *fl, *nxt; |
|
char repo[MAXPATHLEN], fpath[MAXPATHLEN], *f[1]; |
|
|
build_dirs = print_stdout ? 0 : 1; |
build_dirs = print_stdout ? 0 : 1; |
|
|
|
|
mc = cvs_module_lookup(argv[i]); |
mc = cvs_module_lookup(argv[i]); |
current_module = mc; |
current_module = mc; |
|
|
(void)xsnprintf(repo, sizeof(repo), "%s/%s", |
TAILQ_FOREACH(fl, &(mc->mc_ignores), flist) |
current_cvsroot->cr_dir, mc->mc_repo); |
cvs_file_ignore(fl->file_path, &checkout_ign_pats); |
|
|
if (!(mc->mc_flags & MODULE_ALIAS) || dflag != NULL) |
TAILQ_FOREACH(fl, &(mc->mc_modules), flist) { |
module_repo_root = mc->mc_repo; |
(void)xsnprintf(repo, sizeof(repo), "%s/%s", |
|
current_cvsroot->cr_dir, fl->file_path); |
|
|
if (mc->mc_flags & MODULE_NORECURSE) |
if (!(mc->mc_flags & MODULE_ALIAS) || dflag != NULL) |
flags &= ~CR_RECURSE_DIRS; |
module_repo_root = fl->file_path; |
|
|
if (dflag != NULL) |
if (mc->mc_flags & MODULE_NORECURSE) |
wdir = dflag; |
flags &= ~CR_RECURSE_DIRS; |
else |
|
wdir = mc->mc_wdir; |
|
|
|
switch (checkout_classify(repo, mc->mc_repo)) { |
if (dflag != NULL) |
case CVS_FILE: |
wdir = dflag; |
cr.fileproc = cvs_update_local; |
else |
cr.flags = flags; |
wdir = mc->mc_wdir; |
|
|
if (build_dirs == 1) |
switch (checkout_classify(repo, fl->file_path)) { |
cvs_mkpath(dirname(wdir), |
case CVS_FILE: |
cvs_specified_tag); |
cr.fileproc = cvs_update_local; |
cvs_file_run(1, &(mc->mc_repo), &cr); |
cr.flags = flags; |
break; |
|
case CVS_DIR: |
if (!(mc->mc_flags & MODULE_ALIAS)) { |
if (build_dirs == 1) |
module_repo_root = |
cvs_mkpath(wdir, cvs_specified_tag); |
dirname(fl->file_path); |
checkout_repository(repo, wdir); |
d = wdir; |
break; |
(void)xsnprintf(fpath, sizeof(fpath), |
default: |
"%s/%s", d, |
break; |
basename(fl->file_path)); |
|
} else { |
|
d = dirname(wdir); |
|
strlcpy(fpath, fl->file_path, |
|
sizeof(fpath)); |
|
} |
|
|
|
if (build_dirs == 1) |
|
cvs_mkpath(d, cvs_specified_tag); |
|
|
|
f[0] = fpath; |
|
cvs_file_run(1, f, &cr); |
|
break; |
|
case CVS_DIR: |
|
if (build_dirs == 1) |
|
cvs_mkpath(wdir, cvs_specified_tag); |
|
checkout_repository(repo, wdir); |
|
break; |
|
default: |
|
break; |
|
} |
} |
} |
|
|
|
if (mc->mc_canfree == 1) { |
|
for (fl = TAILQ_FIRST(&(mc->mc_modules)); |
|
fl != TAILQ_END(&(mc->mc_modules)); fl = nxt) { |
|
nxt = TAILQ_NEXT(fl, flist); |
|
TAILQ_REMOVE(&(mc->mc_modules), fl, flist); |
|
xfree(fl->file_path); |
|
xfree(fl); |
|
} |
|
} |
|
|
|
while ((ip = TAILQ_FIRST(&checkout_ign_pats)) != NULL) { |
|
TAILQ_REMOVE(&checkout_ign_pats, ip, ip_list); |
|
xfree(ip); |
|
} |
|
|
xfree(mc->mc_wdir); |
xfree(mc->mc_wdir); |
xfree(mc->mc_repo); |
|
xfree(mc); |
xfree(mc); |
} |
} |
} |
} |
|
|
struct stat sb; |
struct stat sb; |
|
|
if (stat(repo, &sb) == 0) { |
if (stat(repo, &sb) == 0) { |
if (!S_ISDIR(sb.st_mode)) { |
if (S_ISDIR(sb.st_mode)) |
cvs_log(LP_ERR, "ignoring %s: not a directory", arg); |
return CVS_DIR; |
return 0; |
|
} |
|
return CVS_DIR; |
|
} |
} |
|
|
d = dirname(repo); |
d = dirname(repo); |