summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/cvs/annotate.c19
-rw-r--r--usr.bin/cvs/cvs.c4
2 files changed, 18 insertions, 5 deletions
diff --git a/usr.bin/cvs/annotate.c b/usr.bin/cvs/annotate.c
index 755b4b0f3fd..fc7d545afa7 100644
--- a/usr.bin/cvs/annotate.c
+++ b/usr.bin/cvs/annotate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: annotate.c,v 1.3 2004/12/21 18:32:09 jfb Exp $ */
+/* $OpenBSD: annotate.c,v 1.4 2005/01/13 16:32:46 jfb Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -54,19 +54,23 @@ int cvs_annotate_prune (CVSFILE *, void *);
int
cvs_annotate(int argc, char **argv)
{
- int i, ch, flags;
+ int i, ch, flags, usehead;
char *date, *rev;
struct cvsroot *root;
+ usehead = 0;
date = NULL;
rev = NULL;
flags = CF_SORT|CF_RECURSE|CF_IGNORE|CF_NOSYMS;
- while ((ch = getopt(argc, argv, "D:FflRr:")) != -1) {
+ while ((ch = getopt(argc, argv, "D:flRr:")) != -1) {
switch (ch) {
case 'D':
date = optarg;
break;
+ case 'f':
+ usehead = 1;
+ break;
case 'l':
flags &= ~CF_RECURSE;
break;
@@ -74,12 +78,19 @@ cvs_annotate(int argc, char **argv)
flags |= CF_RECURSE;
break;
case 'r':
+ rev = optarg;
break;
default:
return (EX_USAGE);
}
}
+ if ((date != NULL) && (rev != NULL)) {
+ cvs_log(LP_ERR,
+ "the -D and -d arguments are mutually exclusive");
+ return (EX_USAGE);
+ }
+
argc -= optind;
argv += optind;
@@ -105,6 +116,8 @@ cvs_annotate(int argc, char **argv)
if (root->cr_method != CVS_METHOD_LOCAL) {
if (cvs_connect(root) < 0)
return (EX_PROTOCOL);
+ if (usehead && (cvs_sendarg(root, "-f", 0) < 0))
+ return (EX_PROTOCOL);
if (rev != NULL) {
if ((cvs_sendarg(root, "-r", 0) < 0) ||
(cvs_sendarg(root, rev, 0) < 0))
diff --git a/usr.bin/cvs/cvs.c b/usr.bin/cvs/cvs.c
index b9b518872f2..c9ef8cf5d6c 100644
--- a/usr.bin/cvs/cvs.c
+++ b/usr.bin/cvs/cvs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cvs.c,v 1.31 2005/01/06 20:39:27 jfb Exp $ */
+/* $OpenBSD: cvs.c,v 1.32 2005/01/13 16:32:46 jfb Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -110,7 +110,7 @@ static struct cvs_cmd {
},
{
CVS_OP_ANNOTATE, "annotate", { "ann" }, cvs_annotate,
- "[-FflR] [-D date | -r rev] file ...",
+ "[-flR] [-D date | -r rev] file ...",
"",
"Show last revision where each line was modified",
NULL,