3 CONFLICTS=cvs-merge-conflicts
6 if [ -f .mergeinfo ] ; then
7 echo ".mergeinfo exists - clean up first"
11 if [ -f $CONFLICTS ] ; then
12 echo "$CONFLICTS exists - clean up first"
16 if [ $# -lt 2 -o $# -gt 3 ]; then
17 echo "This is phase 1 of merging branches. Usage: $0 parent child dir"
22 PARENT=`echo $parent | sed -e "s/^b_//" | tr "[a-z]" "[A-Z]"`
24 CHILD=`echo $child | sed -e "s/^b_//" | tr "[a-z]" "[A-Z]"`
25 date=`date +%Y%m%d_%H%M`
28 module=$(basename $(<$dir/CVS/Repository))
30 if [ "$module" = "lustre" ] ; then
31 echo >&2 "${progname}: You probably want to merge lustre or portals, not the whole tree."
32 echo >&2 "${progname}: Try using ${0} $parent $child lustre"
40 *) parent="b_$parent" ;;
48 if [ "$child" != "HEAD" -a "`cat $dir/CVS/Tag 2> /dev/null`" != "T$child" ]; then
49 echo "This script must be run within the $child branch"
53 TEST_FILE=${TEST_FILE:-ChangeLog} # does this need to be smarter?
54 [ $dir = "build" ] && TEST_FILE=lbuild
56 [ -z "$1" ] && echo "check_tag() missing arg" && exit3
57 [ "$1" = "HEAD" ] && return
58 $CVS log $dir/$TEST_FILE 2> /dev/null | grep -q " $1: " && return
59 echo "$0: tag $1 not found in $dir/$TEST_FILE"
64 check_tag ${CHILD}_BASE
66 cat << EOF > .mergeinfo
79 echo PARENT: $PARENT parent: $parent CHILD: $CHILD child: $child date: $date
81 echo -n "tagging $parent as '${PARENT}_${CHILD}_UPDATE_PARENT_$date' ...."
82 $CVS rtag -r $parent ${PARENT}_${CHILD}_UPDATE_PARENT_$date $module
84 echo -n "tagging $child as '${PARENT}_${CHILD}_UPDATE_CHILD_$date' ...."
85 $CVS rtag -r $child ${PARENT}_${CHILD}_UPDATE_CHILD_$date $module
88 # Apply all of the changes to your local tree:
89 echo "Updating: -j ${CHILD}_BASE -j ${PARENT}_${CHILD}_UPDATE_PARENT_$date ...."
90 $CVS update -j ${CHILD}_BASE -j ${PARENT}_${CHILD}_UPDATE_PARENT_$date -dP $dir
93 echo -n "Recording conflicts in $CONFLICTS ..."
94 $CVS update | awk '/^C/ { print $2 }' > $CONFLICTS
95 if [ -s $CONFLICTS ] ; then
96 echo "Conflicts found, fix before committing."
99 echo "No conflicts found"
104 echo "Build, test, commit and then run merge2.sh (no arguments)"