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

This commit is contained in:
Paul Beckingham 2014-08-22 22:38:16 -04:00
commit 62725c97e4
3 changed files with 16 additions and 55 deletions

View file

@ -309,32 +309,23 @@ void Parser::collect (
if (tree == NULL)
tree = _tree;
if (type == collectAll || tree->_branches.size () == 0)
nodes.push_back (tree);
std::vector <Tree*>::iterator i;
for (i = tree->_branches.begin (); i != tree->_branches.end (); ++i)
{
if ((*i)->_branches.size ())
if (type == collectLeaf)
{
if (type == collectAll)
nodes.push_back (*i);
if ((*i)->hasTag ("TERMINATOR") ||
(*i)->hasTag ("TERMINATED"))
break;
collect (nodes, type, *i);
if (! (*i)->hasTag ("?"))
continue;
}
else
{
if (type == collectLeaf)
{
// Parser override operator.
if ((*i)->hasTag ("TERMINATOR") ||
(*i)->hasTag ("TERMINATED"))
break;
// Skip known args.
if (! (*i)->hasTag ("?"))
continue;
}
nodes.push_back (*i);
}
collect (nodes, type, *i);
}
}
@ -789,7 +780,7 @@ const std::vector <std::string> Parser::getWords () const
{
std::vector <std::string> words;
std::vector <Tree*> nodes;
collect (nodes, collectTerminated);
collect (nodes, collectAll);
std::vector <Tree*>::iterator i;
for (i = nodes.begin (); i != nodes.end (); ++i)
{
@ -1585,7 +1576,6 @@ void Parser::findModifications ()
{
context.debug ("Parser::findModifications");
bool action = false;
bool after_writecmd = false;
std::vector <Tree*> nodes;
@ -1594,9 +1584,10 @@ void Parser::findModifications ()
for (i = nodes.begin (); i != nodes.end (); ++i)
{
if ((*i)->hasTag ("WRITECMD"))
{
after_writecmd = true;
if (after_writecmd &&
}
else if (after_writecmd &&
! (*i)->hasTag ("CMD") &&
! (*i)->hasTag ("TERMINATOR") &&
! (*i)->hasTag ("BINARY") &&

View file

@ -273,7 +273,8 @@ void Tree::dumpNode (Tree* t, int depth, std::stringstream& output)
for (int i = 0; i < depth; ++i)
output << " ";
output << "\033[1m" << t->_name << "\033[0m";
output << std::hex << t << " "
<< "\033[1m" << t->_name << "\033[0m";
// Dump attributes.
std::string atts;

View file

@ -441,7 +441,6 @@ int CmdInfo::execute (std::string& output)
std::string previous;
std::string current;
unsigned int i = 0;
long total_time = 0;
long last_timestamp = 0;
while (i < undo.size ())
{
@ -465,39 +464,9 @@ int CmdInfo::execute (std::string& output)
Task before (previous.substr (4));
Task after (current.substr (4));
journal.set (row, 1, taskInfoDifferences (before, after, dateformat, last_timestamp, timestamp.toEpoch()));
// calculate the total active time
if (before.get ("start") == ""
&& after.get ("start") != "")
{
// task started
total_time -= timestamp.toEpoch ();
}
else if (((before.get ("start") != "" &&
after.get ("start") == "") ||
(before.get ("status") != "completed" &&
after.get ("status") == "completed")) &&
total_time < 0)
{
// task stopped or done
total_time += timestamp.toEpoch ();
}
}
}
}
// add now() if task is still active
if (total_time < 0)
total_time += Date ().toEpoch ();
// print total active time
if (total_time > 0)
{
row = journal.addRow ();
journal.set (row, 0, STRING_CMD_INFO_TOTAL_ACTIVE);
journal.set (row, 1, Duration (total_time).formatPrecise (),
(context.color () ? Color ("bold") : Color ()));
}
}
out << optionalBlankLine ()