summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2006-05-27 16:10:02 +0000
committerJoris Vink <joris@cvs.openbsd.org>2006-05-27 16:10:02 +0000
commit36456f28c28a12cc5fd74b09f3512afcce17d8b5 (patch)
treede137efb93374a21b8fc8b0b76e8e8d67370681b /usr.bin
parent14ffcf0ce845fafd23e66a9ee05f0c592cf6bb99 (diff)
support the -d flag for update.
if you specify -d when running update new directories will be build, otherwise they will be skipped.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/checkout.c4
-rw-r--r--usr.bin/cvs/update.c13
2 files changed, 14 insertions, 3 deletions
diff --git a/usr.bin/cvs/checkout.c b/usr.bin/cvs/checkout.c
index c14c50e458f..187eb933b78 100644
--- a/usr.bin/cvs/checkout.c
+++ b/usr.bin/cvs/checkout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: checkout.c,v 1.56 2006/05/27 15:14:27 joris Exp $ */
+/* $OpenBSD: checkout.c,v 1.57 2006/05/27 16:10:01 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -26,6 +26,7 @@ int cvs_checkout(int, char **);
static void checkout_repository(const char *, const char *);
extern int prune_dirs;
+extern int build_dirs;
struct cvs_cmd cvs_cmd_checkout = {
CVS_OP_CHECKOUT, CVS_REQ_CO, "checkout",
@@ -90,6 +91,7 @@ checkout_repository(const char *repobase, const char *wdbase)
TAILQ_INIT(&fl);
TAILQ_INIT(&dl);
+ build_dirs = 1;
cr.enterdir = cvs_update_enterdir;
cr.leavedir = cvs_update_leavedir;
cr.local = cvs_update_local;
diff --git a/usr.bin/cvs/update.c b/usr.bin/cvs/update.c
index 80d6b12b9c6..9e76edaee0e 100644
--- a/usr.bin/cvs/update.c
+++ b/usr.bin/cvs/update.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: update.c,v 1.62 2006/05/27 15:53:01 joris Exp $ */
+/* $OpenBSD: update.c,v 1.63 2006/05/27 16:10:01 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -24,6 +24,9 @@
int cvs_update(int, char **);
int prune_dirs = 0;
+int build_dirs = 0;
+
+#define UPDATE_SKIP 100
struct cvs_cmd cvs_cmd_update = {
CVS_OP_UPDATE, CVS_REQ_UPDATE, "update",
@@ -54,6 +57,7 @@ cvs_update(int argc, char **argv)
case 'D':
break;
case 'd':
+ build_dirs = 1;
break;
case 'f':
break;
@@ -111,7 +115,7 @@ cvs_update_enterdir(struct cvs_file *cf)
cvs_file_classify(cf);
- if (cf->file_status == DIR_CREATE) {
+ if (cf->file_status == DIR_CREATE && build_dirs == 1) {
cvs_mkpath(cf->file_path);
if ((cf->fd = open(cf->file_path, O_RDONLY)) == -1)
fatal("cvs_update_enterdir: %s", strerror(errno));
@@ -126,6 +130,8 @@ cvs_update_enterdir(struct cvs_file *cf)
cvs_ent_add(entlist, entry);
cvs_ent_close(entlist, ENT_SYNC);
xfree(entry);
+ } else if (cf->file_status == DIR_CREATE && build_dirs == 0) {
+ cf->file_status = UPDATE_SKIP;
}
}
@@ -219,6 +225,9 @@ cvs_update_local(struct cvs_file *cf)
cvs_log(LP_TRACE, "cvs_update_local(%s)", cf->file_path);
if (cf->file_type == CVS_DIR) {
+ if (cf->file_status == UPDATE_SKIP)
+ return;
+
if (cf->file_status != FILE_UNKNOWN &&
verbosity > 1)
cvs_log(LP_NOTICE, "Updating %s", cf->file_path);