comparison extra/soundsoftware/create-repo-authormaps.rb @ 1552:3a2254124fa8 feature_1136

Discard certain malformed email addresses
author Chris Cannam
date Wed, 13 Jan 2016 11:14:28 +0000
parents fd4cc11ae096
children baac54711ee9
comparison
equal deleted inserted replaced
1551:36dddb6755f6 1552:3a2254124fa8
91 91
92 committers = repo.committers 92 committers = repo.committers
93 93
94 authormap = "" 94 authormap = ""
95 committers.each do |c, uid| 95 committers.each do |c, uid|
96
97 # Some of our repos have broken email addresses in them: e.g. one
98 # changeset has a committer name of the form
99 #
100 # NAME <name <NAME <name@example.com">
101 #
102 # I don't know how it got like that... If the committer has more
103 # than one '<' in it, truncate it just before the first one, and
104 # then we look up the author name again.
105 if c =~ /<.*</ then
106 c = c.sub(/\s*<.*$/, "")
107 end
108
96 if not c =~ /[^<]+<.*@.*>/ then 109 if not c =~ /[^<]+<.*@.*>/ then
97 user = User.find_by_id uid 110 user = User.find_by_id uid
98 authormap << "#{c}=#{user.name} <#{user.mail}>\n" unless user.nil? 111 authormap << "#{c}=#{user.name} <#{user.mail}>\n" unless user.nil?
99 end 112 end
100 end 113 end