Whamcloud - gitweb
Fixes from b_port_step needed to get HEAD to build.
[fs/lustre-release.git] / build / branch.sh
1 #!/bin/sh -e 
2 CVS=${CVS:-cvs}
3
4 progname=${0##*/}
5
6 if [ $# -lt 2 -o $# -gt 3 ]; then
7     echo "This creates a new branch in CVS. Usage: $progname parent child <dir>"
8     exit
9 fi
10
11 parent=$1
12 child=$2
13 CHILD=`echo $child | sed -e "s/^b_//" | tr "[a-z]" "[A-Z]"`
14 dir=${3:-.}
15 module=$(<$dir/CVS/Repository)
16
17 if [ "$module" = "lustre" ] ; then
18     echo >&2 "${progname}: You probably want to branch lustre or portals."
19     echo >&2 "${progname}: Try using ${0} $parent $child lustre"
20     exit 1
21 fi
22
23 case $parent in
24   HEAD) : ;;
25   b_*|b1*) : ;;
26   *) parent="b_$parent" ;;
27 esac
28 case $child in
29   HEAD) : ;;
30   b_*|b1*) : ;;
31   *) child="b_$child"
32 esac
33
34 if [ "$parent" != "HEAD" -a "`cat $dir/CVS/Tag`" != "T$parent" ]; then
35         echo "This script must be run within the $parent branch"
36         exit 1
37 fi
38
39 echo parent: $parent CHILD: $CHILD child: $child date: $date
40
41 echo -n "tagging $parent as '${CHILD}_BASE' ...."
42 $CVS rtag -r $parent ${CHILD}_BASE $module
43 echo "done"
44 echo -n "branching $child at ${CHILD}_BASE' ...."
45 $CVS rtag -b -r ${CHILD}_BASE $child $module
46 echo -n "updating $dir to $child ...."
47 $CVS update -r $child $dir
48 echo "done"