Whamcloud - gitweb
Add land[12].sh and add some extra checks to merge[12].sh.
authoradilger <adilger>
Tue, 10 Feb 2004 20:19:28 +0000 (20:19 +0000)
committeradilger <adilger>
Tue, 10 Feb 2004 20:19:28 +0000 (20:19 +0000)
lustre/scripts/land1.sh [new file with mode: 0755]
lustre/scripts/land2.sh [new file with mode: 0755]
lustre/scripts/merge1.sh
lustre/scripts/merge2.sh

diff --git a/lustre/scripts/land1.sh b/lustre/scripts/land1.sh
new file mode 100755 (executable)
index 0000000..0c07803
--- /dev/null
@@ -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)"
+
diff --git a/lustre/scripts/land2.sh b/lustre/scripts/land2.sh
new file mode 100755 (executable)
index 0000000..6690e7d
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh -e 
+
+CVS=cvs
+
+if [ ! -f .mergeinfo ] ; then
+    echo ".mergeinfo doesn't exist - exit"
+    exit 
+fi
+
+. .mergeinfo
+
+if [ -f $CONFLICTS ] ; then
+    echo "$CONFLICTS exists - clean up first"
+    cat $CONFLICTS
+    exit 
+fi
+
+cvs update $dir 2>&1 | grep "^M" && echo "uncommitted changes" && exit 1
+
+echo -n "Tagging as ${CHILD}_BASE_$date ..."
+$CVS tag -F ${CHILD}_BASE_$date $dir
+echo "done"
+echo -n "Tagging as ${CHILD}_BASE ..."
+$CVS tag -F ${CHILD}_BASE $dir
+
+echo "saving .mergeinfo as .mergeinfo-$date"
+mv .mergeinfo .mergeinfo-$date
+echo "done"
index 362ddd4..d7e0069 100755 (executable)
@@ -1,5 +1,6 @@
 #!/bin/sh -e 
 
+CONFLICTS=cvs-merge-conflicts
 CVS=cvs
 
 if [ -f .mergeinfo ] ; then
@@ -7,8 +8,8 @@ if [ -f .mergeinfo ] ; then
     exit 
 fi
 
-if [ -f merge-conflicts ] ; then
-    echo "cvs-merge-conflicts exists - clean up first"
+if [ -f $CONFLICTS ] ; then
+    echo "$CONFLICTS exists - clean up first"
     exit 
 fi
 
@@ -18,17 +19,26 @@ if [ $# != 2 ]; then
 fi
 
 parent=$1
-PARENT=`echo $parent | tr '[a-z]' '[A-Z]'`
+PARENT=`echo $parent | sed -e "s/^b_//" | tr "[a-z]" "[A-Z]"`
 child=$2
-CHILD=`echo $child | tr '[a-z]' '[A-Z]'`
+CHILD=`echo $child | sed -e "s/^b_//" | tr "[a-z]" "[A-Z]"`
 date=`date +%Y%m%d_%H%M`
 module=lustre
 
-if [ $parent != "HEAD" ]; then
-  parent="b_$parent"
-fi
-if [ $child != "HEAD" ]; then
-  child="b_$child"
+case $parent in
+  HEAD) : ;;
+  b_*|b1*) : ;;
+  *) parent="b_$parent" ;;
+esac
+case $child in
+  HEAD) : ;;
+  b_*|b1*) : ;;
+  *) child="b_$child"
+esac
+
+if [ "$child" != "HEAD" -a "`cat CVS/Tag`" != "T$child" ]; then
+       echo "This script must be run within the $child branch"
+       exit 1
 fi
 
 cat << EOF > .mergeinfo
@@ -38,24 +48,26 @@ child=$child
 CHILD=$CHILD
 date=$date
 module=$module
+CONFLICTS=$CONFLICTS
 EOF
 
-echo PARENT $PARENT parent $parent CHILD $CHILD child $child date $date
+echo PARENT: $PARENT parent: $parent CHILD: $CHILD child: $child date: $date
 
-echo -n "tagging $parent as ${PARENT}_${CHILD}_UPDATE_PARENT_$date ...."
+echo -n "tagging $parent as '${PARENT}_${CHILD}_UPDATE_PARENT_$date' ...."
 $CVS rtag -r $parent ${PARENT}_${CHILD}_UPDATE_PARENT_$date $module
 echo "done"
-echo -n "tagging $child as ${PARENT}_${CHILD}_UPDATE_CHILD_$date ...."
+echo -n "tagging $child as '${PARENT}_${CHILD}_UPDATE_CHILD_$date' ...."
 $CVS rtag -r $child ${PARENT}_${CHILD}_UPDATE_CHILD_$date $module
 echo "done"
 echo "Updating: -j ${CHILD}_BASE -j ${PARENT}_${CHILD}_UPDATE_PARENT_$date ...."
 $CVS update -j ${CHILD}_BASE -j ${PARENT}_${CHILD}_UPDATE_PARENT_$date -dP
 echo "done"
-echo -n "Recording conflicts in cvs-merge-conflicts ..."
-if $CVS update | grep '^C' > cvs-merge-conflicts; then
+echo -n "Recording conflicts in $CONFLICTS ..."
+if $CVS update | grep '^C' > $CONFLICTS; then
     echo "Conflicts found, fix before committing."
-    cat cvs-merge-conflicts
+    cat $CONFLICTS
 else 
     echo "No conflicts found"
+    rm -f $CONFLICTS
 fi
 echo "Test, commit and then run merge2.sh (no arguments)"
index e6ba077..43586f0 100755 (executable)
@@ -7,6 +7,14 @@ fi
 
 . .mergeinfo
 
+if [ -f $CONFLICTS ] ; then
+    echo "$CONFLICTS exists - clean up first"
+    cat $CONFLICTS
+    exit 
+fi
+
+cvs update $dir 2>&1 | grep "^M" && echo "uncommitted changes" && exit 1
+
 echo -n "Tagging ${PARENT}_${CHILD}_UPDATE_PARENT_$date as ${CHILD}_BASE_$date ..."
 cvs rtag -r ${PARENT}_${CHILD}_UPDATE_PARENT_$date ${CHILD}_BASE_$date $module
 echo  "done"