Project

General

Profile

Patch #2256 ยป refs_in_parent_projects.patch

Kenneth Hoxworth, 2008-12-01 15:17

View differences:

app/models/changeset.rb (working copy)
79 79
    # status and optional done ratio applied
80 80
    fix_status = IssueStatus.find_by_id(Setting.commit_fix_status_id)
81 81
    done_ratio = Setting.commit_fix_done_ratio.blank? ? nil : Setting.commit_fix_done_ratio.to_i
82
    project_list = [repository.project] + repository.project.ancestors
82 83
    
83 84
    kw_regexp = (ref_keywords + fix_keywords).collect{|kw| Regexp.escape(kw)}.join("|")
84 85
    return if kw_regexp.blank?
......
89 90
      # find any issue ID in the comments
90 91
      target_issue_ids = []
91 92
      comments.scan(%r{([\s\(,-]|^)#(\d+)(?=[[:punct:]]|\s|<|$)}).each { |m| target_issue_ids << m[1] }
92
      referenced_issues += repository.project.issues.find_all_by_id(target_issue_ids)
93
      project_list.each {|project| referenced_issues += project.issues.find_all_by_id(target_issue_ids)}
93 94
    end
94 95
    
95 96
    comments.scan(Regexp.new("(#{kw_regexp})[\s:]+(([\s,;&]*#?\\d+)+)", Regexp::IGNORECASE)).each do |match|
96 97
      action = match[0]
97 98
      target_issue_ids = match[1].scan(/\d+/)
98
      target_issues = repository.project.issues.find_all_by_id(target_issue_ids)
99
      target_issues = []
100
      project_list.each {|project| target_issues += project.issues.find_all_by_id(target_issue_ids)}
99 101
      if fix_status && fix_keywords.include?(action.downcase)
100 102
        # update status of issues
101 103
        logger.debug "Issues fixed by changeset #{self.revision}: #{issue_ids.join(', ')}." if logger && logger.debug?
    (1-1/1)