Running Scripts
In the repository’s
CVSROOT directory, there are several
scripting files
that allow you to run scripts while a
project is being committed, tagged, updated, or modified in other
ways. The scripts called from scripting files are often used to
interact with other programs or to enforce standards.
Example 7-6 shows a
commitinfo
scripting file that runs a
layout-testing program called indent-tester on
the wizzard project files. CVS calls scripts in
commitinfo before files are committed.
Example 7-6. Sample commitinfo file
^wizzard/src\(/\|$\) /var/lib/cvs/CVSROOT/indent-tester -gnu
When a project file is committed, CVS searches the
commitinfo file for rules that match the project
file’s path; if CVS finds a rule, it runs the script
given in that rule. The rule in Example 7-6 matches
all files in the src directory (and its
subdirectories) of the wizzard project and tells
CVS to run the indent-tester script on those
files. Later in this chapter, Example 7-8 shows the
indent-tester script that can be used to enforce
indentation standards for a project.
CVS processes the scripting files separately for each directory that
is affected by a command, and it calls the script in the scripting
file once for each directory it matches. If you run cvs
commit wizzard, CVS checks commitinfo
for patterns that match wizzard and runs the
script once for the files in the wizzard
directory, then does the same for each subdirectory, checking for
patterns that match wizzard/doc and processing ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access