5 |
# Copyright (C) 2004-2005 Red Hat, Inc. |
# Copyright (C) 2004-2005 Red Hat, Inc. |
6 |
# Copyright (C) 2005 Fedora Foundation |
# Copyright (C) 2005 Fedora Foundation |
7 |
# |
# |
8 |
# $Id: cvs-import.sh,v 1.7 2008/02/08 18:52:15 slords Exp $ |
# $Id: cvs-import.sh,v 1.9 2011/11/03 22:44:53 slords Exp $ |
9 |
|
|
10 |
shopt -s nocasematch |
shopt -s nocasematch |
11 |
|
|
23 |
# use the CVSROOT from the checkout |
# use the CVSROOT from the checkout |
24 |
CVSROOT=$(cat ${MYDIR}/CVS/Root) |
CVSROOT=$(cat ${MYDIR}/CVS/Root) |
25 |
|
|
26 |
|
# use the TAG from the checkout |
27 |
|
TAG=$(sed -n 's@^T@@p' $(pwd)/CVS/Tag 2> /dev/null) |
28 |
|
|
29 |
# We need a writable directory for temporary checkouts and CVS work |
# We need a writable directory for temporary checkouts and CVS work |
30 |
WORKDIR="/tmp" |
WORKDIR="/tmp" |
31 |
if test -w $(pwd) ; then |
if test -w $(pwd) ; then |
39 |
cat <<EOF |
cat <<EOF |
40 |
Usage: |
Usage: |
41 |
|
|
42 |
$0 [-b <branch>] [-m <message>] <package> |
$0 [-b <branch>] [-t <cvs tag/branch>] [-m <message>] <package> |
43 |
|
|
44 |
Imports a package into the cvs repository. Will use the following defaults: |
Imports a package into the cvs repository. Will use the following defaults: |
45 |
CVSROOT = $CVSROOT |
CVSROOT = $CVSROOT |
46 |
BRANCH = ${BRANCH:-devel} |
BRANCH = ${BRANCH:-devel} |
47 |
|
TAG = ${TAG} |
48 |
|
|
49 |
The package can also be imported on a PRE-EXISTING branch using the |
The package can also be imported on a PRE-EXISTING branch using the |
50 |
"-b BRANCH" flag. This script can not create new branches for you. |
"-b BRANCH" flag. This script can not create new branches for you. |
59 |
# import the package on the given branch. If the branch does |
# import the package on the given branch. If the branch does |
60 |
# not exist, we will branch the HEAD and then we will perform |
# not exist, we will branch the HEAD and then we will perform |
61 |
# the import |
# the import |
62 |
|
-t | --tag ) |
63 |
|
shift |
64 |
|
TAG="$1" |
65 |
|
if [ -z "$TAG" ] ; then |
66 |
|
echo "ERROR: --tag requires an argument" |
67 |
|
Usage |
68 |
|
exit -1 |
69 |
|
fi |
70 |
|
;; |
71 |
|
|
72 |
-b | --branch ) |
-b | --branch ) |
73 |
shift |
shift |
74 |
BRANCH="$1" |
BRANCH="$1" |
180 |
# Check out the existing module |
# Check out the existing module |
181 |
cd $TMPDIR |
cd $TMPDIR |
182 |
echo "Checking out module: '$NAME'" |
echo "Checking out module: '$NAME'" |
183 |
$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; } |
184 |
|
|
185 |
# this is our working directory |
# this is our working directory |
186 |
cd $TOPLEVEL/$NAME |
cd $TOPLEVEL/$NAME |