comparison extra/soundsoftware/create-repo-authormaps.rb @ 1542:60acfbd8f6d6 live

Use simpler saved committer list; ignore -e option (used for env)
author Chris Cannam
date Tue, 02 Jun 2015 12:25:31 +0100
parents 322d7b57e5f0
children 05d639e5d59b
comparison
equal deleted inserted replaced
1541:2696466256ff 1542:60acfbd8f6d6
27 27
28 require 'getoptlong' 28 require 'getoptlong'
29 29
30 opts = GetoptLong.new( 30 opts = GetoptLong.new(
31 ['--scm-dir', '-s', GetoptLong::REQUIRED_ARGUMENT], 31 ['--scm-dir', '-s', GetoptLong::REQUIRED_ARGUMENT],
32 ['--out-dir', '-o', GetoptLong::REQUIRED_ARGUMENT] 32 ['--out-dir', '-o', GetoptLong::REQUIRED_ARGUMENT],
33 ['--environment', '-e', GetoptLong::REQUIRED_ARGUMENT]
33 ) 34 )
34 35
35 $repos_base = '' 36 $repos_base = ''
36 $out_base = '' 37 $out_base = ''
37 38
79 next if repo.nil? or repo.url.empty? 80 next if repo.nil? or repo.url.empty?
80 81
81 repo_url = repo.url 82 repo_url = repo.url
82 repo_url = repo_url.gsub(/^file:\/*/, "/"); 83 repo_url = repo_url.gsub(/^file:\/*/, "/");
83 if repo_url != File.join($repos_base, proj.identifier) 84 if repo_url != File.join($repos_base, proj.identifier)
84 puts 'Project #{proj.identifier} has repo in unsupported location #{repo_url}, skipping' 85 puts "Project #{proj.identifier} has repo in unsupported location #{repo_url}, skipping"
85 next 86 next
86 end 87 end
87 88
88 csets = repo.changesets 89 committers = repo.committers
89 committers = csets.map do |c| c.committer end.sort.uniq
90 90
91 authormap = "" 91 authormap = ""
92 committers.each do |c| 92 committers.each do |c, uid|
93 if not c =~ /[^<]+<.*@.*>/ then 93 if not c =~ /[^<]+<.*@.*>/ then
94 user = repo.find_committer_user c 94 user = User.find_by_id uid
95 authormap << "#{c}=#{user.name} <#{user.mail}>\n" unless user.nil? 95 authormap << "#{c}=#{user.name} <#{user.mail}>\n" unless user.nil?
96 end 96 end
97 end 97 end
98 98
99 File.open(File.join($out_base, "authormap_#{proj.identifier}"), "w") do |f| 99 File.open(File.join($out_base, "authormap_#{proj.identifier}"), "w") do |f|