Add filtering of Pull Requests by milestones

This commit is contained in:
Petr Korolev 2015-02-18 01:24:51 +02:00
parent f8a59643ca
commit bcae804809
2 changed files with 41 additions and 34 deletions

View File

@ -3,6 +3,8 @@
## [1.2.8](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.8)
[Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.2.7...1.2.8)
#### 17/02/15
- *Merged pull-request:* Feature/fix 37 [\#49](https://github.com/skywinder/Github-Changelog-Generator/pull/49) ([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)
## [1.2.7](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.7)
@ -29,8 +31,6 @@
## [1.2.4](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.4)
[Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.2.3...1.2.4)
#### 16/12/14
- *Merged pull-request:* Fix crash when user is NULL [\#40](https://github.com/skywinder/Github-Changelog-Generator/pull/40) ([skywinder](https://github.com/skywinder))
- *Merged pull-request:* Implement async fetching [\#39](https://github.com/skywinder/Github-Changelog-Generator/pull/39) ([skywinder](https://github.com/skywinder))
- *Fixed bug:* Crash when try generate log for rails [\#35](https://github.com/skywinder/Github-Changelog-Generator/issues/35)
@ -38,6 +38,8 @@
## [1.2.3](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.3)
[Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.2.2...1.2.3)
#### 16/12/14
- *Merged pull-request:* Fix crash when user is NULL [\#40](https://github.com/skywinder/Github-Changelog-Generator/pull/40) ([skywinder](https://github.com/skywinder))
- *Implemented enhancement:* Add ability to run with one parameter instead -u -p [\#38](https://github.com/skywinder/Github-Changelog-Generator/issues/38)
- *Implemented enhancement:* Detailed output [\#33](https://github.com/skywinder/Github-Changelog-Generator/issues/33)

View File

@ -293,6 +293,15 @@ module GitHubChangelogGenerator
if @options[:filter_issues_by_milestone]
#delete excess irrelevant issues (according milestones)
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)
end
self.create_log(filtered_pull_requests, filtered_issues, newer_tag_name, newer_tag_time, older_tag_name)
end
def filter_by_milestone(filtered_issues, newer_tag_name, src_array)
filtered_issues.select! { |issue|
if issue.milestone.nil?
true
@ -307,7 +316,7 @@ module GitHubChangelogGenerator
}
#add missed issues (according milestones)
issues_to_add = @issues.select { |issue|
issues_to_add = src_array.select { |issue|
if issue.milestone.nil?
false
else
@ -327,10 +336,6 @@ module GitHubChangelogGenerator
filtered_issues |= issues_to_add
end
self.create_log(filtered_pull_requests, filtered_issues, newer_tag_name, newer_tag_time, older_tag_name)
end
def delete_by_time(array, hash_key, newer_tag_time, older_tag = nil)
older_tag_time = self.get_time_of_tag(older_tag)