diff options
author | Joris Vink <joris@cvs.openbsd.org> | 2007-01-03 22:28:31 +0000 |
---|---|---|
committer | Joris Vink <joris@cvs.openbsd.org> | 2007-01-03 22:28:31 +0000 |
commit | 36b0c9e066cc83ad9bbae99899730308b0b802eb (patch) | |
tree | b5c55a3542f5b9f561e594756a325960b55bd1f3 /usr.bin/cvs | |
parent | 154ac13620baabf42e54a1cd83dcec4f9fc9d6ec (diff) |
add support for 'remove' in a remote setup.
testing appriciated, as always.
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r-- | usr.bin/cvs/checkout.c | 13 | ||||
-rw-r--r-- | usr.bin/cvs/client.c | 21 | ||||
-rw-r--r-- | usr.bin/cvs/commit.c | 19 | ||||
-rw-r--r-- | usr.bin/cvs/remote.h | 3 | ||||
-rw-r--r-- | usr.bin/cvs/remove.c | 21 | ||||
-rw-r--r-- | usr.bin/cvs/server.c | 25 |
6 files changed, 55 insertions, 47 deletions
diff --git a/usr.bin/cvs/checkout.c b/usr.bin/cvs/checkout.c index 1d0cd273148..bc4f9ff2eb6 100644 --- a/usr.bin/cvs/checkout.c +++ b/usr.bin/cvs/checkout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: checkout.c,v 1.68 2007/01/03 20:48:26 joris Exp $ */ +/* $OpenBSD: checkout.c,v 1.69 2007/01/03 22:28:30 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -263,14 +263,11 @@ cvs_checkout_file(struct cvs_file *cf, RCSNUM *rnum, BUF *bp, int flags) if ((p = strrchr(cf->file_rpath, ',')) != NULL) *p = '\0'; - if (flags & CO_COMMIT) { - cvs_server_send_response("Checked-in %s/", - cf->file_wd); - } else { - cvs_server_send_response("Updated %s/", cf->file_wd); - } + if (flags & CO_COMMIT) + cvs_server_update_entry("Checked-in", cf); + else + cvs_server_update_entry("Updated", cf); - cvs_remote_output(cf->file_rpath); cvs_remote_output(entry); if (!(flags & CO_COMMIT)) { diff --git a/usr.bin/cvs/client.c b/usr.bin/cvs/client.c index 77207d19d50..ccb1a0823c6 100644 --- a/usr.bin/cvs/client.c +++ b/usr.bin/cvs/client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: client.c,v 1.43 2007/01/03 21:00:43 joris Exp $ */ +/* $OpenBSD: client.c,v 1.44 2007/01/03 22:28:30 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -591,8 +591,9 @@ cvs_client_checkedin(char *data) fatal("cvs_client_checkedin: overflow"); } - l = snprintf(entry, CVS_ENT_MAXLINELEN, "/%s/%s/%s//%s/", - newent->ce_name, rev, timebuf, sticky); + l = snprintf(entry, CVS_ENT_MAXLINELEN, "/%s/%s%s/%s//%s/", + newent->ce_name, (newent->ce_status == CVS_ENT_REMOVED) ? "-" : "", + rev, timebuf, sticky); if (l == -1 || l >= CVS_ENT_MAXLINELEN) fatal("cvs_client_checkedin: overflow"); @@ -710,27 +711,19 @@ cvs_client_removed(char *data) void cvs_client_remove_entry(char *data) { - int l; CVSENTRIES *entlist; - char *filename, *rpath, *fpath; + char *filename, *rpath; rpath = cvs_remote_input(); if ((filename = strrchr(rpath, '/')) == NULL) fatal("bad rpath in cvs_client_remove_entry: %s", rpath); *filename++; - fpath = xmalloc(MAXPATHLEN); - l = snprintf(fpath, MAXPATHLEN, "%s%s", data, filename); - if (l == -1 || l >= MAXPATHLEN) - fatal("cvs_client_remove_entry: overflow"); - - xfree(rpath); - entlist = cvs_ent_open(data); - cvs_ent_remove(entlist, fpath); + cvs_ent_remove(entlist, filename); cvs_ent_close(entlist, ENT_SYNC); - xfree(fpath); + xfree(rpath); } void diff --git a/usr.bin/cvs/commit.c b/usr.bin/cvs/commit.c index c11902e7415..29c5aeab00c 100644 --- a/usr.bin/cvs/commit.c +++ b/usr.bin/cvs/commit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: commit.c,v 1.84 2007/01/03 20:48:26 joris Exp $ */ +/* $OpenBSD: commit.c,v 1.85 2007/01/03 22:28:30 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org> @@ -358,6 +358,9 @@ cvs_commit_local(struct cvs_file *cf) xfree(repo); xfree(attic); + + if (cvs_server_active == 1) + cvs_server_update_entry("Remove-entry", cf); } if (verbosity > 1) @@ -366,20 +369,6 @@ cvs_commit_local(struct cvs_file *cf) cvs_log(LP_NOTICE, "checking in '%s'; revision %s -> %s", cf->file_path, rbuf, nbuf); } - - if (cvs_server_active == 1) { - if ((p = strrchr(cf->file_rpath, ',')) != NULL) - *p = '\0'; - - if (cf->file_status == FILE_REMOVED) { - cvs_server_send_response("Remove-entry %s/", - cf->file_wd); - cvs_remote_output(cf->file_rpath); - } - - if (p != NULL) - *p = ','; - } } static char * diff --git a/usr.bin/cvs/remote.h b/usr.bin/cvs/remote.h index 8966d72788e..80df1555137 100644 --- a/usr.bin/cvs/remote.h +++ b/usr.bin/cvs/remote.h @@ -1,4 +1,4 @@ -/* $OpenBSD: remote.h,v 1.16 2007/01/03 19:27:28 joris Exp $ */ +/* $OpenBSD: remote.h,v 1.17 2007/01/03 22:28:30 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -84,6 +84,7 @@ void cvs_server_set(char *); void cvs_server_static_directory(char *); void cvs_server_sticky(char *); void cvs_server_update_patches(char *); +void cvs_server_update_entry(const char *, struct cvs_file *cf); void cvs_server_add(char *); void cvs_server_admin(char *); diff --git a/usr.bin/cvs/remove.c b/usr.bin/cvs/remove.c index edd580f62b3..2046759accb 100644 --- a/usr.bin/cvs/remove.c +++ b/usr.bin/cvs/remove.c @@ -1,4 +1,4 @@ -/* $OpenBSD: remove.c,v 1.57 2006/12/14 09:31:17 xsa Exp $ */ +/* $OpenBSD: remove.c,v 1.58 2007/01/03 22:28:30 joris Exp $ */ /* * Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org> * @@ -98,7 +98,7 @@ cvs_remove(int argc, char **argv) } if (removed != 0) { - if (verbosity > 1) { + if (verbosity > 0) { cvs_log(LP_NOTICE, "use '%s commit' to remove %s " "permanently", __progname, (removed > 1) ? @@ -147,7 +147,7 @@ cvs_remove_local(struct cvs_file *cf) cf->file_name); existing++; } else { - switch(cf->file_status) { + switch (cf->file_status) { case FILE_ADDED: entlist = cvs_ent_open(cf->file_wd); cvs_ent_remove(entlist, cf->file_name); @@ -167,7 +167,7 @@ cvs_remove_local(struct cvs_file *cf) } return; case FILE_REMOVED: - if (verbosity > 1 ) { + if (verbosity > 0) { cvs_log(LP_ERR, "file `%s' already scheduled for removal", cf->file_name); @@ -187,13 +187,18 @@ cvs_remove_local(struct cvs_file *cf) if (l == -1 || l >= CVS_ENT_MAXLINELEN) fatal("cvs_remove_local: overflow"); - entlist = cvs_ent_open(cf->file_wd); - cvs_ent_add(entlist, entry); - cvs_ent_close(entlist, ENT_SYNC); + if (cvs_server_active == 1) { + cvs_server_update_entry("Checked-in", cf); + cvs_remote_output(entry); + } else { + entlist = cvs_ent_open(cf->file_wd); + cvs_ent_add(entlist, entry); + cvs_ent_close(entlist, ENT_SYNC); + } xfree(entry); - if (verbosity > 1) { + if (verbosity > 0) { cvs_log(LP_NOTICE, "scheduling file `%s' for removal", cf->file_name); diff --git a/usr.bin/cvs/server.c b/usr.bin/cvs/server.c index 1cc91a8f058..91c7aa05886 100644 --- a/usr.bin/cvs/server.c +++ b/usr.bin/cvs/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.46 2006/12/19 14:11:21 xsa Exp $ */ +/* $OpenBSD: server.c,v 1.47 2007/01/03 22:28:30 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -587,3 +587,26 @@ cvs_server_version(char *data) cvs_version(server_argc, server_argv); cvs_server_send_response("ok"); } + +void +cvs_server_update_entry(const char *resp, struct cvs_file *cf) +{ + int l; + char *p, *response; + + if ((p = strrchr(cf->file_rpath, ',')) != NULL) + *p = '\0'; + + response = xmalloc(MAXPATHLEN); + l = snprintf(response, MAXPATHLEN, "%s %s/", resp, cf->file_wd); + if (l == -1 || l >= MAXPATHLEN) + fatal("cvs_server_update_entry: overflow"); + + cvs_server_send_response("%s", response); + cvs_remote_output(cf->file_rpath); + + if (p != NULL) + *p = ','; + + xfree(response); +} |