summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2008-02-03 18:42:33 +0000
committerJoris Vink <joris@cvs.openbsd.org>2008-02-03 18:42:33 +0000
commit53aeb77e667dd45393c814c79e6a97af2dc43688 (patch)
treedb7571aec5922b3ceacd81f81ee561fdaf23c4a8
parent596d463f3adebfac3f5ca7c83e6e8130fd1e39fb (diff)
with the recent changes for CVSROOT/modules we can now support the
basics of checkout -d. Multiple modules with -d is still "not supported". example: $ opencvs -d /cvs co -d kernel_source_3_0 -rOPENBSD_3_0 ksrc yes, it rocks. ok tobias@
-rw-r--r--usr.bin/cvs/checkout.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/usr.bin/cvs/checkout.c b/usr.bin/cvs/checkout.c
index 56a5f22cc39..9ec4e1c97b7 100644
--- a/usr.bin/cvs/checkout.c
+++ b/usr.bin/cvs/checkout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: checkout.c,v 1.119 2008/02/03 17:20:14 joris Exp $ */
+/* $OpenBSD: checkout.c,v 1.120 2008/02/03 18:42:32 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -39,6 +39,7 @@ extern int prune_dirs;
extern int build_dirs;
static int flags = CR_REPO | CR_RECURSE_DIRS;
+static char *dflag = NULL;
struct cvs_cmd cvs_cmd_checkout = {
CVS_OP_CHECKOUT, CVS_USE_WDIR, "checkout",
@@ -71,6 +72,11 @@ cvs_checkout(int argc, char **argv)
case 'A':
reset_stickies = 1;
break;
+ case 'd':
+ if (dflag != NULL)
+ fatal("-d specified two or more times");
+ dflag = optarg;
+ break;
case 'l':
flags &= ~CR_RECURSE_DIRS;
break;
@@ -147,6 +153,7 @@ static void
checkout_check_repository(int argc, char **argv)
{
int i;
+ char *wdir;
char repo[MAXPATHLEN];
struct cvs_recursion cr;
struct module_checkout *mc;
@@ -204,23 +211,28 @@ checkout_check_repository(int argc, char **argv)
(void)xsnprintf(repo, sizeof(repo), "%s/%s",
current_cvsroot->cr_dir, mc->mc_repo);
- if (!(mc->mc_flags & MODULE_ALIAS))
+ if (!(mc->mc_flags & MODULE_ALIAS) || dflag != NULL)
module_repo_root = mc->mc_repo;
+ if (dflag != NULL)
+ wdir = dflag;
+ else
+ wdir = mc->mc_wdir;
+
switch (checkout_classify(repo, mc->mc_repo)) {
case CVS_FILE:
cr.fileproc = cvs_update_local;
cr.flags = flags;
if (build_dirs == 1)
- cvs_mkpath(dirname(mc->mc_wdir),
+ cvs_mkpath(dirname(wdir),
cvs_specified_tag);
cvs_file_run(1, &(mc->mc_repo), &cr);
break;
case CVS_DIR:
if (build_dirs == 1)
- cvs_mkpath(mc->mc_wdir, cvs_specified_tag);
- checkout_repository(repo, mc->mc_wdir);
+ cvs_mkpath(wdir, cvs_specified_tag);
+ checkout_repository(repo, wdir);
break;
default:
break;