1/*
2 *	aegis - project change supervisor
3 *	Copyright (C) 2005-2008 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 */
19title("Project Parentage Report", sprintf("Project \"%s\"", project_name()));
20columns
21(
22    { name = "Project Branch\n---------------"; width = 15; },
23    { name = "State\n-------"; width = 15; },
24    { name = "Start\n-------"; width = 11; },
25    { name = "Finish\n-------"; width = 11; },
26    { name = "Description\n-----------"; right = 0; }
27);
28auto pn, ps;
29pn = project_name();
30while (pn != "")
31{
32    /*
33     * If we print "pn" we could get an alias.
34     * By printing "ps.name" we get the actual name of the project.
35     */
36    ps = project[pn].state;
37
38    auto start, finish;
39    start = strftime("%Y-%b-%d", ps.history[0].when);
40    if (ps.state == completed)
41    {
42	finish = ps.history[count(ps.history) - 1].when;
43	finish = strftime("%Y-%b-%d", finish);
44    }
45    print(ps.name, ps.state, start, finish, ps.brief_description);
46
47    /*
48     * Move on up the tree.
49     */
50    pn = ps.parent_name;
51}
52