Fix milesones support for unreleased issues. Fix #47

This commit is contained in:
Petr Korolev 2015-02-18 21:43:05 +02:00
parent e6dc367f99
commit a90c276a9f
2 changed files with 8 additions and 16 deletions

View File

@ -5,19 +5,15 @@
- *Merged pull-request:* Implement filtering of Pull Requests by milestones [\#50](https://github.com/skywinder/Github-Changelog-Generator/pull/50) ([skywinder](https://github.com/skywinder)) - *Merged pull-request:* Implement filtering of Pull Requests by milestones [\#50](https://github.com/skywinder/Github-Changelog-Generator/pull/50) ([skywinder](https://github.com/skywinder))
- *Merged pull-request:* Feature/fix 37 [\#49](https://github.com/skywinder/Github-Changelog-Generator/pull/49) ([skywinder](https://github.com/skywinder))
- *Merged pull-request:* Prettify output [\#48](https://github.com/skywinder/Github-Changelog-Generator/pull/48) ([skywinder](https://github.com/skywinder))
- *Implemented enhancement:* Add support for forked repo \(to extend changelog with parent's changes\) [\#21](https://github.com/skywinder/Github-Changelog-Generator/issues/21) - *Implemented enhancement:* Add support for forked repo \(to extend changelog with parent's changes\) [\#21](https://github.com/skywinder/Github-Changelog-Generator/issues/21)
- *Fixed bug:* Sometimes user is NULL during merges [\#41](https://github.com/skywinder/Github-Changelog-Generator/issues/41)
## [1.2.8](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.8) (2015-02-17) ## [1.2.8](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.8) (2015-02-17)
[Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.2.7...1.2.8) [Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.2.7...1.2.8)
- *Merged pull-request:* Feature/fix 37 [\#49](https://github.com/skywinder/Github-Changelog-Generator/pull/49) ([skywinder](https://github.com/skywinder)) - *Merged pull-request:* Feature/fix 37 [\#49](https://github.com/skywinder/Github-Changelog-Generator/pull/49) ([skywinder](https://github.com/skywinder))
- *Merged pull-request:* Prettify output [\#48](https://github.com/skywinder/Github-Changelog-Generator/pull/48) ([skywinder](https://github.com/skywinder))
- *Closed issue:* Bugs, that closed simultaneously with push not appeared in correct version. [\#37](https://github.com/skywinder/Github-Changelog-Generator/issues/37) - *Closed issue:* Bugs, that closed simultaneously with push not appeared in correct version. [\#37](https://github.com/skywinder/Github-Changelog-Generator/issues/37)
## [1.2.7](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.7) (2015-01-26) ## [1.2.7](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.7) (2015-01-26)

View File

@ -285,14 +285,12 @@ module GitHubChangelogGenerator
filtered_pull_requests = delete_by_time(@pull_requests, :merged_at, older_tag, newer_tag) filtered_pull_requests = delete_by_time(@pull_requests, :merged_at, older_tag, newer_tag)
filtered_issues = delete_by_time(@issues, :actual_date, older_tag, newer_tag) filtered_issues = delete_by_time(@issues, :actual_date, older_tag, newer_tag)
unless newer_tag.nil? newer_tag_name = newer_tag.nil? ? nil : newer_tag['name']
newer_tag_name = newer_tag['name']
if @options[:filter_issues_by_milestone] if @options[:filter_issues_by_milestone]
#delete excess irrelevant issues (according milestones) #delete excess irrelevant issues (according milestones)
filtered_issues = filter_by_milestone(filtered_issues, newer_tag_name, @issues) filtered_issues = filter_by_milestone(filtered_issues, newer_tag_name, @issues)
filtered_pull_requests = filter_by_milestone(filtered_pull_requests, newer_tag_name, @pull_requests) filtered_pull_requests = filter_by_milestone(filtered_pull_requests, newer_tag_name, @pull_requests)
end
end end
older_tag_name = older_tag.nil? ? nil : older_tag['name'] older_tag_name = older_tag.nil? ? nil : older_tag['name']
@ -302,8 +300,6 @@ module GitHubChangelogGenerator
end end
def filter_by_milestone(filtered_issues, newer_tag_name, src_array) def filter_by_milestone(filtered_issues, newer_tag_name, src_array)
filtered_issues.select! { |issue| filtered_issues.select! { |issue|
# leave issues without milestones # leave issues without milestones
if issue.milestone.nil? if issue.milestone.nil?
@ -313,7 +309,6 @@ module GitHubChangelogGenerator
@all_tags.find { |tag| tag.name == issue.milestone.title }.nil? @all_tags.find { |tag| tag.name == issue.milestone.title }.nil?
end end
} }
unless newer_tag_name.nil? unless newer_tag_name.nil?
#add missed issues (according milestones) #add missed issues (according milestones)
@ -336,6 +331,7 @@ module GitHubChangelogGenerator
filtered_issues |= issues_to_add filtered_issues |= issues_to_add
end end
filtered_issues
end end
def delete_by_time(array, hash_key, older_tag = nil, newer_tag = nil) def delete_by_time(array, hash_key, older_tag = nil, newer_tag = nil)