\Composer\Package\ArchiverHgExcludeFilter

An exclude filter that processes hgignore files

Summary

Methods
Properties
Constants
__construct()
filter()
parseHgIgnoreLine()
patternFromRegex()
No public properties found
HG_IGNORE_REGEX
HG_IGNORE_GLOB
parseLines()
generatePatterns()
generatePattern()
patternFromGlob()
$sourcePath
$excludePatterns
$patternMode
N/A
No private methods found
No private properties found
N/A

Constants

HG_IGNORE_REGEX

HG_IGNORE_REGEX = 1

HG_IGNORE_GLOB

HG_IGNORE_GLOB = 2

Properties

$sourcePath

$sourcePath : string

Type

string

$excludePatterns

$excludePatterns : array

Type

array

$patternMode

$patternMode : integer

Either HG_IGNORE_REGEX or HG_IGNORE_GLOB

Type

integer

Methods

__construct()

__construct(string  $sourcePath) 

Parses .hgignore file if it exist

Parameters

string $sourcePath

Directory containing sources to be filtered

filter()

filter(string  $relativePath, boolean  $exclude) : boolean

Checks the given path against all exclude patterns in this filter

Negated patterns overwrite exclude decisions of previous filters.

Parameters

string $relativePath

The file's path relative to the sourcePath

boolean $exclude

Whether a previous filter wants to exclude this file

Returns

boolean —

Whether the file should be excluded

parseHgIgnoreLine()

parseHgIgnoreLine(string  $line) : array

Callback line parser which process hgignore lines

Parameters

string $line

A line from .hgignore

Returns

array —

An exclude pattern for filter()

patternFromRegex()

patternFromRegex(string  $line) : array

Generates an exclude pattern for filter() from a hg regexp expression

Parameters

string $line

A line from .hgignore in regexp mode

Returns

array —

An exclude pattern for filter()

parseLines()

parseLines(array  $lines, callable  $lineParser) : array

Processes a file containing exclude rules of different formats per line

Parameters

array $lines

A set of lines to be parsed

callable $lineParser

The parser to be used on each line

Returns

array —

Exclude patterns to be used in filter()

generatePatterns()

generatePatterns(array  $rules) : array

Generates a set of exclude patterns for filter() from gitignore rules

Parameters

array $rules

A list of exclude rules in gitignore syntax

Returns

array —

Exclude patterns

generatePattern()

generatePattern(string  $rule) : array

Generates an exclude pattern for filter() from a gitignore rule

Parameters

string $rule

An exclude rule in gitignore syntax

Returns

array —

An exclude pattern

patternFromGlob()

patternFromGlob(string  $line) : array

Generates an exclude pattern for filter() from a hg glob expression

Parameters

string $line

A line from .hgignore in glob mode

Returns

array —

An exclude pattern for filter()