// // aegis - project change supervisor // Copyright (C) 2001-2008, 2011, 2012, 2014 Peter Miller // Copyright (C) 2008 Walter Franzini // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 3 of the License, or (at // your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . // #include #include #include time_t change_history_delta_to_timestamp(project *pp, long delta_number) { cstate_ty *cstate_data; cstate_branch_history_list_ty *hl; size_t j; change::pointer cp; cp = pp->change_get(); cstate_data = cp->cstate_get(); if (!cstate_data->branch) return (time_t)-1; if (delta_number == 0) { // // special case, meaning // "when the branch was created" // if (cstate_data->history && cstate_data->history->length) return cstate_data->history->list[0]->when; return (time_t)-1; } hl = cstate_data->branch->history; if (!hl) return (time_t)-1; for (j = 0; j < hl->length; ++j) { cstate_branch_history_ty *bh; change::pointer cp2; time_t result; bh = hl->list[j]; assert(bh); if (!bh) continue; if (bh->delta_number != delta_number) continue; if (bh->when != TIME_NOT_SET) return bh->when; cp2 = change::create(pp, bh->change_number); cp2->bind_existing(); result = cp2->completion_timestamp(); return result; } return (time_t)-1; } // vim: set ts=8 sw=4 et :