summaryrefslogtreecommitdiffstats
path: root/usr.bin/cvs/annotate.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/cvs/annotate.c')
-rw-r--r--usr.bin/cvs/annotate.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/usr.bin/cvs/annotate.c b/usr.bin/cvs/annotate.c
index bc878f7ec18..6c834d63aae 100644
--- a/usr.bin/cvs/annotate.c
+++ b/usr.bin/cvs/annotate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: annotate.c,v 1.46 2008/02/01 13:36:43 tobias Exp $ */
+/* $OpenBSD: annotate.c,v 1.47 2008/02/01 17:18:59 tobias Exp $ */
/*
* Copyright (c) 2007 Tobias Stoeckmann <tobias@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -19,6 +19,7 @@
#include <sys/param.h>
#include <sys/dirent.h>
+#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
@@ -43,6 +44,16 @@ struct cvs_cmd cvs_cmd_annotate = {
cvs_annotate
};
+struct cvs_cmd cvs_cmd_rannotate = {
+ CVS_OP_RANNOTATE, 0, "rannotate",
+ { "rann", "ra" },
+ "Show last revision where each line was modified",
+ "[-flR] [-D date | -r rev] [file ...]",
+ "D:flRr:",
+ NULL,
+ cvs_annotate
+};
+
int
cvs_annotate(int argc, char **argv)
{
@@ -76,6 +87,9 @@ cvs_annotate(int argc, char **argv)
argc -= optind;
argv += optind;
+ if (cvs_cmdop == CVS_OP_RANNOTATE)
+ flags |= CR_REPO;
+
cr.enterdir = NULL;
cr.leavedir = NULL;
@@ -93,20 +107,30 @@ cvs_annotate(int argc, char **argv)
cvs_client_send_request("Argument -r%s",
cvs_specified_tag);
} else {
+ if (cvs_cmdop == CVS_OP_RANNOTATE &&
+ chdir(current_cvsroot->cr_dir) == -1)
+ fatal("cvs_annotate: %s", strerror(errno));
+
cr.fileproc = cvs_annotate_local;
}
cr.flags = flags;
- if (argc > 0)
- cvs_file_run(argc, argv, &cr);
- else
- cvs_file_run(1, &arg, &cr);
+ if (cvs_cmdop == CVS_OP_ANNOTATE ||
+ current_cvsroot->cr_method == CVS_METHOD_LOCAL) {
+ if (argc > 0)
+ cvs_file_run(argc, argv, &cr);
+ else
+ cvs_file_run(1, &arg, &cr);
+ }
if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
cvs_client_send_files(argv, argc);
cvs_client_senddir(".");
- cvs_client_send_request("annotate");
+
+ cvs_client_send_request((cvs_cmdop == CVS_OP_RANNOTATE) ?
+ "rannotate" : "annotate");
+
cvs_client_get_responses();
}