--- common/cvs-import.sh 2008/11/25 16:20:10 1.7 +++ common/cvs-import.sh 2011/11/03 22:47:20 1.8 @@ -5,7 +5,7 @@ # Copyright (C) 2004-2005 Red Hat, Inc. # Copyright (C) 2005 Fedora Foundation # -# $Id: cvs-import.sh,v 1.5 2008/07/30 18:02:28 slords Exp $ +# $Id: cvs-import.sh,v 1.9 2011/11/03 22:44:53 slords Exp $ shopt -s nocasematch @@ -23,6 +23,9 @@ fi # use the CVSROOT from the checkout CVSROOT=$(cat ${MYDIR}/CVS/Root) +# use the TAG from the checkout +TAG=$(sed -n 's@^T@@p' $(pwd)/CVS/Tag 2> /dev/null) + # We need a writable directory for temporary checkouts and CVS work WORKDIR="/tmp" if test -w $(pwd) ; then @@ -36,11 +39,12 @@ Usage() { cat <] [-m ] + $0 [-b ] [-t ] [-m ] Imports a package into the cvs repository. Will use the following defaults: CVSROOT = $CVSROOT BRANCH = ${BRANCH:-devel} +TAG = ${TAG} The package can also be imported on a PRE-EXISTING branch using the "-b BRANCH" flag. This script can not create new branches for you. @@ -55,6 +59,16 @@ while [ -n "$1" ] ; do # import the package on the given branch. If the branch does # not exist, we will branch the HEAD and then we will perform # the import + -t | --tag ) + shift + TAG="$1" + if [ -z "$TAG" ] ; then + echo "ERROR: --tag requires an argument" + Usage + exit -1 + fi + ;; + -b | --branch ) shift BRANCH="$1" @@ -166,7 +180,7 @@ EOF # Check out the existing module cd $TMPDIR echo "Checking out module: '$NAME'" -$CVS -Q checkout $TOPLEVEL/$NAME || { echo "ERROR: \"$NAME\" module does not exist in cvs."; exit 1; } +$CVS -Q checkout ${TAG:+-r $TAG} $TOPLEVEL/$NAME || { echo "ERROR: \"$NAME\" module does not exist in cvs."; exit 1; } # this is our working directory cd $TOPLEVEL/$NAME