Whamcloud - gitweb
b=23193 Land ISER performance patch for Sundance
[fs/lustre-release.git] / build / branch.sh
1 #!/bin/bash -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 if [ ! -d $dir ]; then
16     echo >&2 "${progname}: directory '$dir' does not exist."
17     exit 1
18 fi
19 module=$(basename $(<$dir/CVS/Repository))
20
21 if [ "$module" = "lustre" ]; then
22     echo >&2 "${progname}: You probably want to branch lustre or lnet."
23     echo >&2 "${progname}: Try using ${0} $parent $child lustre"
24     exit 1
25 fi
26
27 case $parent in
28   HEAD) : ;;
29   b_*|b1*) : ;;
30   *) parent="b_$parent" ;;
31 esac
32 case $child in
33   HEAD) : ;;
34   b_*|b1*) : ;;
35   *) child="b_$child"
36 esac
37
38 #if [ "$parent" != "HEAD" -a -f $dir/CVS/Tag ]; then
39         # put in separate condition as bash evaluates all conditions unlike C
40 #       if [ "`cat $dir/CVS/Tag`" != "T$parent" ]; then
41 #               echo "This script must be run within the $parent branch"
42 #               exit 1
43 #       fi
44 #fi
45
46 echo parent: $parent CHILD: $CHILD child: $child date: $date
47
48 echo -n "tagging $parent as '${CHILD}_BASE' ...."
49 $CVS rtag -r $parent ${CHILD}_BASE $module
50 echo "done"
51 echo -n "branching $child at ${CHILD}_BASE' ...."
52 $CVS rtag -b -r ${CHILD}_BASE $child $module
53 echo -n "updating $dir to $child ...."
54 $CVS update -r $child $dir
55 echo "done"