From c588b9b9b928be5ab6b0c06560aef28c17878ddb Mon Sep 17 00:00:00 2001 From: Xavier Santolaria Date: Wed, 1 Feb 2006 14:30:35 +0000 Subject: allow tag deletion with -d option; OK niallo@. --- usr.bin/cvs/tag.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/cvs/tag.c b/usr.bin/cvs/tag.c index 57696baaff6..7d81549f8ce 100644 --- a/usr.bin/cvs/tag.c +++ b/usr.bin/cvs/tag.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tag.c,v 1.38 2006/01/27 15:42:35 xsa Exp $ */ +/* $OpenBSD: tag.c,v 1.39 2006/02/01 14:30:34 xsa Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * Copyright (c) 2004 Joris Vink @@ -228,7 +228,7 @@ cvs_tag_remote(CVSFILE *cfp, void *arg) static int cvs_tag_local(CVSFILE *cf, void *arg) { - char fpath[MAXPATHLEN], rcspath[MAXPATHLEN]; + char fpath[MAXPATHLEN], numbuf[64], rcspath[MAXPATHLEN]; RCSFILE *rf; RCSNUM *tag_rev; @@ -268,17 +268,25 @@ cvs_tag_local(CVSFILE *cf, void *arg) rcs_errstr(rcs_errno)); if (tag_delete == 1) { - /* XXX */ + if (cvs_noexec == 0) { + if (rcs_sym_remove(rf, tag_name) < 0) + fatal("failed to remove tag %s from %s", + tag_name, rcspath); + } + if (verbosity > 0) cvs_printf("D %s\n", fpath); + rcs_close(rf); return (0); } if (cvs_noexec == 0) { - if (rcs_sym_add(rf, tag_name, tag_rev) < 0) - fatal("cvs_tag_local: rcs_sym_add: %s: %s", rcspath, - rcs_errstr(rcs_errno)); + if (rcs_sym_add(rf, tag_name, tag_rev) < 0) { + rcsnum_tostr(tag_rev, numbuf, sizeof(numbuf)); + fatal("failed to set tag %s to revision %s in %s", + tag_name, numbuf, rcspath); + } } if (verbosity > 0) -- cgit v1.2.3