summaryrefslogtreecommitdiff
path: root/usr.bin/cvs
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2009-04-04 11:29:58 +0000
committerJoris Vink <joris@cvs.openbsd.org>2009-04-04 11:29:58 +0000
commitf2cccafbbe264706cda47c7581c7880fecdb7231 (patch)
tree5f70ae3258c80ac15e12919df8b13d58f2a47ae0 /usr.bin/cvs
parent9be93bf1aef7d012bb298b2b2536fa7631b09c25 (diff)
properly expand modules if requested by the client,
this option is needed so gnu cvs clients can play along properly when running checkout <module> in a remote setup. if we do not support this, gnu cvs refuses to send us any existing files already on disk and opencvs will consider everything as NEEDS_CHECKOUT, instead of running an update on existing stuff. problem noticed by fgsch@ commited with opencvs, but please everybody else do not use opencvs to commit yet.
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r--usr.bin/cvs/client.c4
-rw-r--r--usr.bin/cvs/remote.h3
-rw-r--r--usr.bin/cvs/server.c27
3 files changed, 30 insertions, 4 deletions
diff --git a/usr.bin/cvs/client.c b/usr.bin/cvs/client.c
index 44e8feab068..a9f656f0268 100644
--- a/usr.bin/cvs/client.c
+++ b/usr.bin/cvs/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.120 2009/04/01 06:41:58 joris Exp $ */
+/* $OpenBSD: client.c,v 1.121 2009/04/04 11:29:57 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -55,6 +55,7 @@ struct cvs_req cvs_requests[] = {
{ "Argumentx", 0, cvs_server_argumentx, REQ_NEEDED },
{ "Global_option", 0, cvs_server_globalopt, REQ_NEEDED },
{ "Set", 0, cvs_server_set, REQ_NEEDED },
+ { "expand-modules", 0, cvs_server_exp_modules, 0 },
/*
* used to tell the server what is going on in our
@@ -73,7 +74,6 @@ struct cvs_req cvs_requests[] = {
{ "Kerberos-encrypt", 0, NULL, 0 },
{ "Gssapi-encrypt", 0, NULL, 0 },
{ "Gssapi-authenticate", 0, NULL, 0 },
- { "expand-modules", 0, NULL, 0 },
/* commands that might be supported */
{ "ci", 0, cvs_server_commit, REQ_NEEDDIR },
diff --git a/usr.bin/cvs/remote.h b/usr.bin/cvs/remote.h
index 6b292bdd0a9..478db51919a 100644
--- a/usr.bin/cvs/remote.h
+++ b/usr.bin/cvs/remote.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: remote.h,v 1.36 2009/03/19 09:53:16 joris Exp $ */
+/* $OpenBSD: remote.h,v 1.37 2009/04/04 11:29:57 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -96,6 +96,7 @@ void cvs_server_update_patches(char *);
void cvs_server_update_entry(const char *, struct cvs_file *cf);
void cvs_server_set_sticky(const char *, const char *);
void cvs_server_clear_sticky(char *);
+void cvs_server_exp_modules(char *);
void cvs_server_add(char *);
void cvs_server_import(char *);
diff --git a/usr.bin/cvs/server.c b/usr.bin/cvs/server.c
index c2f381a8849..97024e21e19 100644
--- a/usr.bin/cvs/server.c
+++ b/usr.bin/cvs/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.95 2009/03/19 09:56:03 joris Exp $ */
+/* $OpenBSD: server.c,v 1.96 2009/04/04 11:29:57 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -820,3 +820,28 @@ cvs_server_clear_sticky(char *dir)
cvs_server_send_response("Clear-sticky %s//", dir);
cvs_remote_output(fpath);
}
+
+void
+cvs_server_exp_modules(char *module)
+{
+ struct module_checkout *mo;
+ struct cvs_filelist *fl;
+
+ if (server_argc != 2)
+ fatal("expand-modules with no arguments");
+
+ mo = cvs_module_lookup(server_argv[1]);
+
+ RB_FOREACH(fl, cvs_flisthead, &(mo->mc_modules))
+ cvs_server_send_response("Module-expansion %s", fl->file_path);
+ cvs_server_send_response("ok");
+
+ if (mo->mc_canfree == 1) {
+ xfree(mo->mc_name);
+ xfree(mo);
+ }
+
+ server_argc--;
+ xfree(server_argv[1]);
+ server_argv[1] = NULL;
+}