Add --since CLI option for repository diff filter

[fix #262]
This commit is contained in:
Markus Schirp 2015-07-13 01:36:52 +00:00
parent 9fc563a48b
commit 24c113314f
4 changed files with 21 additions and 1 deletions

View file

@ -1,5 +1,7 @@
# v0.8.1 2015-xx-xx
* Add --since flag to constrain mutated subjects based on
repository diff from HEAD to other REVISON.
* Add mutation from #[] to #at / #fetch
# v0.8.0 2015-06-15

View file

@ -1,3 +1,3 @@
---
threshold: 18
total_score: 1189
total_score: 1196

View file

@ -155,6 +155,9 @@ module Mutant
opts.on('--ignore-subject EXPRESSION', 'Ignore subjects that match EXPRESSION as prefix') do |pattern|
add_matcher(:ignore_expressions, config.expression_parser.(pattern))
end
opts.on('--since REVISION', 'Only select subjects touched since REVISION') do |revision|
add_matcher(:subject_filters, Repository::SubjectFilter.new(Repository::Diff.from_head(revision)))
end
end
# Add debug options

View file

@ -128,6 +128,7 @@ Options:
--expected-coverage COVERAGE Fail unless COVERAGE is not reached exactly, parsed via Rational()
--use INTEGRATION Use INTEGRATION to kill mutations
--ignore-subject EXPRESSION Ignore subjects that match EXPRESSION as prefix
--since REVISION Only select subjects touched since REVISION
--fail-fast Fail fast
--version Print mutants version
-d, --debug Enable debugging output
@ -230,6 +231,20 @@ Options:
end
end
context 'with --since flag' do
let(:flags) { %w[--since master] }
let(:expected_matcher_config) do
default_matcher_config.update(
subject_filters: [
Mutant::Repository::SubjectFilter.new(Mutant::Repository::Diff.new('HEAD', 'master'))
]
)
end
it_should_behave_like 'a cli parser'
end
context 'with subject-ignore flag' do
let(:flags) { %w[--ignore-subject Foo::Bar] }