diff options
author | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2007-09-09 20:24:07 +0000 |
---|---|---|
committer | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2007-09-09 20:24:07 +0000 |
commit | 2ad8d3f46733b834de0721fb66f614b14c69dad6 (patch) | |
tree | b5ce7b47b9e9f7cd3c9b1a20c1242c70cc9528eb /usr.bin | |
parent | a5a6796bd372b58d4d32de71502d4a39a46b9262 (diff) |
Added support for checkout -p with local repository.
OK joris@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cvs/checkout.c | 14 | ||||
-rw-r--r-- | usr.bin/cvs/file.c | 17 | ||||
-rw-r--r-- | usr.bin/cvs/util.c | 12 |
3 files changed, 32 insertions, 11 deletions
diff --git a/usr.bin/cvs/checkout.c b/usr.bin/cvs/checkout.c index 9a4be099be2..aaa18bc6752 100644 --- a/usr.bin/cvs/checkout.c +++ b/usr.bin/cvs/checkout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: checkout.c,v 1.101 2007/09/07 23:05:04 joris Exp $ */ +/* $OpenBSD: checkout.c,v 1.102 2007/09/09 20:24:06 tobias Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -141,6 +141,8 @@ checkout_check_repository(int argc, char **argv) struct stat st; struct cvs_recursion cr; + build_dirs = print_stdout ? 0 : 1; + if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) { cvs_client_connect_to_server(); @@ -161,7 +163,7 @@ checkout_check_repository(int argc, char **argv) cr.enterdir = NULL; cr.leavedir = NULL; - cr.fileproc = cvs_client_sendfile; + cr.fileproc = NULL; cr.flags = flags; cvs_file_run(argc, argv, &cr); @@ -194,13 +196,16 @@ checkout_check_repository(int argc, char **argv) cr.fileproc = cvs_update_local; cr.flags = flags; - cvs_mkpath(dirname(argv[i]), cvs_specified_tag); + + if (build_dirs == 1) + cvs_mkpath(dirname(argv[i]), cvs_specified_tag); cvs_file_run(1, &(argv[i]), &cr); continue; } - cvs_mkpath(argv[i], cvs_specified_tag); + if (build_dirs == 1) + cvs_mkpath(argv[i], cvs_specified_tag); checkout_repository(repo, argv[i]); } } @@ -217,7 +222,6 @@ checkout_repository(const char *repobase, const char *wdbase) cvs_history_add((cvs_cmdop == CVS_OP_CHECKOUT) ? CVS_HISTORY_CHECKOUT : CVS_HISTORY_EXPORT, NULL, wdbase); - build_dirs = 1; cr.enterdir = cvs_update_enterdir; cr.leavedir = cvs_update_leavedir; cr.fileproc = cvs_update_local; diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c index ba15fcbea7e..48e3c5f832c 100644 --- a/usr.bin/cvs/file.c +++ b/usr.bin/cvs/file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: file.c,v 1.195 2007/09/07 23:30:30 tobias Exp $ */ +/* $OpenBSD: file.c,v 1.196 2007/09/09 20:24:06 tobias Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> @@ -42,6 +42,8 @@ #define CVS_CHAR_ISMETA(c) ((c == '*') || (c == '?') || (c == '[')) +extern int print_stdout; + /* * Standard patterns to ignore. */ @@ -269,10 +271,15 @@ cvs_file_walklist(struct cvs_flisthead *fl, struct cvs_recursion *cr) goto next; } } else if (current_cvsroot->cr_method == CVS_METHOD_LOCAL) { - if (stat(d, &st) == -1) { - cvs_log(LP_ERRNO, "%s", d); - goto next; - } + /* + * During checkout -p, do not use any locally + * available directories. + */ + if (cvs_cmdop != CVS_OP_CHECKOUT || !print_stdout) + if (stat(d, &st) == -1) { + cvs_log(LP_ERRNO, "%s", d); + goto next; + } cvs_get_repository_path(d, repo, MAXPATHLEN); (void)xsnprintf(fpath, MAXPATHLEN, "%s/%s", diff --git a/usr.bin/cvs/util.c b/usr.bin/cvs/util.c index 12a55fcbf1c..7d4472ea838 100644 --- a/usr.bin/cvs/util.c +++ b/usr.bin/cvs/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.115 2007/09/04 19:07:04 tobias Exp $ */ +/* $OpenBSD: util.c,v 1.116 2007/09/09 20:24:06 tobias Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org> @@ -38,6 +38,8 @@ #include "cvs.h" #include "remote.h" +extern int print_stdout; + /* letter -> mode type map */ static const int cvs_modetypes[26] = { -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, @@ -502,6 +504,14 @@ cvs_get_repository_name(const char *dir, char *dst, size_t len) FILE *fp; char *s, fpath[MAXPATHLEN]; + /* During checkout -p, do not use any locally available files. */ + if (cvs_cmdop == CVS_OP_CHECKOUT && print_stdout) { + dst[0] = '\0'; + if (strlcat(dst, dir, len) >= len) + fatal("cvs_get_repository_name: truncation"); + return; + } + (void)xsnprintf(fpath, sizeof(fpath), "%s/%s", dir, CVS_PATH_REPOSITORY); |