diff options
author | Joris Vink <joris@cvs.openbsd.org> | 2007-06-27 03:58:17 +0000 |
---|---|---|
committer | Joris Vink <joris@cvs.openbsd.org> | 2007-06-27 03:58:17 +0000 |
commit | ca38bfde341f6af98ebd2f6f6c9e6f9eaa344220 (patch) | |
tree | f2ca3d97567284321c160017570f248e78b76279 /usr.bin | |
parent | 2f3705d1a955d7d70e338187df216101371dba94 (diff) |
We were missing the needed clue/magic to have our remote setup
handle files that have been removed from the repository
correctly, which resulted in them still being in the working copy
after doing an update.
noticed and diff tested by ckuethe@.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cvs/checkout.c | 17 | ||||
-rw-r--r-- | usr.bin/cvs/client.c | 20 | ||||
-rw-r--r-- | usr.bin/cvs/cvs.h | 3 | ||||
-rw-r--r-- | usr.bin/cvs/update.c | 3 |
4 files changed, 31 insertions, 12 deletions
diff --git a/usr.bin/cvs/checkout.c b/usr.bin/cvs/checkout.c index b73dc53cda1..46b4385bff8 100644 --- a/usr.bin/cvs/checkout.c +++ b/usr.bin/cvs/checkout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: checkout.c,v 1.94 2007/06/18 17:54:13 joris Exp $ */ +/* $OpenBSD: checkout.c,v 1.95 2007/06/27 03:58:16 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -314,9 +314,11 @@ cvs_checkout_file(struct cvs_file *cf, RCSNUM *rnum, int co_flags) cf->file_name, rev, timebuf, kbuf, stickytag); if (cvs_server_active == 0) { - ent = cvs_ent_open(cf->file_wd); - cvs_ent_add(ent, entry); - cvs_ent_close(ent, ENT_SYNC); + if (!(co_flags & CO_REMOVE)) { + ent = cvs_ent_open(cf->file_wd); + cvs_ent_add(ent, entry); + cvs_ent_close(ent, ENT_SYNC); + } } else { if ((p = strrchr(cf->file_rpath, ',')) != NULL) *p = '\0'; @@ -330,12 +332,15 @@ cvs_checkout_file(struct cvs_file *cf, RCSNUM *rnum, int co_flags) cvs_server_update_entry("Checked-in", cf); else if (co_flags & CO_MERGE) cvs_server_update_entry("Merged", cf); + else if (co_flags & CO_REMOVE) + cvs_server_update_entry("Removed", cf); else cvs_server_update_entry("Updated", cf); - cvs_remote_output(entry); + if (!(co_flags & CO_REMOVE)) + cvs_remote_output(entry); - if (!(co_flags & CO_COMMIT)) { + if (!(co_flags & CO_COMMIT) && !(co_flags & CO_REMOVE)) { if (!(co_flags & CO_MERGE)) { (void)xsnprintf(template, MAXPATHLEN, "%s/checkout.XXXXXXXXXX", cvs_tmpdir); diff --git a/usr.bin/cvs/client.c b/usr.bin/cvs/client.c index f5267adda4a..80c50bf6693 100644 --- a/usr.bin/cvs/client.c +++ b/usr.bin/cvs/client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: client.c,v 1.64 2007/06/26 02:24:10 niallo Exp $ */ +/* $OpenBSD: client.c,v 1.65 2007/06/27 03:58:16 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -767,10 +767,22 @@ cvs_client_merged(char *data) void cvs_client_removed(char *data) { - char *dir; + CVSENTRIES *entlist; + char *rpath, *filename, fpath[MAXPATHLEN]; - dir = cvs_remote_input(); - xfree(dir); + rpath = cvs_remote_input(); + if ((filename = strrchr(rpath, '/')) == NULL) + fatal("bad rpath in cvs_client_removed: %s", rpath); + filename++; + + entlist = cvs_ent_open(data); + cvs_ent_remove(entlist, filename); + cvs_ent_close(entlist, ENT_SYNC); + + (void)xsnprintf(fpath, MAXPATHLEN, "%s/%s", data, filename); + (void)unlink(fpath); + + xfree(rpath); } void diff --git a/usr.bin/cvs/cvs.h b/usr.bin/cvs/cvs.h index 2bf6fa55cbf..0f1b66b4c7b 100644 --- a/usr.bin/cvs/cvs.h +++ b/usr.bin/cvs/cvs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cvs.h,v 1.137 2007/06/26 18:02:43 xsa Exp $ */ +/* $OpenBSD: cvs.h,v 1.138 2007/06/27 03:58:16 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -386,6 +386,7 @@ int update_has_conflict_markers(struct cvs_file *); #define CO_SETSTICKY 0x02 #define CO_DUMP 0x04 #define CO_COMMIT 0x08 +#define CO_REMOVE 0x10 /* commands */ int cvs_add(int, char **); diff --git a/usr.bin/cvs/update.c b/usr.bin/cvs/update.c index 3af6f48fcae..b3d6652b91a 100644 --- a/usr.bin/cvs/update.c +++ b/usr.bin/cvs/update.c @@ -1,4 +1,4 @@ -/* $OpenBSD: update.c,v 1.100 2007/06/18 17:54:13 joris Exp $ */ +/* $OpenBSD: update.c,v 1.101 2007/06/27 03:58:16 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -357,6 +357,7 @@ cvs_update_local(struct cvs_file *cf) break; case FILE_UNLINK: (void)unlink(cf->file_path); + cvs_checkout_file(cf, cf->file_rcsrev, CO_REMOVE); case FILE_REMOVE_ENTRY: entlist = cvs_ent_open(cf->file_wd); cvs_ent_remove(entlist, cf->file_name); |