//
// aegis - project change supervisor
// Copyright (C) 1999, 2002-2008, 2012, 2014 Peter Miller
//
// 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
#include
#include
void
change::bind_existing(void)
{
trace(("%s\n{\n", __PRETTY_FUNCTION__));
bind_existing_inner(false);
trace(("}\n"));
}
bool
change::bind_existing_errok(void)
{
trace(("%s\n{\n", __PRETTY_FUNCTION__));
return bind_existing_inner(true);
trace(("}\n"));
}
bool
change::bind_existing_inner(bool errok)
{
trace(("%s\n{\n", __PRETTY_FUNCTION__));
//
// verify the change number given on the command line
//
if (is_trunk())
{
trace(("return true;\n"));
trace(("}\n"));
return true;
}
change::pointer pcp = project_get()->change_get();
cstate_ty *pcsp = pcp->cstate_get();
if (!pcsp->branch)
{
assert(0);
pcsp->branch = (cstate_branch_ty *)cstate_branch_type.alloc();
}
if (!pcsp->branch->change)
{
pcsp->branch->change =
(cstate_branch_change_list_ty *)
cstate_branch_change_list_type.alloc();
}
cstate_branch_change_list_ty *lp = pcsp->branch->change;
for (size_t j = 0; j < lp->length; ++j)
{
if (lp->list[j] == number_get())
{
trace(("return true;\n"));
trace(("}\n"));
return true;
}
}
if (!errok)
change_fatal(this, NULL, i18n("unknown change"));
trace(("return false;\n"));
trace(("}\n"));
return false;
}
// vim: set ts=8 sw=4 et :