Merge branch 'darcs' into master
[git-darcs-import.git] / src / list_authors.hs
blob32b6359b4f7356811d3b3ebd6aa36df043aaa28e
1 -- Copyright (C) 2004 David Roundy
2 --
3 -- This program is free software; you can redistribute it and/or modify
4 -- it under the terms of the GNU General Public License as published by
5 -- the Free Software Foundation; either version 2, or (at your option)
6 -- any later version.
7 --
8 -- This program is distributed in the hope that it will be useful,
9 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
10 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 -- GNU General Public License for more details.
13 -- You should have received a copy of the GNU General Public License
14 -- along with this program; see the file COPYING. If not, write to
15 -- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 -- Boston, MA 02110-1301, USA.
18 module Main (main) where
20 import Darcs.Utils ( formatPath )
21 import Darcs.Repository ( withRepository, read_repo, ($-) )
22 import Darcs.Patch.Info ( pi_author )
23 import Darcs.Hopefully ( info )
24 import Darcs.Ordered ( mapRL, concatRL )
26 import Data.List ( sort, group )
27 import System ( getProgName, getArgs )
29 intro :: Bool -> IO String
30 intro do_stats = do
31 prog_name <- getProgName
32 return $
33 "This is a list of ALL contributors to darcs, sorted according to the\n"++
34 "number of patches they have contributed. This list is automatically\n"++
35 "created from the darcs repository, so if there are problems with it,\n"++
36 "changes should be made to list_authors.hs.\n"++
37 "\n" ++
38 (if do_stats
39 then ""
40 else ("Run " ++ formatPath (prog_name ++ " stats") ++
41 " for more detailed information.\n" ++ "\n"))
43 main :: IO ()
44 main = withRepository [] $- \repository ->
45 do darcs_history <- read_repo repository
46 use_statistics <- elem "stats" `fmap` getArgs
47 intro use_statistics >>= putStr
48 mapM_ putStrLn $ sort_authors use_statistics $ mapRL (pi_author.info)
49 $ concatRL darcs_history
51 droundy :: String
52 droundy = "David Roundy <droundy@darcs.net>"
54 -- contributers with more than 2 addresses
55 gwern_branwen,
56 marnix_klooster, eric_kow, andres_loeh,
57 simon_marlow, pekka_pessi,
58 erik_schnetter, edwin_thomson, mark_stosberg,
59 thomas_zander, tomasz_zielonka, lele_gaifax , christian_kellermann :: String
60 marnix_klooster = "Marnix Klooster <marnix.klooster@gmail.com>"
61 eric_kow = "Eric Kow <eric.kow@gmail.com>"
62 andres_loeh = "Andres Loeh <mail@andres-loeh.de>"
63 simon_marlow = "Simon Marlow <simonmar@microsoft.com>"
64 erik_schnetter = "Erik Schnetter <schnetter@cct.lsu.edu>"
65 gwern_branwen = "Gwern Branwen <gwern0@gmail.com>"
66 pekka_pessi = "Pekka Pessi <pekka.pessi@nokia.com>"
67 mark_stosberg = "Mark Stosberg <mark@summersault.com>"
68 edwin_thomson = "Edwin Thomson <edwin.thomson@businesswebsoftware.com>"
69 thomas_zander = "Thomas Zander <zander@kde.org>"
70 tomasz_zielonka = "Tomasz Zielonka <tomasz.zielonka@gmail.com>"
71 lele_gaifax = "Lele Gaifax <lele@nautilus.homeip.net>"
72 christian_kellermann = "Christian Kellermann <Christian.Kellermann@nefkom.net>"
74 -- contributers who only provided an email address, one for which we know the name
75 -- note that having an entry in this table counts as two addresses... so if there
76 -- another address used besides this entry, you should remove it from the table,
77 -- add a constant (above) and modify canonize_authors (below)
78 authors_sans_name :: [ (String, String) ]
79 authors_sans_name =
80 [ ("adam@megacz.com" , "Adam Megacz")
81 , ("aj@azure.humbug.org.au" , "Anthony Towns")
82 , ("andrew@pimlott.net" , "Andrew Pimlott")
83 , ("andrew@siaris.net" , "Andrew L Johnson")
84 , ("aoiko@cc.ece.ntua.gr" , "Aggelos Economopoulos")
85 , ("ben.franksen@online.de" , "Benjamin Franksen")
86 , ("brian@brianweb.net" , "Brian Alliet")
87 , ("chevalier@alum.wellesley.edu", "Kirsten Chevalier")
88 , ("chucky@dtek.chalmers.se" , "Anders Hockersten")
89 , ("dgorin@dc.uba.ar" , "Daniel Gorin")
90 , ("dbindner@truman.edu" , "Don Bindner")
91 , ("dons@cse.unsw.edu.au" , "Don Stewart")
92 , ("egli@apache.org" , "Christian Egli")
93 , ("ei@vuokko.info" , "Esa Ilari Vuokko")
94 , ("era+darcs@iki.fi" , "Era Eriksson")
95 , ("eric@rti-zone.org" , "Eric Gaudet")
96 , ("florent.becker@ens-lyon.org", "Florent Becker")
97 , ("forge@dr.ea.ms" , "Andrew J. Kroll")
98 , ("fw@deneb.enyo.de" , "Florian Weimer")
99 , ("gaetan.lehmann@jouy.inra.fr", "Gaetan Lehmann")
100 , ("glaweh@physik.fu-berlin.de", "Henning Glawe")
101 , ("ijones@debian.org" , "Isaac Jones")
102 , ("jan@informatik.unibw-muenchen.de", "Jan Scheffczyk")
103 , ("janbraun@gmx.net" , "Jan Braun")
104 , ("jani@iv.ro" , "Jani Monoses")
105 , ("jch@pps.jussieu.fr" , "Juliusz Chroboczek" )
106 , ("jemfinch@supybot.com" , "Jeremy Fincher")
107 , ("joe@elem.com" , "Joe Edmonds")
108 , ("kannan@cakoose.com" , "Kannan Goundan")
109 , ("ketil@ii.uib.no" , "Ketil Malde")
110 , ("kili@outback.escape.de" , "Matthias Kilian")
111 , ("lord@crocodile.org" , "Vadim Zaliva")
112 , ("malebria@riseup.net" , "Marco Tulio Gontijo e Silva")
113 , ("me@JonathonMah.com" , "Jonathon Mah")
114 , ("me@mornfall.net" , "Peter Rockai")
115 , ("naesten@myrealbox.com" , "Samuel Bronson")
116 , ("naur@post11.tele.dk" , "Thorkil Naur")
117 , ("nicolas.pouillard@gmail.com" , "Nicolas Pouillard")
118 , ("nils@ndecker.de" , "Nils Decker")
119 , ("nwf@cs.jhu.edu" , "Nathaniel Filardo")
120 , ("peter.maxwell@anu.edu.au", "Peter Maxwell")
121 , ("peter@syncad.com" , "Peter Hercek")
122 , ("peter@zarquon.se" , "Peter Strand")
123 , ("petersen@haskell.org" , "Jens Petersson")
124 , ("ptp@lysator.liu.se" , "Tommy Pettersson")
125 , ("ralph@inputplus.co.uk" , "Ralph Corderoy")
126 , ("rho@swiftdsl.com.au" , "Nigel Rowe")
127 , ("schaffner@gmx.li" , "Martin Schaffner")
128 , ("schwern@pobox.com" , "Michael G Schwern")
129 , ("sean.robinson@sccmail.maricopa.edu", "Sean Robinson")
130 , ("ser@germane-software.com", "Sean Russell")
131 , ("shae@ScannedInAvian.com" , "Shae Erisson")
132 , ("simon@joyful.com" , "Simon Michael")
133 , ("simons@cryp.to" , "Peter Simons")
134 , ("smithbone@gmail.com" , "Richard Smith")
135 , ("sreindl@triobit.de" , "Stephen Reindl")
136 , ("thies@thieso.net" , "Thies C. Arntzen")
137 , ("thomas_bevan@toll.com.au", "Thomas L. Bevan")
138 , ("tux_rocker@reinier.de" , "Reinier Lamers")
139 , ("trivee@noir.crocodile.org", "Vladimir Vysotsky")
140 , ("v.haisman@sh.cvut.cz" , "Vaclav Haisman")
141 , ("vborja@thehatcher.com" , "Victor Hugo Borja Rodriguez")
142 , ("wnoise@ofb.net" , "Aaron Denney")
143 , ("xhl178@shaw.ca" , "Randy Roesler")
144 , ("zooko@zooko.com" , "Bryce Wilcox-O'Hearn") ]
146 canonize_author :: String -> String
147 canonize_author "David" = droundy
148 canonize_author "Tomasz Zielonka <t.zielonka@students.mimuw.edu.pl>" = tomasz_zielonka
149 canonize_author "Tomasz Zielonka <tomekz@gemius.pl>" = tomasz_zielonka
150 canonize_author "zander@kde.org" = thomas_zander
151 canonize_author "mail@andres-loeh.de" = andres_loeh
152 canonize_author "Andres Loeh <andres@cs.uu.nl>" = andres_loeh
153 canonize_author "Andres Loeh <loeh@iai.uni-bonn.de>" = andres_loeh
154 canonize_author "benjamin.franksen@bessy.de" = "Benjamin Franksen <ben.franksen@online.de>"
155 canonize_author "Lennart Kolmodin <kolmodin@dtek.chalmers.se>" = "Lennart Kolmodin <kolmodin@gentoo.org>"
156 canonize_author "kow@loria.fr" = eric_kow
157 canonize_author "Eric Kow <eric.kow@loria.fr>" = eric_kow
158 canonize_author "Eric Kow <E.Y.Kow@brighton.ac.uk>" = eric_kow
159 canonize_author "schnetter@aei.mpg.de" = erik_schnetter
160 canonize_author "Erik Schnetter <schnetter@aei.mpg.de>" = erik_schnetter
161 canonize_author "edwin.thomson@businesswebsoftware.com" = edwin_thomson
162 canonize_author "edwin.thomson@gmail.com" = edwin_thomson
163 canonize_author "Kirill Smelkov <kirr@mns.spb.ru>" = "Kirill Smelkov <kirr@landau.phys.spbu.ru>"
164 canonize_author "mark@summersault.com" = mark_stosberg
165 canonize_author "jvr+darcs@blub.net" = "Joeri van Ruth <jvr@blub.net>"
166 canonize_author "testerALL --ignore-times" = mark_stosberg
167 canonize_author "lele@seldati.it" = lele_gaifax
168 canonize_author "lele@nautilus.homeip.net" = lele_gaifax
169 canonize_author "gwern0@gmail.com" = gwern_branwen
170 canonize_author "Trent W. Buck <twb@cyber.com.au>" = "Trent W. Buck <trentbuck@gmail.com>"
171 canonize_author "Pekka.Pessi@nokia.com" = pekka_pessi
172 canonize_author "Pekka Pessi <first.last@nokia.com>" = pekka_pessi
173 canonize_author "Pekka Pessi <ppessi@gmail.com>" = pekka_pessi
174 canonize_author "Pekka Pessi <pekka@pessi.fi>" = pekka_pessi
175 canonize_author "Simon Marlow <marlowsd@gmail.com>" = simon_marlow
176 canonize_author "" = gwern_branwen
178 canonize_author s
179 | s `contains` "roundy" = droundy
180 | s `contains` "igloo" = "Ian Lynagh <igloo@earth.li>"
181 | s `contains` "Thomas Zander" = thomas_zander
182 | s `contains` "marnix.klooster@" = marnix_klooster
183 | s `contains` "marnix_klooster" = marnix_klooster
184 | s `contains` "mklooster@baan.nl" = marnix_klooster
185 | s `contains` "mirian@" = "Mirian Crzig Lennox <mirian@cosmic.com>"
186 | s `contains` "zbrown" = "Zack Brown <zbrown@tumblerings.org>"
187 | s `contains` "daniel.buenzli@epfl.ch" = "Daniel Buenzli <daniel.buenzli@epfl.ch>" -- avoid an accent
188 | s `contains` "Kellermann" = christian_kellermann
189 canonize_author s =
190 if (not.null) eaLst
191 then (uncurry add_name_to_mail) $ head eaLst
192 else s
193 where eaLst = [ ea | ea <- authors_sans_name, fst ea == s ]
195 sort_authors :: Bool -> [String] -> [String]
196 sort_authors use_stats as = reverse $ map shownames $ sort $
197 map (\s -> (length s,head s)) $
198 group $ sort $ map canonize_author as
199 where shownames (n, a) = if use_stats
200 then show n ++ "\t" ++ a
201 else a
203 contains :: String -> String -> Bool
204 a `contains` b | length a < length b = False
205 | take (length b) a == b = True
206 | otherwise = tail a `contains` b
208 add_name_to_mail :: String -> String -> String
209 add_name_to_mail m n = n ++ " <" ++ m ++ ">"