Whamcloud - gitweb
some scripts were mysteriously deleted when b_size landed
authorphil <phil>
Tue, 24 Feb 2004 07:51:55 +0000 (07:51 +0000)
committerphil <phil>
Tue, 24 Feb 2004 07:51:55 +0000 (07:51 +0000)
lustre/scripts/cvs-modified-files.pl [new file with mode: 0755]
lustre/scripts/cvsdiffclient [new file with mode: 0755]
lustre/scripts/land1.sh [new file with mode: 0755]
lustre/scripts/land2.sh [new file with mode: 0755]

diff --git a/lustre/scripts/cvs-modified-files.pl b/lustre/scripts/cvs-modified-files.pl
new file mode 100755 (executable)
index 0000000..d13c4d3
--- /dev/null
@@ -0,0 +1,47 @@
+#!/usr/bin/env perl
+
+my $mode = "NONE";
+my @modified, @added, @removed;
+
+while($line = <>) {
+  if ($line =~ /Modified Files:/) {
+    $mode = "MODIFIED";
+    next;
+  }
+
+  if ($line =~ /Added Files:/) {
+    $mode = "ADDED";
+    next;
+  }
+
+  if ($line =~ /Removed Files:/) {
+    $mode = "REMOVED";
+    next;
+  }
+
+  if ($mode eq "NONE") { next; }
+  if ($line =~ /-------/) { next; }
+
+  chop($line);
+  $line =~ s/^CVS:\s+//;
+  $line =~ s/\s+$//;
+  # print "processing $line for $mode\n";
+  @files = split(/ /, $line);
+  # print "new files for $mode: ", join(', ', @files), "\n";
+
+  if ($mode eq "MODIFIED") {
+    push(@modified, @files);
+  } elsif ($mode eq "ADDED") {
+    push(@added, @files);
+  } elsif ($mode eq "REMOVED") {
+    push(@removed, @files);
+  } else {
+    die "Unknown mode $mode!";
+  }
+}
+
+print join(' ', @modified);
+if ($ENV{"SHOW_ALL_FILES"} ne "no") {
+  print ' ', join(' ', @added), ' ', join(' ', @removed);
+}
+print "\n";
diff --git a/lustre/scripts/cvsdiffclient b/lustre/scripts/cvsdiffclient
new file mode 100755 (executable)
index 0000000..dab1e90
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+[ -f .mergeinfo ] && . ./.mergeinfo
+
+FILES=`cvs-modified-files.pl $1`
+TMP=`mktemp /tmp/cvslog-XXXXXXXX`
+if [ -f $TMP ]; then
+       [ -f .mergeinfo ] && \
+               echo "CVS: Update $child from $parent ($date)" >> $TMP
+       echo "CVS: did you update the ChangeLog for a bug fix?" >> $TMP
+       echo "CVS: b=" >> $TMP
+       echo "CVS: r=" >> $TMP
+
+       cat $1 >> $TMP
+       cp $TMP $1
+       rm $TMP
+fi
+
+if [ "${FILES:+have_files}"x = have_filesx ]; then
+  echo Diffing $1 : $FILES
+  cvs diff -wbBup $FILES 2>/dev/null | sed "s/^/CVS: /" >>$1
+fi
+#gnuclient $1 || vi $1
+[ "$EDITOR" ] || EDITOR=vi
+
+$EDITOR $1
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..2bb9fad
--- /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"