1 //
2 // aegis - project change supervisor
3 // Copyright (C) 2004-2008, 2012 Peter Miller
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see
17 // <http://www.gnu.org/licenses/>.
18 //
19
20 #include <libaegis/change.h>
21 #include <common/str_list.h>
22 #include <common/symtab.h>
23 #include <common/trace.h>
24
25
26 void
change_reviewer_list(change::pointer cp,string_list_ty & result)27 change_reviewer_list(change::pointer cp, string_list_ty &result)
28 {
29 trace(("change_reviewer_list(cp = %p, result = &%p)\n{\n", cp, &result));
30 //
31 // Recapitulate the change's history, tracking review passes,
32 // rescinds and failures.
33 //
34 cstate_ty *cstate_data = cp->cstate_get();
35 symtab_ty review_st;
36 for (size_t i = 0; i < cstate_data->history->length; ++i)
37 {
38 cstate_history_ty *hp = cstate_data->history->list[i];
39 switch (hp->what)
40 {
41 case cstate_history_what_develop_end:
42 case cstate_history_what_review_fail:
43 case cstate_history_what_integrate_fail:
44 // When aede happens, all reviews are null and void.
45 review_st.clear();
46 break;
47
48 case cstate_history_what_review_pass:
49 //
50 // The last thing in the list will be a review pass state
51 // transition, because the history row has been added, but
52 // not yet committed. The return value from this fucntion
53 // may cause the hp->what value of the last row to be
54 // changed.
55 //
56 // fall through...
57 case cstate_history_what_review_pass_2ar:
58 case cstate_history_what_review_pass_2br:
59 review_st.assign(hp->who, hp);
60 break;
61
62 case cstate_history_what_review_pass_undo:
63 case cstate_history_what_review_pass_undo_2ar:
64 // Reviewer rescinded his blessing
65 review_st.remove(hp->who);
66 break;
67
68 case cstate_history_what_develop_begin:
69 case cstate_history_what_develop_begin_undo:
70 case cstate_history_what_develop_end_2ai:
71 case cstate_history_what_develop_end_2ar:
72 case cstate_history_what_develop_end_undo:
73 case cstate_history_what_integrate_begin:
74 case cstate_history_what_integrate_begin_undo:
75 case cstate_history_what_integrate_pass:
76 case cstate_history_what_new_change:
77 case cstate_history_what_review_begin:
78 case cstate_history_what_review_begin_undo:
79 #ifndef DEBUG
80 default:
81 #endif
82 break;
83 }
84 }
85
86 //
87 // The keys of the symbol table are the reviewers.
88 //
89 result.clear();
90 review_st.keys(&result);
91 trace(("}\n"));
92 }
93
94
95 // vim: set ts=8 sw=4 et :
96