2009-09-28 Fumitoshi Ukai <ukai@chromium.org>
[WebKit-https.git] / WebKitTools / Scripts / modules / committers.py
1 # Copyright (c) 2009, Google Inc. All rights reserved.
2
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are
5 # met:
6
7 #     * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer.
9 #     * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer
11 # in the documentation and/or other materials provided with the
12 # distribution.
13 #     * Neither the name of Google Inc. nor the names of its
14 # contributors may be used to endorse or promote products derived from
15 # this software without specific prior written permission.
16
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 #
29 # WebKit's Python module for committer and reviewer validation
30
31 class Committer:
32     def __init__(self, name, email):
33         self.full_name = name
34         self.bugzilla_email = email
35         self.can_review = False
36
37     def __str__(self):
38         return '"%s" <%s>' % (self.full_name, self.bugzilla_email)
39
40 class Reviewer(Committer):
41     def __init__(self, name, email):
42         Committer.__init__(self, name, email)
43         self.can_review = True
44
45 # All reviewers are committers, so this list is only of committers
46 # who are not reviewers.
47 committers_unable_to_review = [
48     Committer("Adam Langley", "agl@chromium.org"),
49     Committer("Albert J. Wong", "ajwong@chromium.org"),
50     Committer("Ben Murdoch", "benm@google.com"),
51     Committer("Brent Fulgham", "bfulgham@webkit.org"),
52     Committer("Brian Weinstein", "bweinstein@apple.com"),
53     Committer("Daniel Bates", "dbates@webkit.org"),
54     Committer("Drew Wilson", "atwilson@chromium.org"),
55     Committer("Dirk Schulze", "krit@webkit.org"),
56     Committer("Fumitoshi Ukai", "ukai@chromium.org"),
57     Committer("Greg Bolsinga", "bolsinga@apple.com"),
58     Committer("Jeremy Orlow", "jorlow@chromium.org"),
59     Committer("Joseph Pecoraro", "joepeck@webkit.org"),
60     Committer("Kenneth Rohde Christiansen", "kenneth@webkit.org"),
61     Committer("Laszlo Gombos", "laszlo.1.gombos@nokia.com"),
62     Committer("Nate Chapin", "japhet@chromium.org"),
63     Committer("Peter Kasting", "pkasting@google.com"),
64     Committer("Pierre d'Herbemont", "pdherbemont@free.fr"),
65     Committer("Ryosuke Niwa", "rniwa@webkit.org"),
66     Committer("Shinichiro Hamaji", "hamaji@chromium.org"),
67     Committer("Tony Chang", "tony@chromium.org"),
68     Committer("Yael Aharon", "yael.aharon@nokia.com"),
69     Committer("Yong Li", "yong.li@torchmobile.com"),
70     Committer("Zoltan Horvath", "zoltan@webkit.org"),
71 ]
72
73 reviewers_list = [
74     Reviewer("Adam Barth", "abarth@webkit.org"),
75     Reviewer("Adam Roben", "aroben@apple.com"),
76     Reviewer("Adam Treat", "treat@kde.org"),
77     Reviewer("Adele Peterson", "adele@apple.com"),
78     Reviewer("Alexey Proskuryakov", "ap@webkit.org"),
79     Reviewer("Anders Carlsson", "andersca@apple.com"),
80     Reviewer("Antti Koivisto", "koivisto@iki.fi"),
81     Reviewer("Ariya Hidayat", "ariya.hidayat@trolltech.com"),
82     Reviewer("Brady Eidson", "beidson@apple.com"),
83     Reviewer("Dan Bernstein", "mitz@webkit.org"),
84     Reviewer("Darin Adler", "darin@apple.com"),
85     Reviewer("Darin Fisher", "fishd@chromium.org"),
86     Reviewer("David Hyatt", "hyatt@apple.com"),
87     Reviewer("David Kilzer", "ddkilzer@webkit.org"),
88     Reviewer("David Levin", "levin@chromium.org"),
89     Reviewer("Dimitri Glazkov", "dglazkov@chromium.org"),
90     Reviewer("Eric Carlson", "eric.carlson@apple.com"),
91     Reviewer("Eric Seidel", "eric@webkit.org"),
92     Reviewer("Gavin Barraclough", "barraclough@apple.com"),
93     Reviewer("George Staikos", "staikos@kde.org"),
94     Reviewer("Gustavo Noronha", "gns@gnome.org"),
95     Reviewer("Holger Freyther", "zecke@selfish.org"),
96     Reviewer("Jan Alonzo", "jmalonzo@gmail.com"),
97     Reviewer("John Sullivan", "sullivan@apple.com"),
98     Reviewer("Justin Garcia", "justin.garcia@apple.com"),
99     Reviewer("Kevin McCullough", "kmccullough@apple.com"),
100     Reviewer("Kevin Ollivier", "kevino@theolliviers.com"),
101     Reviewer("Maciej Stachowiak", "mjs@apple.com"),
102     Reviewer("Mark Rowe", "mrowe@apple.com"),
103     Reviewer("Nikolas Zimmermann", "zimmermann@kde.org"),
104     Reviewer("Oliver Hunt", "oliver@apple.com"),
105     Reviewer("Sam Weinig", "sam@webkit.org"),
106     Reviewer("Simon Fraser", "simon.fraser@apple.com"),
107     Reviewer("Simon Hausmann", "hausmann@webkit.org"),
108     Reviewer("Steve Falkenburg", "sfalken@apple.com"),
109     Reviewer("Timothy Hatcher", "timothy@hatcher.name"),
110     Reviewer(u'Tor Arne Vestb\xf8', "vestbo@webkit.org"),
111     Reviewer("Xan Lopez", "xan.lopez@gmail.com"),
112 ]
113
114
115 class CommitterList:
116     # Committers and reviewers are passed in to allow easy testing
117     def __init__(self, committers=committers_unable_to_review, reviewers=reviewers_list):
118         self._committers = committers + reviewers
119         self._reviewers = reviewers
120         self._committers_by_email = {}
121
122     def committers(self):
123         return self._committers
124
125     def _email_to_committer_map(self):
126         if not len(self._committers_by_email):
127             for committer in self._committers:
128                 self._committers_by_email[committer.bugzilla_email] = committer
129         return self._committers_by_email
130
131     def committer_by_bugzilla_email(self, bugzilla_email):
132         return self._email_to_committer_map().get(bugzilla_email)
133
134     def reviewer_by_bugzilla_email(self, bugzilla_email):
135         committer = self.committer_by_bugzilla_email(bugzilla_email)
136         if committer and not committer.can_review:
137             return None
138         return committer