X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fscripts%2Fland1.sh;fp=lustre%2Fscripts%2Fland1.sh;h=0c0780339416a5b5f691f914a52d35e52d2cc086;hb=42a807b66b280a7a25cdba76984fab18c0533aa8;hp=0000000000000000000000000000000000000000;hpb=a73d38da4e75808f98556c8f96c354bafb39d859;p=fs%2Flustre-release.git diff --git a/lustre/scripts/land1.sh b/lustre/scripts/land1.sh new file mode 100755 index 0000000..0c07803 --- /dev/null +++ b/lustre/scripts/land1.sh @@ -0,0 +1,93 @@ +#!/bin/sh -e + +CONFLICTS=cvs-merge-conflicts +CVS=cvs + +if [ -f .mergeinfo ] ; then + echo ".mergeinfo exists - clean up first" + exit +fi + +if [ -f $CONFLICTS ] ; then + echo "$CONFLICTS exists - clean up first" + exit +fi + +if [ $# -lt 2 -o $# -gt 3 ]; then + echo "This is phase 1 of merging branches. Usage: $0 parent child [dir]" + exit +fi + +parent=$1 +PARENT=`echo $parent | sed -e "s/^b_//" | tr "[a-z]" "[A-Z]"` +child=$2 +CHILD=`echo $child | sed -e "s/^b_//" | tr "[a-z]" "[A-Z]"` +date=`date +%Y%m%d_%H%M` +module=lustre + +if [ "$parent" != "HEAD" -a "`cat CVS/Tag`" != "T$parent" ]; then + echo "This script must be run within the $parent branch" + exit 1 +fi + +dir=$3 + +if [ $parent != "HEAD" ]; then + parent="b_$parent" +fi +if [ $child != "HEAD" ]; then + child="b_$child" +fi + +cat << EOF > .mergeinfo +parent=$parent +PARENT=$PARENT +child=$child +CHILD=$CHILD +date=$date +module=$module +dir=$dir +CONFLICTS=$CONFLICTS +EOF + +echo PARENT $PARENT parent $parent CHILD $CHILD child $child date $date + +# Update your tree to the PARENT branch; HEAD is not really a branch, so you +# need to update -A instead of update -r HEAD, or the commit will fail. -p +echo -n "Updating to $parent ...." +if [ $parent == "HEAD" ]; then + $CVS update -AdP $dir +else + $CVS update -r $parent -dP $dir +fi +echo "done" + +echo -n "Tagging as ${PARENT}_${CHILD}_LAND_PARENT_$date ..." +$CVS tag ${PARENT}_${CHILD}_LAND_PARENT_$date $dir +echo "done" + +echo -n "Create land point on ${child} ${PARENT}_${CHILD}_LAND_CHILD_$date ..." +$CVS rtag -r ${child} ${PARENT}_${CHILD}_LAND_CHILD_$date $module $dir +echo "done" + +echo -n "Preserve old base tag ${CHILD}_BASE as ${CHILD}_BASE_PREV ..." +$CVS tag -F -r ${CHILD}_BASE ${CHILD}_BASE_PREV $dir +echo "done" + +# Apply all of the changes to your local tree: +echo -n "Updating as -j ${CHILD}_BASE -j ${PARENT}_${CHILD}_LAND_CHILD_$date ..." +$CVS update -j ${CHILD}_BASE -j ${PARENT}_${CHILD}_LAND_CHILD_$date $dir +echo "done" + +echo -n "Recording conflicts in $CONFLICTS ..." +if $CVS update | grep '^C' > $CONFLICTS; then + echo "Conflicts found, fix before committing." + cat $CONFLICTS +else + echo "No conflicts found" + rm -f $CONFLICTS +fi +echo "done" + +echo "Test, commit and then run land2.sh (no arguments)" +