Skip to content

Remove --between-tags option #501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 2 additions & 20 deletions lib/github_changelog_generator/generator/generator_tags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,12 @@ def version_of_first_item
sections.first["version"] if sections && sections.any?
end

# Return tags after filtering tags in lists provided by option: --between-tags & --exclude-tags
# Return tags after filtering tags in lists provided by option: --exclude-tags
#
# @return [Array]
def get_filtered_tags(all_tags)
filtered_tags = filter_since_tag(all_tags)
filtered_tags = filter_due_tag(filtered_tags)
filter_between_tags(filtered_tags)
filter_due_tag(filtered_tags)
end

# @param [Array] all_tags all tags
Expand Down Expand Up @@ -145,23 +144,6 @@ def filter_due_tag(all_tags)
filtered_tags
end

# @param [Array] all_tags all tags
# @return [Array] filtered tags according :between_tags option
def filter_between_tags(all_tags)
filtered_tags = all_tags
tag_names = filtered_tags.map { |ft| ft["name"] }

if options[:between_tags]
options[:between_tags].each do |tag|
unless tag_names.include?(tag)
Helper.log.warn "Warning: can't find tag #{tag}, specified with --between-tags option."
end
end
filtered_tags = all_tags.select { |tag| options[:between_tags].include?(tag["name"]) }
end
filtered_tags
end

# @param [Array] all_tags all tags
# @return [Array] filtered tags according :exclude_tags or :exclude_tags_regex option
def filter_excluded_tags(all_tags)
Expand Down
3 changes: 0 additions & 3 deletions lib/github_changelog_generator/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,6 @@ def self.setup_parser(options)
opts.on("--issue-line-labels x,y,z", Array, 'The specified labels will be shown in brackets next to each matching issue. Use "ALL" to show all labels. Default is [].') do |list|
options[:issue_line_labels] = list
end
opts.on("--between-tags x,y,z", Array, "Change log will be filled only between specified tags") do |list|
options[:between_tags] = list
end
opts.on("--exclude-tags x,y,z", Array, "Change log will exclude specified tags") do |list|
options[:exclude_tags] = list
end
Expand Down
4 changes: 0 additions & 4 deletions man/git-generate-changelog.1.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions man/git-generate-changelog.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions man/git-generate-changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,6 @@ Automatically generate change log from your tags, issues, labels and pull reques

Issues with the specified labels will be always added to "Implemented enhancements" section. Default is 'enhancement,Enhancement'

--between-tags x,y,z

Change log will be filled only between specified tags

--exclude-tags x,y,z

Change log will exclude specified tags
Expand Down
60 changes: 0 additions & 60 deletions spec/unit/generator/generator_tags_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,66 +13,6 @@ def tags_from_strings(tags_strings)
end
end

describe "#filter_between_tags" do
context "when between_tags nil" do
before do
@generator = GitHubChangelogGenerator::Generator.new(between_tags: nil)
end

subject do
@generator.get_filtered_tags(tags_from_strings(%w[1 2 3]))
end
it { is_expected.to be_a(Array) }
it { is_expected.to match_array(tags_from_strings(%w[1 2 3])) }
end
context "when between_tags same as input array" do
before do
@generator = GitHubChangelogGenerator::Generator.new(between_tags: %w[1 2 3])
end
subject do
@generator.get_filtered_tags(tags_from_strings(%w[1 2 3]))
end
it { is_expected.to be_a(Array) }
it { is_expected.to match_array(tags_from_strings(%w[1 2 3])) }
end

context "when between_tags filled with correct values" do
before do
@generator = GitHubChangelogGenerator::Generator.new(between_tags: %w[1 2])
end
subject do
@generator.get_filtered_tags(tags_from_strings(%w[1 2 3]))
end
it { is_expected.to be_a(Array) }
it { is_expected.to match_array(tags_from_strings(%w[1 2])) }
end

context "when between_tags filled with invalid values" do
before do
@generator = GitHubChangelogGenerator::Generator.new(between_tags: %w[1 q w])
end

subject do
@generator.get_filtered_tags(tags_from_strings(%w[1 2 3]))
end
it { is_expected.to be_a(Array) }
it { is_expected.to match_array(tags_from_strings(%w[1])) }
end
end

describe "#get_filtered_tags" do
subject do
generator.get_filtered_tags(tags_from_strings(%w[1 2 3 4 5]))
end

context "respects between tags" do
let(:generator) { GitHubChangelogGenerator::Generator.new(between_tags: %w[1 2 3]) }

it { is_expected.to be_a Array }
it { is_expected.to match_array(tags_from_strings(%w[1 2 3])) }
end
end

describe "#filter_excluded_tags" do
subject { generator.filter_excluded_tags(tags_from_strings(%w[1 2 3])) }

Expand Down