Pattern Matching

CVS uses two different forms of pattern matching, depending on which aspect of CVS is attempting to match the pattern. Most CVS functions use sh-style wildcards, but the scripting files in the CVSROOT directory use regular expressions.

This section is not a comprehensive study of regular expressions or wildcards. For a more complete discussion of regular expressions, I recommend Mastering Regular Expressions (O’Reilly) by Jeffrey E. F. Friedl.

Wildcards

Wildcards are used by most CVS functions, including wrappers and ignore files. The wildcards are evaluated by a version of the fnmatch standard function library distributed with CVS.

The wildcards are sh-style, and the symbols used in CVS include:

?

Matches any single character.

\

Escapes the special symbols, so they can be used as literals.

*

Matches any string, including the empty string.

[ ]

Matches any one of the enclosed characters. Within the brackets, the following symbols are used:

! or ^

If either of these characters is the first character after the open bracket, the brackets match anything that is not included in the brackets.

char1-char2

Denotes the range of characters between char1 and char2.

Regular Expressions

CVS supports regular expressions in the scripting files in the CVSROOT directory. In CVS 1.11.5, the scripting files are the only files that support regular expressions; all other files and functions use pattern matching. The scripting files are commitinfo, editinfo, loginfo, rcsinfo, taginfo, and verifymsg ...

Get Essential CVS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.