HgExcludeFilter
extends BaseExcludeFilter
in package
An exclude filter that processes hgignore files
Tags
Table of Contents
- HG_IGNORE_GLOB = 2
- HG_IGNORE_REGEX = 1
- $excludePatterns : array<string|int, mixed>
- $patternMode : int
- Either HG_IGNORE_REGEX or HG_IGNORE_GLOB
- $sourcePath : string
- __construct() : mixed
- Parses .hgignore file if it exist
- filter() : bool
- Checks the given path against all exclude patterns in this filter
- parseHgIgnoreLine() : array<string|int, mixed>|null
- Callback line parser which process hgignore lines
- patternFromRegex() : array<string|int, mixed>
- Generates an exclude pattern for filter() from a hg regexp expression
- generatePattern() : array<string|int, mixed>
- Generates an exclude pattern for filter() from a gitignore rule
- generatePatterns() : array<string|int, mixed>
- Generates a set of exclude patterns for filter() from gitignore rules
- parseLines() : array<string|int, mixed>
- Processes a file containing exclude rules of different formats per line
- patternFromGlob() : array<string|int, mixed>
- Generates an exclude pattern for filter() from a hg glob expression
Constants
HG_IGNORE_GLOB
public
mixed
HG_IGNORE_GLOB
= 2
HG_IGNORE_REGEX
public
mixed
HG_IGNORE_REGEX
= 1
Properties
$excludePatterns
protected
array<string|int, mixed>
$excludePatterns
$patternMode
Either HG_IGNORE_REGEX or HG_IGNORE_GLOB
protected
int
$patternMode
$sourcePath
protected
string
$sourcePath
Methods
__construct()
Parses .hgignore file if it exist
public
__construct(string $sourcePath) : mixed
Parameters
- $sourcePath : string
Return values
mixed —filter()
Checks the given path against all exclude patterns in this filter
public
filter(string $relativePath, bool $exclude) : bool
Negated patterns overwrite exclude decisions of previous filters.
Parameters
- $relativePath : string
-
The file's path relative to the sourcePath
- $exclude : bool
-
Whether a previous filter wants to exclude this file
Return values
bool —Whether the file should be excluded
parseHgIgnoreLine()
Callback line parser which process hgignore lines
public
parseHgIgnoreLine(string $line) : array<string|int, mixed>|null
Parameters
- $line : string
-
A line from .hgignore
Return values
array<string|int, mixed>|null —An exclude pattern for filter()
patternFromRegex()
Generates an exclude pattern for filter() from a hg regexp expression
public
patternFromRegex(string $line) : array<string|int, mixed>
Parameters
- $line : string
-
A line from .hgignore in regexp mode
Return values
array<string|int, mixed> —An exclude pattern for filter()
generatePattern()
Generates an exclude pattern for filter() from a gitignore rule
protected
generatePattern(string $rule) : array<string|int, mixed>
Parameters
- $rule : string
-
An exclude rule in gitignore syntax
Return values
array<string|int, mixed> —An exclude pattern
generatePatterns()
Generates a set of exclude patterns for filter() from gitignore rules
protected
generatePatterns(array<string|int, mixed> $rules) : array<string|int, mixed>
Parameters
- $rules : array<string|int, mixed>
-
A list of exclude rules in gitignore syntax
Return values
array<string|int, mixed> —Exclude patterns
parseLines()
Processes a file containing exclude rules of different formats per line
protected
parseLines(array<string|int, mixed> $lines, callable $lineParser) : array<string|int, mixed>
Parameters
- $lines : array<string|int, mixed>
-
A set of lines to be parsed
- $lineParser : callable
-
The parser to be used on each line
Return values
array<string|int, mixed> —Exclude patterns to be used in filter()
patternFromGlob()
Generates an exclude pattern for filter() from a hg glob expression
protected
patternFromGlob(string $line) : array<string|int, mixed>
Parameters
- $line : string
-
A line from .hgignore in glob mode
Return values
array<string|int, mixed> —An exclude pattern for filter()