diff options
author | Jean-Francois Brousseau <jfb@cvs.openbsd.org> | 2005-01-14 18:02:05 +0000 |
---|---|---|
committer | Jean-Francois Brousseau <jfb@cvs.openbsd.org> | 2005-01-14 18:02:05 +0000 |
commit | 909f6e4c00ca5685ea736412dc2629a3004d8e18 (patch) | |
tree | 528d816bc148b10c0437fd555b353928b228d45c /usr.bin | |
parent | 64b5ec0b92f7de35a1b7dff271a54cd6bc8d6608 (diff) |
support the -D option to the tag command and sync usage for the tag
command
from Joris Vink, with modifications by me
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cvs/cvs.c | 4 | ||||
-rw-r--r-- | usr.bin/cvs/tag.c | 29 |
2 files changed, 25 insertions, 8 deletions
diff --git a/usr.bin/cvs/cvs.c b/usr.bin/cvs/cvs.c index 853cfb6a340..2b17f56d9ca 100644 --- a/usr.bin/cvs/cvs.c +++ b/usr.bin/cvs/cvs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cvs.c,v 1.34 2005/01/13 23:39:42 jfb Exp $ */ +/* $OpenBSD: cvs.c,v 1.35 2005/01/14 18:02:04 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -260,7 +260,7 @@ static struct cvs_cmd { }, { CVS_OP_TAG, "tag", { "ta", "freeze" }, cvs_tag, - "", + "[-bdl] [-D date | -r rev] tagname", "", "Add a symbolic tag to checked out version of files", NULL, diff --git a/usr.bin/cvs/tag.c b/usr.bin/cvs/tag.c index 19d3bfe102b..67c2ed8a32c 100644 --- a/usr.bin/cvs/tag.c +++ b/usr.bin/cvs/tag.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tag.c,v 1.2 2004/12/14 22:30:48 jfb Exp $ */ +/* $OpenBSD: tag.c,v 1.3 2005/01/14 18:02:04 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * Copyright (c) 2004 Joris Vink <amni@pandora.be> @@ -55,14 +55,14 @@ cvs_tag(int argc, char **argv) { int ch, flags; struct cvsroot *root; - char *tag, *old_tag; + char *tag, *old_tag, *date; int branch, delete; - old_tag = NULL; + date = old_tag = NULL; branch = delete = 0; flags = CF_SORT|CF_IGNORE|CF_RECURSE; - while ((ch = getopt(argc, argv, "bdlr:")) != -1) { + while ((ch = getopt(argc, argv, "bdD:lr:")) != -1) { switch (ch) { case 'b': branch = 1; @@ -70,6 +70,9 @@ cvs_tag(int argc, char **argv) case 'd': delete = 1; break; + case 'D': + date = optarg; + break; case 'l': flags &= ~CF_RECURSE; break; @@ -100,6 +103,14 @@ cvs_tag(int argc, char **argv) if (delete && old_tag) old_tag = NULL; + if (delete && date) + date = NULL; + + if (old_tag != NULL && date != NULL) { + cvs_log(LP_ERROR, "-r and -D options are mutually exclusive"); + return (-1); + } + if (argc == 0) cvs_files = cvs_file_get(".", flags); else @@ -124,8 +135,14 @@ cvs_tag(int argc, char **argv) if (delete && (cvs_sendarg(root, "-d", 0) < 0)) return (EX_PROTOCOL); if (old_tag) { - cvs_sendarg(root, "-r", 0); - cvs_sendarg(root, old_tag, 0); + if ((cvs_sendarg(root, "-r", 0) < 0) || + (cvs_sendarg(root, old_tag, 0) < 0)) + return (EX_PROTOCOL); + } + if (date) { + if ((cvs_sendarg(root, "-D", 0) < 0) || + (cvs_sendarg(root, date, 0) < 0)) + return (EX_PROTOCOL); } if (cvs_sendarg(root, tag, 0) < 0) return (EX_PROTOCOL); |