Patterns

Bazaar uses patterns to match files at various times. For example, the add command skips over files that match ignore patterns and preferences can be associated with files using rule patterns. The pattern syntax is described below.

Trailing slashes on patterns are ignored. If the pattern contains a slash or is a regular expression, it is compared to the whole path from the branch root. Otherwise, it is compared to only the last component of the path. To match a file only in the root directory, prepend ./. Patterns specifying absolute paths are not allowed.

Patterns may include globbing wildcards such as:

? - Matches any single character except '/'
* - Matches 0 or more characters except '/'
/**/ - Matches 0 or more directories in a path
[a-z] - Matches a single character from within a group of characters

Patterns may also be Python regular expressions. Regular expression patterns are identified by a RE: prefix followed by the regular expression. Regular expression patterns may not include named or numbered groups.

Case insensitive ignore patterns can be specified with regular expressions by using the i (for ignore case) flag in the pattern.

For example, a case insensitive match for foo may be specified as:

RE:(?i)foo

Ignore patterns may be prefixed with !, which means that a filename matched by that pattern will not be ignored.