SPECS: builder - pass -B to `cvs tag' when a given tag already exi...

adamg adamg at pld-linux.org
Fri Mar 21 16:10:22 CET 2008


Author: adamg                        Date: Fri Mar 21 15:10:22 2008 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- pass -B to `cvs tag' when a given tag already exists and happens to be
  a branch (common case with ac-tag); 
  tested with cvs-1.11.21-5 (Ac) and cvs-1.12.13-7 (Th),
  still does not work with cvs-nserver-client

---- Files affected:
SPECS:
   builder (1.540 -> 1.541) 

---- Diffs:

================================================================
Index: SPECS/builder
diff -u SPECS/builder:1.540 SPECS/builder:1.541
--- SPECS/builder:1.540	Thu Mar  6 22:45:35 2008
+++ SPECS/builder	Fri Mar 21 16:10:17 2008
@@ -1164,6 +1164,26 @@
 	echo -n "$TAGVER"
 }
 
+# bool is_tag_a_branch(tag)
+#
+# returns 1 if a tag is a branch set on SPECFILE
+is_tag_a_branch() {
+	if [ -n "$DEBUG" ]; then
+		set -x
+		set -v
+	fi
+
+	if [ $# -ne 1 ]; then
+		return 0;
+	fi
+
+	TAG=$1
+	
+	cd "$SPEC_DIR"
+	cvs status -v $SPECFILE | grep -Eiq "${TAG}.+(branch: [0-9.]+)"
+	return $?
+}
+
 tag_files()
 {
 	TAG_FILES="$@"
@@ -1190,6 +1210,18 @@
 		OPTIONS="-d $CVSROOT $OPTIONS"
 	fi
 
+	# if a tagname we are about to set already exists
+	# and happens to be a branch (common case with AC-branch)
+	# pass -B (allows -F to disturb branch tag)
+	local _tag=$TAG
+	if [ "$TAG_VERSION" = "yes" ]; then
+		_tag=$TAGVER
+	fi;
+	is_tag_a_branch $_tag
+	if [ $? -eq 0 ]; then
+		OPTIONS="$OPTIONS -B"
+	fi;
+
 	cd "$SOURCE_DIR"
 	local tag_files
 	for i in $TAG_FILES; do
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SPECS/builder?r1=1.540&r2=1.541&f=u



More information about the pld-cvs-commit mailing list