summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorXavier Santolaria <xsa@cvs.openbsd.org>2006-10-31 15:23:41 +0000
committerXavier Santolaria <xsa@cvs.openbsd.org>2006-10-31 15:23:41 +0000
commit6b639b79a75b1008f80dc46d346769d66ea5d9d9 (patch)
tree34a5d5efee320683eb1daff337b45250c9d9a20e /usr.bin
parent3448b5f8fe160f08b3a81478b57cc347464d6745 (diff)
a step ahead in opencvs add|remove remote support.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/add.c23
-rw-r--r--usr.bin/cvs/client.c6
-rw-r--r--usr.bin/cvs/cvs.h4
-rw-r--r--usr.bin/cvs/remote.h4
-rw-r--r--usr.bin/cvs/remove.c45
-rw-r--r--usr.bin/cvs/server.c24
6 files changed, 85 insertions, 21 deletions
diff --git a/usr.bin/cvs/add.c b/usr.bin/cvs/add.c
index 4e917f112be..4de145ddfda 100644
--- a/usr.bin/cvs/add.c
+++ b/usr.bin/cvs/add.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: add.c,v 1.60 2006/07/01 12:02:06 reyk Exp $ */
+/* $OpenBSD: add.c,v 1.61 2006/10/31 15:23:40 xsa Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -21,10 +21,10 @@
#include "cvs.h"
#include "diff.h"
#include "log.h"
+#include "remote.h"
extern char *__progname;
-int cvs_add(int, char **);
void cvs_add_local(struct cvs_file *);
static void add_directory(struct cvs_file *);
@@ -70,10 +70,27 @@ cvs_add(int argc, char **argv)
cr.enterdir = NULL;
cr.leavedir = NULL;
- cr.fileproc = cvs_add_local;
+
+ if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ cr.fileproc = cvs_client_sendfile;
+
+ if (logmsg != NULL)
+ cvs_client_send_request("Argument -m%s", logmsg);
+ } else {
+ cr.fileproc = cvs_add_local;
+ }
+
cr.flags = flags;
cvs_file_run(argc, argv, &cr);
+
+ if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ cvs_client_send_files(argv, argc);
+ cvs_client_senddir(".");
+ cvs_client_send_request("add");
+ cvs_client_get_responses();
+ }
+
return (0);
}
diff --git a/usr.bin/cvs/client.c b/usr.bin/cvs/client.c
index 9989400bb7f..d28a6b9b5ca 100644
--- a/usr.bin/cvs/client.c
+++ b/usr.bin/cvs/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.14 2006/07/20 15:14:22 joris Exp $ */
+/* $OpenBSD: client.c,v 1.15 2006/10/31 15:23:40 xsa Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -76,8 +76,8 @@ struct cvs_req cvs_requests[] = {
{ "init", 0, NULL, 0 },
{ "update", 0, cvs_server_update, 0 },
{ "import", 0, NULL, 0 },
- { "add", 0, NULL, 0 },
- { "remove", 0, NULL, 0 },
+ { "add", 0, cvs_server_add, 0 },
+ { "remove", 0, cvs_server_remove, 0 },
{ "watch-on", 0, NULL, 0 },
{ "watch-off", 0, NULL, 0 },
{ "watch-add", 0, NULL, 0 },
diff --git a/usr.bin/cvs/cvs.h b/usr.bin/cvs/cvs.h
index e3c89d19db4..638a7497d19 100644
--- a/usr.bin/cvs/cvs.h
+++ b/usr.bin/cvs/cvs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cvs.h,v 1.116 2006/07/07 17:37:17 joris Exp $ */
+/* $OpenBSD: cvs.h,v 1.117 2006/10/31 15:23:40 xsa Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -361,8 +361,10 @@ int update_has_conflict_markers(struct cvs_file *);
#define CO_DUMP 0x04
/* commands */
+int cvs_add(int, char **);
int cvs_commit(int, char **);
int cvs_diff(int, char **);
+int cvs_remove(int, char **);
int cvs_status(int, char **);
int cvs_update(int, char **);
int cvs_getlog(int, char **);
diff --git a/usr.bin/cvs/remote.h b/usr.bin/cvs/remote.h
index 2d340d14408..942300d1d3e 100644
--- a/usr.bin/cvs/remote.h
+++ b/usr.bin/cvs/remote.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: remote.h,v 1.1 2006/07/07 17:37:17 joris Exp $ */
+/* $OpenBSD: remote.h,v 1.2 2006/10/31 15:23:40 xsa Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -71,8 +71,10 @@ void cvs_server_unchanged(char *);
void cvs_server_questionable(char *);
void cvs_server_argument(char *);
+void cvs_server_add(char *);
void cvs_server_commit(char *);
void cvs_server_diff(char *);
+void cvs_server_remove(char *);
void cvs_server_update(char *);
void cvs_server_status(char *);
void cvs_server_log(char *);
diff --git a/usr.bin/cvs/remove.c b/usr.bin/cvs/remove.c
index 6fcf934797f..af7f68ca688 100644
--- a/usr.bin/cvs/remove.c
+++ b/usr.bin/cvs/remove.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: remove.c,v 1.54 2006/06/19 05:05:17 joris Exp $ */
+/* $OpenBSD: remove.c,v 1.55 2006/10/31 15:23:40 xsa Exp $ */
/*
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
*
@@ -19,10 +19,10 @@
#include "cvs.h"
#include "log.h"
+#include "remote.h"
extern char *__progname;
-int cvs_remove(int, char **);
void cvs_remove_local(struct cvs_file *);
static int force_remove = 0;
@@ -68,7 +68,19 @@ cvs_remove(int argc, char **argv)
cr.enterdir = NULL;
cr.leavedir = NULL;
- cr.fileproc = cvs_remove_local;
+
+ if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ cr.fileproc = cvs_client_sendfile;
+
+ if (force_remove == 1)
+ cvs_client_send_request("Argument -f");
+
+ if (!(flags & CR_RECURSE_DIRS))
+ cvs_client_send_request("Argument -l");
+ } else {
+ cr.fileproc = cvs_remove_local;
+ }
+
cr.flags = flags;
if (argc > 0)
@@ -76,16 +88,25 @@ cvs_remove(int argc, char **argv)
else
cvs_file_run(1, &arg, &cr);
- if (existing != 0) {
- cvs_log(LP_ERR, "%d file(s) exist, remove them first",
- existing);
- }
+ if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ cvs_client_send_files(argv, argc);
+ cvs_client_senddir(".");
+ cvs_client_send_request("remove");
+ cvs_client_get_responses();
+ } else {
+ if (existing != 0) {
+ cvs_log(LP_ERR, "%d file(s) exist, remove them first",
+ existing);
+ }
- if (removed != 0) {
- if (verbosity > 1)
- cvs_log(LP_NOTICE, "use '%s commit' to remove %s "
- "permanently", __progname, (removed > 1) ?
- "these files" : "this file");
+ if (removed != 0) {
+ if (verbosity > 1) {
+ cvs_log(LP_NOTICE,
+ "use '%s commit' to remove %s "
+ "permanently", __progname, (removed > 1) ?
+ "these files" : "this file");
+ }
+ }
}
return (0);
diff --git a/usr.bin/cvs/server.c b/usr.bin/cvs/server.c
index 4c209842314..5bc1cc06381 100644
--- a/usr.bin/cvs/server.c
+++ b/usr.bin/cvs/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.30 2006/07/09 01:47:20 joris Exp $ */
+/* $OpenBSD: server.c,v 1.31 2006/10/31 15:23:40 xsa Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -378,6 +378,17 @@ cvs_server_argument(char *data)
}
void
+cvs_server_add(char *data)
+{
+ if (chdir(server_currentdir) == -1)
+ fatal("cvs_server_add: %s", strerror(errno));
+
+ cvs_cmdop = CVS_OP_ADD;
+ cvs_add(server_argc, server_argv);
+ cvs_server_send_response("ok");
+}
+
+void
cvs_server_commit(char *data)
{
if (chdir(server_currentdir) == -1)
@@ -400,6 +411,17 @@ cvs_server_diff(char *data)
}
void
+cvs_server_remove(char *data)
+{
+ if (chdir(server_currentdir) == -1)
+ fatal("cvs_server_remove: %s", strerror(errno));
+
+ cvs_cmdop = CVS_OP_REMOVE;
+ cvs_remove(server_argc, server_argv);
+ cvs_server_send_response("ok");
+}
+
+void
cvs_server_status(char *data)
{
if (chdir(server_currentdir) == -1)