5 CONFLICTS=cvs-merge-conflicts
8 if [ -f .mergeinfo ] ; then
9 echo ".mergeinfo exists - clean up first"
13 if [ -f $CONFLICTS ] ; then
14 echo "$CONFLICTS exists - clean up first"
18 if [ $# -lt 2 -o $# -gt 3 ]; then
19 echo "This is phase 1 of merging branches. Usage: $0 parent child [dir]"
24 PARENT=`echo $parent | sed -e "s/^b_//" | tr "[a-z]" "[A-Z]"`
26 CHILD=`echo $child | sed -e "s/^b_//" | tr "[a-z]" "[A-Z]"`
27 date=`date +%Y%m%d_%H%M`
30 module=$(basename $(<$dir/CVS/Repository))
32 if [ "$module" = "lustre" ] ; then
33 echo >&2 "${progname}: You probably want to land lustre or lnet, not the whole tree."
34 echo >&2 "${progname}: Try using ${0} $parent $child lustre"
41 *) parent="b_$parent" ;;
49 if [ "$parent" != "HEAD" -a "`cat $dir/CVS/Tag 2> /dev/null`" != "T$parent" ]; then
50 echo "${progname}: this script must be run within the $parent branch"
54 TEST_FILE=${TEST_FILE:-ChangeLog} # does this need to be smarter?
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 "${progname}: 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 # Update your tree to the PARENT branch; HEAD is not really a branch, so you
82 # need to update -A instead of update -r HEAD, or the commit will fail. -p
83 echo -n "Updating to $parent ...."
84 if [ $parent == "HEAD" ]; then
87 $CVS update -r $parent -dP $dir
91 echo -n "Create land-to point on $parent as ${PARENT}_${CHILD}_LAND_PARENT_$date ..."
92 $CVS rtag -r $parent ${PARENT}_${CHILD}_LAND_PARENT_$date $module
95 echo -n "Create land-from point on ${child} ${PARENT}_${CHILD}_LAND_CHILD_$date ..."
96 $CVS rtag -r ${child} ${PARENT}_${CHILD}_LAND_CHILD_$date $module
99 echo -n "Preserve old base tag on $parent ${CHILD}_BASE as ${CHILD}_BASE_PREV ..."
100 $CVS rtag -F -r ${CHILD}_BASE ${CHILD}_BASE_PREV $module
103 # Apply all of the changes to your local tree:
104 echo -n "Updating as -j ${CHILD}_BASE -j ${PARENT}_${CHILD}_LAND_CHILD_$date ..."
105 $CVS update -j ${CHILD}_BASE -j ${PARENT}_${CHILD}_LAND_CHILD_$date -dP $dir
108 echo -n "Recording conflicts in $CONFLICTS ..."
109 $CVS update | awk '/^C/ { print $2 }' > $CONFLICTS
110 if [ -s $CONFLICTS ] ; then
111 echo "Conflicts found, fix before committing."
114 echo "No conflicts found"
119 echo "Build, test, commit and then run land2.sh (no arguments)"