From 5fd21b6e5e4dde449a048e7d66ecb5ffeb93607b Mon Sep 17 00:00:00 2001
From: mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Sat, 1 Oct 2005 08:42:33 +0000
Subject: [PATCH] 	* gcc_release (build_sources): If trying to apply a
 tag that 	already exists, issue an error message and exit.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104854 138bc75d-0d04-0410-961f-82ee72b054a4
---
 maintainer-scripts/ChangeLog   |  5 +++++
 maintainer-scripts/gcc_release | 15 +++++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/maintainer-scripts/ChangeLog b/maintainer-scripts/ChangeLog
index 24e51deb9fdf..968e14a68ea9 100644
--- a/maintainer-scripts/ChangeLog
+++ b/maintainer-scripts/ChangeLog
@@ -1,3 +1,8 @@
+2005-10-01  Mark Mitchell  <mark@codesourcery.com>
+
+	* gcc_release (build_sources): If trying to apply a tag that
+	already exists, issue an error message and exit.
+
 2005-09-30  Joseph S. Myers  <joseph@codesourcery.com>
 
 	PR other/23693
diff --git a/maintainer-scripts/gcc_release b/maintainer-scripts/gcc_release
index 0c60cdb512d2..6458ce1b24ec 100755
--- a/maintainer-scripts/gcc_release
+++ b/maintainer-scripts/gcc_release
@@ -170,12 +170,19 @@ EOF
   EXPORTDATE=""
   if [ -n "${TAG}" ]; then
     inform "Tagging sources as ${TAG}"
-    # The -F option to CVS is intentionally not used below.  If you
-    # need to retry a release, you will have to manually remove any
-    # existing tag.
+    EXPORTTAG="-r${TAG}"
+    # Try to check out a file using ${TAG}.  If the command succeeds,
+    # then the sources have already been tagged.  We don't want to 
+    # overwrite an existing tag, so we don't want to use the "-F"
+    # option to "cvs rtag" below.  So, if the tag already exists,
+    # issue an error message; the release manager can manually remove
+    # the tag if appropriate.
+    if ${CVS} export -d "`basename ${SOURCE_DIRECTORY}`" \
+      "${EXPORTTAG}" gcc/ChangeLog; then
+      error "Tag ${TAG} already exists"
+    fi
     ${CVS} rtag -r ${CVSBRANCH} ${TAG} gcc || \
       error "Could not tag sources"
-    EXPORTTAG="-r${TAG}"
   else
     if [ ${CVSBRANCH} != "HEAD" ]; then
       EXPORTTAG="-r${CVSBRANCH}"
-- 
GitLab