summaryrefslogtreecommitdiff
path: root/usr.bin/cvs
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@cvs.openbsd.org>2008-02-01 17:19:00 +0000
committerTobias Stoeckmann <tobias@cvs.openbsd.org>2008-02-01 17:19:00 +0000
commitaf82a991d0327114da1b142bbfae5e57aa558095 (patch)
tree4308e8aa255c02238c85afaa4254cefa6eaaffa8 /usr.bin/cvs
parent188c53eb8b603b04e09d6a50cde302943b84ff34 (diff)
Added rannotate support
OK xsa@
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r--usr.bin/cvs/annotate.c36
-rw-r--r--usr.bin/cvs/client.c4
-rw-r--r--usr.bin/cvs/cmd.c3
-rw-r--r--usr.bin/cvs/cvs.h3
-rw-r--r--usr.bin/cvs/remote.h3
-rw-r--r--usr.bin/cvs/server.c14
6 files changed, 51 insertions, 12 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();
}
diff --git a/usr.bin/cvs/client.c b/usr.bin/cvs/client.c
index 8f6c2e72af6..d2e0242b723 100644
--- a/usr.bin/cvs/client.c
+++ b/usr.bin/cvs/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.93 2008/01/31 22:09:05 xsa Exp $ */
+/* $OpenBSD: client.c,v 1.94 2008/02/01 17:18:59 tobias Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -110,7 +110,7 @@ struct cvs_req cvs_requests[] = {
{ "init", 0, cvs_server_init, 0 },
{ "annotate", 0, cvs_server_annotate,
REQ_NEEDDIR },
- { "rannotate", 0, NULL, 0 },
+ { "rannotate", 0, cvs_server_rannotate, 0 },
{ "noop", 0, NULL, 0 },
{ "version", 0, cvs_server_version, 0 },
{ "", -1, NULL, 0 }
diff --git a/usr.bin/cvs/cmd.c b/usr.bin/cvs/cmd.c
index 0415b872001..9be8354dd49 100644
--- a/usr.bin/cvs/cmd.c
+++ b/usr.bin/cvs/cmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd.c,v 1.66 2008/01/21 16:40:04 tobias Exp $ */
+/* $OpenBSD: cmd.c,v 1.67 2008/02/01 17:18:59 tobias Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
@@ -42,6 +42,7 @@ struct cvs_cmd *cvs_cdt[] = {
&cvs_cmd_import,
&cvs_cmd_init,
&cvs_cmd_log,
+ &cvs_cmd_rannotate,
&cvs_cmd_release,
&cvs_cmd_remove,
&cvs_cmd_rlog,
diff --git a/usr.bin/cvs/cvs.h b/usr.bin/cvs/cvs.h
index 7f4751c03b0..b50bf72191a 100644
--- a/usr.bin/cvs/cvs.h
+++ b/usr.bin/cvs/cvs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cvs.h,v 1.149 2008/01/31 10:15:05 tobias Exp $ */
+/* $OpenBSD: cvs.h,v 1.150 2008/02/01 17:18:59 tobias Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -332,6 +332,7 @@ extern struct cvs_cmd cvs_cmd_history;
extern struct cvs_cmd cvs_cmd_import;
extern struct cvs_cmd cvs_cmd_init;
extern struct cvs_cmd cvs_cmd_log;
+extern struct cvs_cmd cvs_cmd_rannotate;
extern struct cvs_cmd cvs_cmd_rdiff;
extern struct cvs_cmd cvs_cmd_release;
extern struct cvs_cmd cvs_cmd_remove;
diff --git a/usr.bin/cvs/remote.h b/usr.bin/cvs/remote.h
index f351e151a94..79a867c3c93 100644
--- a/usr.bin/cvs/remote.h
+++ b/usr.bin/cvs/remote.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: remote.h,v 1.28 2008/01/21 16:36:46 tobias Exp $ */
+/* $OpenBSD: remote.h,v 1.29 2008/02/01 17:18:59 tobias Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -104,6 +104,7 @@ void cvs_server_diff(char *);
void cvs_server_export(char *);
void cvs_server_init(char *);
void cvs_server_log(char *);
+void cvs_server_rannotate(char *);
void cvs_server_release(char *);
void cvs_server_remove(char *);
void cvs_server_rlog(char *);
diff --git a/usr.bin/cvs/server.c b/usr.bin/cvs/server.c
index 1f2919b31de..6229633748e 100644
--- a/usr.bin/cvs/server.c
+++ b/usr.bin/cvs/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.79 2008/01/31 22:09:05 xsa Exp $ */
+/* $OpenBSD: server.c,v 1.80 2008/02/01 17:18:59 tobias Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -546,6 +546,18 @@ cvs_server_annotate(char *data)
}
void
+cvs_server_rannotate(char *data)
+{
+ if (chdir(server_currentdir) == -1)
+ fatal("cvs_server_rannotate: %s", strerror(errno));
+
+ cvs_cmdop = CVS_OP_RANNOTATE;
+ cmdp->cmd_flags = cvs_cmd_rannotate.cmd_flags;
+ cvs_annotate(server_argc, server_argv);
+ cvs_server_send_response("ok");
+}
+
+void
cvs_server_commit(char *data)
{
if (chdir(server_currentdir) == -1)