Go to the first, previous, next, last section, table of contents.


The cvswrappers file

Wrappers allow you to set a hook which transforms files on their way in and out of CVS. Most or all of the wrappers features do not work with client/server CVS.

The file `cvswrappers' defines the script that will be run on a file when its name matches a regular expresion. There are two scripts that can be run on a file or directory. One script is executed on the file/directory before being checked into the repository (this is denoted with the -t flag) and the other when the file is checked out of the repository (this is denoted with the -f flag)

The `cvswrappers' also has a `-m' option to specify the merge methodology that should be used when the file is updated. MERGE means the usual CVS behavior: try to merge the files (this generally will not work for binary files). COPY means that cvs update will merely copy one version over the other, and require the user using mechanisms outside CVS, to insert any necessary changes. The `-m' wrapper option only affects behavior when merging is done on update; it does not affect how files are stored. See See section Handling binary files, for more on binary files.

The basic format of the file `cvswrappers' is:

wildcard     [option value][option value]...

where option is one of
-f           from cvs filter         value: path to filter
-t           to cvs filter           value: path to filter
-m           update methodology      value: MERGE or COPY
-k           keyword expansion       value: expansion mode

and value is a single-quote delimited value.
*.nib    -f 'unwrap %s' -t 'wrap %s %s' -m 'COPY'
*.c      -t 'indent %s %s'

The above example of a `cvswrappers' file states that all files/directories that end with a .nib should be filtered with the `wrap' program before checking the file into the repository. The file should be filtered though the `unwrap' program when the file is checked out of the repository. The `cvswrappers' file also states that a COPY methodology should be used when updating the files in the repository (that is no merging should be performed).

The last example line says that all files that end with a *.c should be filtered with `indent' before being checked into the repository. Unlike the previous example no filtering of the *.c file is done when it is checked out of the repository. The -t filter is called with two arguments, the first is the name of the file/directory to filter and the second is the pathname to where the resulting filtered file should be placed.

The -f filter is called with one argument, which is the name of the file to filter from. The end result of this filter will be a file in the users directory that they can work on as they normally would.

For another example, the following command imports a directory, treating files whose name ends in `.exe' as binary:

cvs import -I ! -W "*.exe -k 'b'" first-dir vendortag reltag


Go to the first, previous, next, last section, table of contents.