Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / build / cvsdiffclient
1 #!/bin/bash
2 # Put this script and cvs-modified-files.pl into your PATH (~bin is good) and 
3 #
4 # export CVSEDITOR=cvsdiffclient
5 #
6 # in your .bashrc and you will get a nice bunch of CVS commit reminders:
7 # <merge/land tag information>
8 # b=<bug_number>
9 # i=<inspected_by>
10 # i=<inspected_by>
11 #
12 # Remember to remove the leading "CVS: " part of the comment before saving
13 # your commit comment if you want those entries to be saved.
14
15 [ -f .mergeinfo ] && . ./.mergeinfo
16
17 CVS_MODIFIED_FILES_PL=$(which cvs-modified-files.pl 2>/dev/null)
18 if [ -z "$CVS_MODIFIED_FILES_PL" ]; then
19     CVS_MODIFIED_FILES_PL=$(dirname $0)/cvs-modified-files.pl
20 fi
21 FILES=$($CVS_MODIFIED_FILES_PL $1)
22 TMP=`mktemp /tmp/cvslog-XXXXXXXX`
23 if [ -f $TMP ]; then
24         cat - >> $TMP <<- EOH
25                 CVS: did you test your fix properly (acc-sm.sh, or as needed)?
26                 CVS: did you update the ChangeLog for a bug fix?
27                 CVS: did you verify/update affected user documentation?
28                 CVS: Remove "CVS:" from lines below to include in commit message
29         EOH
30         [ -f .mergeinfo ] && . .mergeinfo
31         [ -z "$PARENT" -a -f lustre/.mergeinfo ] && . lustre/.mergeinfo
32         if [ "$PARENT" ]; then
33                 [ "$OPERATION" ] || OPERATION=Update
34                 [ "$OPERWHERE" ] || OPERWHERE=from
35                 echo "CVS: $OPERATION $child $OPERWHERE $parent ($date)" >> $TMP
36         else
37                 [ -r CVS/Tag ] && TAG=CVS/Tag
38                 [ -z "$TAG" -a -r lustre/CVS/Tag ] && TAG=lustre/CVS/Tag
39                 [ "$TAG" ] && BRANCH="`sed 's/^T//' $TAG`" || BRANCH="HEAD"
40                 echo "CVS: Branch $BRANCH" >> $TMP
41         fi
42         # We can't just put these into the commit template without the leading
43         # "CVS: ", otherwise exiting the commend edit would still leave a valid
44         # comment in the file and the commit will still be done.  We need to
45         # make a file without valid comments to allow the commit to be aborted.
46         cat - >> $TMP <<- EOB
47                 CVS: b=<bug>
48                 CVS: i=<inspected_by>
49                 CVS: i=<inspected_by>
50         EOB
51
52         cat $1 >> $TMP
53         cp $TMP $1
54         rm $TMP
55 fi
56
57 if [ "${FILES:+have_files}"x = have_filesx ]; then
58   echo Diffing $1 : $FILES
59   cvs diff -wbBup $FILES 2>/dev/null | sed "s/^/CVS: /" >>$1
60 fi
61 #gnuclient $1 || vi $1
62 [ "$EDITOR" ] || EDITOR=vi
63
64 $EDITOR $1