From 56b7da2faf04d63ea8c6e10cb6e257486120792f Mon Sep 17 00:00:00 2001 From: adilger <adilger> Date: Tue, 10 Feb 2004 20:20:36 +0000 Subject: [PATCH] Add cvsdiffclient and cvs-modified-files.pl to CVS (needs a usage note). --- lustre/scripts/cvs-modified-files.pl | 47 ++++++++++++++++++++++++++++ lustre/scripts/cvsdiffclient | 26 +++++++++++++++ 2 files changed, 73 insertions(+) create mode 100755 lustre/scripts/cvs-modified-files.pl create mode 100755 lustre/scripts/cvsdiffclient diff --git a/lustre/scripts/cvs-modified-files.pl b/lustre/scripts/cvs-modified-files.pl new file mode 100755 index 0000000000..d13c4d3d71 --- /dev/null +++ b/lustre/scripts/cvs-modified-files.pl @@ -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 index 0000000000..dab1e90d2f --- /dev/null +++ b/lustre/scripts/cvsdiffclient @@ -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 -- GitLab