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`
31 *) parent="b_$parent" ;;
39 if [ "$parent" != "HEAD" -a "`cat CVS/Tag 2> /dev/null`" != "T$parent" ]; then
40 echo "$0: this script must be run within the $parent branch"
44 TEST_FILE=${TEST_FILE:-ChangeLog} # does this need to be smarter?
46 [ -z "$1" ] && echo "check_tag() missing arg" && exit3
47 [ "$1" = "HEAD" ] && return
48 $CVS log $TEST_FILE | grep -q " $1: " && return
49 echo "$0: tag $1 not found in $TEST_FILE"
54 check_tag ${CHILD}_BASE
58 cat << EOF > .mergeinfo
71 echo PARENT $PARENT parent $parent CHILD $CHILD child $child date $date
73 # Update your tree to the PARENT branch; HEAD is not really a branch, so you
74 # need to update -A instead of update -r HEAD, or the commit will fail. -p
75 echo -n "Updating to $parent ...."
76 if [ $parent == "HEAD" ]; then
79 $CVS update -r $parent -dP $dir
83 echo -n "Tagging as ${PARENT}_${CHILD}_LAND_PARENT_$date ..."
84 $CVS tag ${PARENT}_${CHILD}_LAND_PARENT_$date $dir
87 echo -n "Create land point on ${child} ${PARENT}_${CHILD}_LAND_CHILD_$date ..."
88 $CVS rtag -r ${child} ${PARENT}_${CHILD}_LAND_CHILD_$date $module $dir
91 echo -n "Preserve old base tag ${CHILD}_BASE as ${CHILD}_BASE_PREV ..."
92 $CVS tag -F -r ${CHILD}_BASE ${CHILD}_BASE_PREV $dir
95 # Apply all of the changes to your local tree:
96 echo -n "Updating as -j ${CHILD}_BASE -j ${PARENT}_${CHILD}_LAND_CHILD_$date ..."
97 $CVS update -j ${CHILD}_BASE -j ${PARENT}_${CHILD}_LAND_CHILD_$date $dir
100 echo -n "Recording conflicts in $CONFLICTS ..."
101 if $CVS update | grep '^C' > $CONFLICTS; then
102 echo "Conflicts found, fix before committing."
105 echo "No conflicts found"
110 echo "Test, commit and then run land2.sh (no arguments)"