<commit_before>#--
#   Copyright (C) 2008 <NAME> <<EMAIL>>
#
#   This program is free software: you can redistribute it and/or modify
#   it under the terms of the GNU Affero General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU Affero General Public License for more details.
#
#   You should have received a copy of the GNU Affero General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
#++

atom_feed do |feed|
  feed.title("Gitorious: #{@project.title} - #{@repository.name}")
  feed.updated((@commits.blank? ? nil : @commits.first.committed_date))
	
  @commits.each do |commit|
    item_url = "http://#{GitoriousConfig['gitorious_host']}" +  project_repository_commit_path(@project, @repository, commit.id)
		commit_stat_data = commit.stats.files.map do |file, stats| 
			[stats[:insertions].to_s.ljust(8, " "), stats[:deletions].to_s.ljust(8, " "), file].join
		end
    feed.entry(commit, {
      :url => item_url, 
      :updated => commit.committed_date, 
      :published => commit.committed_date
    }) do |entry|
      entry.title(truncate(commit.message, :length => 75))
      entry.content(<<-EOS, :type => 'html')
<h1>In #{@repository.gitdir} #{params[:id]}</h1>
<pre>
#{word_wrap commit.message}


Date:   #{commit.committed_date.strftime("%Y-%m-%d %H:%M")}
Author: #{commit.author.name}
Committer: #{commit.committer.name}

#{commit.stats.total[:lines]} lines changed in #{commit.stats.total[:files]} files:
------------------------------------------------------------------------------
adds   dels     file
------------------------------------------------------------------------------
#{commit_stat_data.join("\n")}
<pre>
EOS
      entry.author do |author|
        author.name(commit.author.name)
      end
    end
  end
end<commit_msg>The logs_controller atom feed understands the new stats format as well<commit_after>#--
#   Copyright (C) 2008 <NAME> <<EMAIL>>
#
#   This program is free software: you can redistribute it and/or modify
#   it under the terms of the GNU Affero General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU Affero General Public License for more details.
#
#   You should have received a copy of the GNU Affero General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
#++

atom_feed do |feed|
  feed.title("Gitorious: #{@project.title} - #{@repository.name}")
  feed.updated((@commits.blank? ? nil : @commits.first.committed_date))
	
  @commits.each do |commit|
    item_url = "http://#{GitoriousConfig['gitorious_host']}" +  project_repository_commit_path(@project, @repository, commit.id)
    #stats.files.each do |filename, adds, deletes, total|
		commit_stat_data = commit.stats.files.map do |file, insertions, deletions, total| 
			[insertions.to_s.ljust(8, " "), deletions.to_s.ljust(8, " "), file].join
		end
    feed.entry(commit, {
      :url => item_url, 
      :updated => commit.committed_date, 
      :published => commit.committed_date
    }) do |entry|
      entry.title(truncate(commit.message, :length => 75))
      entry.content(<<-EOS, :type => 'html')
<h1>In #{@repository.gitdir} #{params[:id]}</h1>
<pre>
#{word_wrap commit.message}


Date:   #{commit.committed_date.strftime("%Y-%m-%d %H:%M")}
Author: #{commit.author.name}
Committer: #{commit.committer.name}

#{commit.stats.total} lines changed in #{commit.stats.files.length} files:
------------------------------------------------------------------------------
adds   dels     file
------------------------------------------------------------------------------
#{commit_stat_data.join("\n")}
<pre>
EOS
      entry.author do |author|
        author.name(commit.author.name)
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.19907300115874854, 'fraction_numerical': 0.0050984936268829665, 'mean_word_length': 2.7926186291739894, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3606090', 'n_tokens_mistral': 1321, 'n_tokens_neox': 1295, 'n_words': 381}