Mercurial > hg > soundsoftware-site
comparison extra/soundsoftware/create-repo-authormaps.rb @ 1553:baac54711ee9 feature_1136
Attempt to fix that properly
author | Chris Cannam |
---|---|
date | Wed, 13 Jan 2016 11:19:42 +0000 |
parents | 3a2254124fa8 |
children | e5c9809534a2 |
comparison
equal
deleted
inserted
replaced
1552:3a2254124fa8 | 1553:baac54711ee9 |
---|---|
99 # | 99 # |
100 # NAME <name <NAME <name@example.com"> | 100 # NAME <name <NAME <name@example.com"> |
101 # | 101 # |
102 # I don't know how it got like that... If the committer has more | 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 | 103 # than one '<' in it, truncate it just before the first one, and |
104 # then we look up the author name again. | 104 # then look up the author name again. |
105 # | |
105 if c =~ /<.*</ then | 106 if c =~ /<.*</ then |
107 # So this is a completely pathological case | |
106 c = c.sub(/\s*<.*$/, "") | 108 c = c.sub(/\s*<.*$/, "") |
107 end | 109 user = User.find_by_id uid |
108 | 110 if user.nil? then |
109 if not c =~ /[^<]+<.*@.*>/ then | 111 # because the given committer is bogus, we must write something in the map |
112 authormap << "#{c}=#{user.name} <unknown@example.com>\n" | |
113 else | |
114 authormap << "#{c}=#{user.name} <#{user.mail}>\n" | |
115 end | |
116 elsif not c =~ /[^<]+<.*@.*>/ then | |
117 # This is the "normal" case that needs work, where a user has | |
118 # their name in the commit but no email address | |
110 user = User.find_by_id uid | 119 user = User.find_by_id uid |
111 authormap << "#{c}=#{user.name} <#{user.mail}>\n" unless user.nil? | 120 authormap << "#{c}=#{user.name} <#{user.mail}>\n" unless user.nil? |
112 end | 121 end |
113 end | 122 end |
114 | 123 |