Up: editinfo   [Contents][Index]


C.4.3.1 Editinfo example

The following is a little silly example of a editinfo file, together with the corresponding rcsinfo file, the log message template and an editor script. We begin with the log message template. We want to always record a bug-id number on the first line of the log message. The rest of log message is free text. The following template is found in the file /usr/cvssupport/tc.template.

BugId:

The script /usr/cvssupport/bugid.edit is used to edit the log message.

#!/bin/sh
#
#       bugid.edit filename
#
#  Call $EDITOR on FILENAME, and verify that the
#  resulting file contains a valid bugid on the first
#  line.
if [ "x$EDITOR" = "x" ]; then EDITOR=vi; fi
if [ "x$CVSEDITOR" = "x" ]; then CVSEDITOR=$EDITOR; fi
$CVSEDITOR $1
until head -1|grep '^BugId:[ ]*[0-9][0-9]*$' < $1
do  echo -n  "No BugId found.  Edit again? ([y]/n)"
    read ans
    case ${ans} in
        n*) exit 1;;
    esac
    $CVSEDITOR $1
done

The editinfo file contains this line:

^tc     /usr/cvssupport/bugid.edit

The rcsinfo file contains this line:

^tc     /usr/cvssupport/tc.template