Merge branch '2.4.2' of ssh://git.tasktools.org/tm/task into 2.4.2

This commit is contained in:
Paul Beckingham 2015-03-02 16:17:09 -05:00
commit 96185cbd61
3 changed files with 26 additions and 70 deletions

View file

@ -275,7 +275,7 @@ int Context::initialize (int argc, const char** argv)
////////////////////////////////////////////////////////////////////////////
//
// [8] Run on.launch hooks.
// [8] Initialize hooks.
//
////////////////////////////////////////////////////////////////////////////

View file

@ -1180,17 +1180,20 @@ int TDB2::gc ()
if (context.config.getBoolean ("gc"))
{
std::vector <Task> pending_tasks = pending.get_tasks ();
// TODO Thread.
std::vector <Task> completed_tasks = completed.get_tasks ();
// TODO Assume pending < completed, therefore there is room here to process
// data before joining with the completed.data thread.
bool pending_changes = false;
bool completed_changes = false;
std::vector <Task> pending_tasks_after;
std::vector <Task> completed_tasks_after;
// Reduce unnecessary allocation/copies.
pending_tasks_after.reserve (pending_tasks.size ());
completed_tasks_after.reserve (completed_tasks.size ());
// Scan all pending tasks, looking for any that need to be relocated to
// completed, or need to be 'woken'.
@ -1227,6 +1230,11 @@ int TDB2::gc ()
}
}
// TODO Join completed.data thread.
// Reduce unnecessary allocation/copies.
completed_tasks_after.reserve (completed_tasks.size ());
// Scan all completed tasks, looking for any that need to be relocated to
// pending.
for (task = completed_tasks.begin ();

View file

@ -84,78 +84,26 @@ qx{../src/task rc:$rc add testing project:.myProject. 2>&1 >/dev/null};
$output = qx{../src/task rc:$rc projects 2>&1};
my @lines = split ('\n',$output);
# It's easier to make a pattern for the end than the beginning because priority
# counts are more predictable than project names.
my $project_name_column;
if ($lines[4] =~ s/\d+$//)
{
$project_name_column = $lines[4];
}
else
{
$project_name_column = "error";
}
like ($project_name_column, qr/^\.myProject\s*$/, "$ut: '.myProject' not indented");
my ($project_name_column) = $lines[4] =~ /^(\s*\S+)/;
like ($project_name_column, qr/^\.myProject$/, "$ut: '.myProject' not indented");
if ($lines[5] =~ s/\d+$//)
{
$project_name_column = $lines[5];
}
else
{
$project_name_column = "error";
}
like ($project_name_column, qr/^\.myProject\.\s*$/, "$ut: '.myProject.' not indented");
($project_name_column) = $lines[5] =~ /^(\s*\S+)/;
like ($project_name_column, qr/^\.myProject\.$/, "$ut: '.myProject.' not indented");
if ($lines[6] =~ s/\d+$//)
{
$project_name_column = "error";
}
else
{
$project_name_column = $lines[6];
}
like ($project_name_column, qr/^abstractParent\s*$/, "$ut: abstract parent not indented and no priority columns");
($project_name_column) = $lines[6] =~ /^(\s*\S+)/;
like ($project_name_column, qr/^abstractParent$/, "$ut: abstract parent not indented");
if ($lines[7] =~ s/\d+$//)
{
$project_name_column = $lines[7];
}
else
{
$project_name_column = "error";
}
like ($project_name_column, qr/^ kid\s*$/, "$ut: child indented and without parent name");
($project_name_column) = $lines[7] =~ /^(\s*\S+)/;
like ($project_name_column, qr/^ kid$/, "$ut: child indented and without parent name");
if ($lines[8] =~ s/\d+$//)
{
$project_name_column = $lines[8];
}
else
{
$project_name_column = "error";
}
like ($project_name_column, qr/^existingParent\s*$/, "$ut: existing parent not indented and has priority columns");
($project_name_column) = $lines[8] =~ /^(\s*\S+)/;
like ($project_name_column, qr/^existingParent$/, "$ut: existing parent not indented");
if ($lines[9] =~ s/\d+$//)
{
$project_name_column = $lines[9];
}
else
{
$project_name_column = "error";
}
like ($project_name_column, qr/^ child\s*$/, "$ut: child of existing parent indented and without parent name");
($project_name_column) = $lines[9] =~ /^(\s*\S+)/;
like ($project_name_column, qr/^ child$/, "$ut: child of existing parent indented and without parent name");
if ($lines[12] =~ s/\d+$//)
{
$project_name_column = $lines[12];
}
else
{
$project_name_column = "error";
}
like ($project_name_column, qr/^myProject\.\s*$/, "$ut: 'myProject.' not indented");
($project_name_column) = $lines[12] =~ /^(\s*\S+)/;
like ($project_name_column, qr/^myProject\.$/, "$ut: 'myProject.' not indented");
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data), $rc;