diff options
-rw-r--r-- | regress/usr.bin/cvs/Makefile | 31 | ||||
-rw-r--r-- | usr.bin/cvs/checkout.c | 17 | ||||
-rw-r--r-- | usr.bin/cvs/cvs.h | 5 | ||||
-rw-r--r-- | usr.bin/cvs/file.c | 6 | ||||
-rw-r--r-- | usr.bin/cvs/update.c | 26 |
5 files changed, 63 insertions, 22 deletions
diff --git a/regress/usr.bin/cvs/Makefile b/regress/usr.bin/cvs/Makefile index 4615251fc7e..fed3f54251f 100644 --- a/regress/usr.bin/cvs/Makefile +++ b/regress/usr.bin/cvs/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.19 2008/02/07 16:16:57 tobias Exp $ +# $OpenBSD: Makefile,v 1.20 2008/02/09 12:20:33 tobias Exp $ # Regression tests by Niall O'Higgins <niallo@openbsd.org> and # Tobias Stoeckmann <tobias@openbsd.org>. @@ -36,6 +36,9 @@ LTESTS= cvs-initial \ cvs-annotate-rflag-inval_branch_rev-fflag \ cvs-annotate-rflag-unknown_symbol-fflag \ cvs-checkout-kflag-kv-rflag-1.1 \ + cvs-update-Aflag-kflag-kv \ + cvs-update-Aflag-kflag-k-rflag-1.1 \ + cvs-update-Aflag-rflag-1.1 \ cvs-update-Aflag \ cvs-status \ cvs-diff \ @@ -265,14 +268,36 @@ test-cvs-rtag-one_more_branch: @grep SECOND_BRANCH ${.OBJDIR}/regress_cvs_root/seed/seed2.txt,v \ | grep 4 > /dev/null -# XXX - Output is not GNU conform test-cvs-update-Aflag: @cd ${.OBJDIR}/regress_cvs_wcopy/seed; \ ${CVS} -Q update -A > /dev/null -# eval 'test `${CVS} -q update -A | wc -l` -eq 1' @eval 'test `grep -c -e T1 -e kkv \ ${.OBJDIR}/regress_cvs_wcopy/seed/CVS/Entries` -eq 0' +test-cvs-update-Aflag-kflag-kv: + @cd ${.OBJDIR}/regress_cvs_wcopy/seed; \ + ${CVS} -Q update -A -kv > /dev/null + @eval 'test `grep -c T1 \ + ${.OBJDIR}/regress_cvs_wcopy/seed/CVS/Entries` -eq 0' + @eval 'test `grep -c kv \ + ${.OBJDIR}/regress_cvs_wcopy/seed/CVS/Entries` -eq 2' + +test-cvs-update-Aflag-kflag-k-rflag-1.1: + @cd ${.OBJDIR}/regress_cvs_wcopy/seed; \ + ${CVS} -Q update -A -kk -r 1.1 > /dev/null + @eval 'test `grep -c T1 \ + ${.OBJDIR}/regress_cvs_wcopy/seed/CVS/Entries` -eq 2' + @eval 'test `grep -c kk \ + ${.OBJDIR}/regress_cvs_wcopy/seed/CVS/Entries` -eq 2' + +test-cvs-update-Aflag-rflag-1.1: + @cd ${.OBJDIR}/regress_cvs_wcopy/seed; \ + ${CVS} -Q update -A -r 1.1 > /dev/null + @eval 'test `grep -c T1 \ + ${.OBJDIR}/regress_cvs_wcopy/seed/CVS/Entries` -eq 2' + @eval 'test `grep -c kk \ + ${.OBJDIR}/regress_cvs_wcopy/seed/CVS/Entries` -eq 0' + test-cvs-update-for_subdir: @echo "test-cvs-update-for_subdir" @cd ${.OBJDIR}/regress_cvs_wcopy/seed; \ diff --git a/usr.bin/cvs/checkout.c b/usr.bin/cvs/checkout.c index bd1ee99a426..39763e53ec4 100644 --- a/usr.bin/cvs/checkout.c +++ b/usr.bin/cvs/checkout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: checkout.c,v 1.131 2008/02/09 11:17:02 tobias Exp $ */ +/* $OpenBSD: checkout.c,v 1.132 2008/02/09 12:20:33 tobias Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -40,6 +40,7 @@ extern int prune_dirs; extern int build_dirs; static int flags = CR_REPO | CR_RECURSE_DIRS; +static int Aflag = 0; static char *dflag = NULL; static char *koptstr = NULL; @@ -76,7 +77,11 @@ cvs_checkout(int argc, char **argv) while ((ch = getopt(argc, argv, cvs_cmd_checkout.cmd_opts)) != -1) { switch (ch) { case 'A': - reset_stickies = 1; + Aflag = 1; + if (koptstr == NULL) + reset_option = 1; + if (cvs_specified_tag == NULL) + reset_tag = 1; break; case 'c': cvs_modules_list(); @@ -90,6 +95,7 @@ cvs_checkout(int argc, char **argv) dflag = optarg; break; case 'k': + reset_option = 0; koptstr = optarg; kflag = rcs_kflag_get(koptstr); if (RCS_KWEXP_INVAL(kflag)) { @@ -119,6 +125,7 @@ cvs_checkout(int argc, char **argv) flags |= CR_RECURSE_DIRS; break; case 'r': + reset_tag = 0; cvs_specified_tag = optarg; break; default: @@ -202,7 +209,7 @@ checkout_check_repository(int argc, char **argv) if (cvs_specified_tag != NULL) cvs_client_send_request("Argument -r%s", cvs_specified_tag); - if (reset_stickies == 1) + if (Aflag) cvs_client_send_request("Argument -A"); if (kflag) @@ -483,7 +490,7 @@ cvs_checkout_file(struct cvs_file *cf, RCSNUM *rnum, char *tag, int co_flags) (void)xsnprintf(sticky, sizeof(sticky), "T%s", tag); else (void)xsnprintf(sticky, sizeof(sticky), "T%s", rev); - else if (!reset_stickies && cf->file_ent != NULL && + else if (!reset_tag && cf->file_ent != NULL && cf->file_ent->ce_tag != NULL) (void)xsnprintf(sticky, sizeof(sticky), "T%s", cf->file_ent->ce_tag); @@ -496,7 +503,7 @@ cvs_checkout_file(struct cvs_file *cf, RCSNUM *rnum, char *tag, int co_flags) if (kflag || cf_kflag != RCS_KWEXP_DEFAULT) (void)xsnprintf(kbuf, sizeof(kbuf), "-k%s", cf->file_rcs->rf_expand); - } else if (!reset_stickies && cf->file_ent != NULL) { + } else if (!reset_option && cf->file_ent != NULL) { if (cf->file_ent->ce_opts != NULL) strlcpy(kbuf, cf->file_ent->ce_opts, sizeof(kbuf)); } diff --git a/usr.bin/cvs/cvs.h b/usr.bin/cvs/cvs.h index 7eb4ed90a4a..8a42b56f167 100644 --- a/usr.bin/cvs/cvs.h +++ b/usr.bin/cvs/cvs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cvs.h,v 1.155 2008/02/09 11:17:02 tobias Exp $ */ +/* $OpenBSD: cvs.h,v 1.156 2008/02/09 12:20:33 tobias Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -319,7 +319,8 @@ extern int cvs_readonly; extern int cvs_readonlyfs; extern int cvs_error; extern int cvs_server_active; -extern int reset_stickies; +extern int reset_option; +extern int reset_tag; extern int kflag; extern struct cvs_cmd *cmdp; diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c index 9db785d4187..991a0f7d18d 100644 --- a/usr.bin/cvs/file.c +++ b/usr.bin/cvs/file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: file.c,v 1.218 2008/02/09 11:17:02 tobias Exp $ */ +/* $OpenBSD: file.c,v 1.219 2008/02/09 12:20:33 tobias Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> @@ -847,8 +847,8 @@ cvs_file_classify(struct cvs_file *cf, const char *tag) break; case CVS_ENT_REG: if (cf->file_rcs == NULL || cf->file_rcsrev == NULL || - rcsdead == 1 || (reset_stickies == 1 && - cf->in_attic == 1)|| (notag == 1 && tag != NULL)) { + rcsdead == 1 || (reset_tag == 1 && cf->in_attic == 1) || + (notag == 1 && tag != NULL)) { if (cf->fd == -1 && server_has_file == 0) { cvs_log(LP_NOTICE, "warning: %s's entry exists but" diff --git a/usr.bin/cvs/update.c b/usr.bin/cvs/update.c index 749b9eb0938..5b9a9b6545f 100644 --- a/usr.bin/cvs/update.c +++ b/usr.bin/cvs/update.c @@ -1,4 +1,4 @@ -/* $OpenBSD: update.c,v 1.123 2008/02/09 11:40:43 joris Exp $ */ +/* $OpenBSD: update.c,v 1.124 2008/02/09 12:20:33 tobias Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -29,10 +29,12 @@ int prune_dirs = 0; int print_stdout = 0; int build_dirs = 0; -int reset_stickies = 0; +int reset_option = 0; +int reset_tag = 0; char *cvs_specified_tag = NULL; static char *koptstr; +static int Aflag = 0; static void update_clear_conflict(struct cvs_file *); @@ -60,7 +62,11 @@ cvs_update(int argc, char **argv) while ((ch = getopt(argc, argv, cvs_cmd_update.cmd_opts)) != -1) { switch (ch) { case 'A': - reset_stickies = 1; + Aflag = 1; + if (koptstr == NULL) + reset_option = 1; + if (cvs_specified_tag == NULL) + reset_tag = 1; break; case 'C': case 'D': @@ -76,6 +82,7 @@ cvs_update(int argc, char **argv) case 'j': break; case 'k': + reset_option = 0; koptstr = optarg; kflag = rcs_kflag_get(koptstr); if (RCS_KWEXP_INVAL(kflag)) { @@ -101,6 +108,7 @@ cvs_update(int argc, char **argv) flags |= CR_RECURSE_DIRS; break; case 'r': + reset_tag = 0; cvs_specified_tag = optarg; break; case 'u': @@ -120,7 +128,7 @@ cvs_update(int argc, char **argv) flags |= CR_REPO; } else { cvs_client_connect_to_server(); - if (reset_stickies) + if (Aflag) cvs_client_send_request("Argument -A"); if (build_dirs) cvs_client_send_request("Argument -d"); @@ -186,7 +194,7 @@ cvs_update_enterdir(struct cvs_file *cf) } else if ((cf->file_status == DIR_CREATE && build_dirs == 0) || cf->file_status == FILE_UNKNOWN) { cf->file_status = FILE_SKIP; - } else if (reset_stickies == 1) { + } else if (reset_tag) { (void)xsnprintf(fpath, MAXPATHLEN, "%s/%s", cf->file_path, CVS_PATH_TAG); (void)unlink(fpath); @@ -323,7 +331,7 @@ cvs_update_local(struct cvs_file *cf) if ((cf->file_status == FILE_UPTODATE || cf->file_status == FILE_MODIFIED) && cf->file_ent != NULL && - cf->file_ent->ce_tag != NULL && reset_stickies == 1) { + cf->file_ent->ce_tag != NULL && reset_tag) { if (cf->file_status == FILE_MODIFIED) cf->file_status = FILE_MERGE; else @@ -361,7 +369,7 @@ cvs_update_local(struct cvs_file *cf) if (strcmp(kbuf, cf->file_ent->ce_opts)) cf->file_status = FILE_CHECKOUT; - } else if (reset_stickies) + } else if (reset_option) cf->file_status = FILE_CHECKOUT; } } @@ -392,9 +400,9 @@ cvs_update_local(struct cvs_file *cf) case FILE_LOST: case FILE_CHECKOUT: case FILE_PATCH: - if ((tag != NULL && reset_stickies != 1) || + if ((tag != NULL && !reset_tag) || (((cf->file_ent != NULL) && cf->file_ent->ce_tag != NULL) && - (reset_stickies != 1))) + !reset_tag)) flags = CO_SETSTICKY; cvs_checkout_file(cf, cf->file_rcsrev, tag, flags); |