summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/checkout.c17
-rw-r--r--usr.bin/cvs/cvs.h5
-rw-r--r--usr.bin/cvs/file.c6
-rw-r--r--usr.bin/cvs/update.c26
4 files changed, 35 insertions, 19 deletions
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);