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

This commit is contained in:
Paul Beckingham
2015-06-30 07:54:22 -04:00
36 changed files with 324 additions and 750 deletions

View File

@@ -73,7 +73,8 @@ void Filter::subset (const std::vector <Task>& input, std::vector <Task>& output
context.timer_filter.start ();
_startCount = (int) input.size ();
// context.cli2.prepareFilter (applyContext);
context.cli2.prepareFilter (applyContext);
std::vector <std::pair <std::string, Lexer::Type>> precompiled;
for (auto& a : context.cli2._args)
if (a.hasTag ("FILTER"))
@@ -118,6 +119,8 @@ void Filter::subset (std::vector <Task>& output, bool applyContext /* = true */)
{
context.timer_filter.start ();
context.cli2.prepareFilter (applyContext);
std::vector <std::pair <std::string, Lexer::Type>> precompiled;
for (auto& a : context.cli2._args)
if (a.hasTag ("FILTER"))
@@ -179,7 +182,7 @@ void Filter::subset (std::vector <Task>& output, bool applyContext /* = true */)
}
else
{
safety (precompiled.size ());
safety ();
context.timer_filter.stop ();
for (auto& task : context.tdb2.pending.get_tasks ())
@@ -258,7 +261,7 @@ bool Filter::pendingOnly ()
////////////////////////////////////////////////////////////////////////////////
// Disaster avoidance mechanism. If a WRITECMD has no filter, then it can cause
// all tasks to be modified. This is usually not intended.
void Filter::safety (unsigned int terms)
void Filter::safety ()
{
for (auto& a : context.cli2._args)
{
@@ -266,19 +269,16 @@ void Filter::safety (unsigned int terms)
{
if (a.hasTag ("WRITECMD"))
{
if (terms)
{
if (! context.config.getBoolean ("allow.empty.filter"))
throw std::string (STRING_TASK_SAFETY_ALLOW);
if (! context.config.getBoolean ("allow.empty.filter"))
throw std::string (STRING_TASK_SAFETY_ALLOW);
// If user is willing to be asked, this can be avoided.
if (context.config.getBoolean ("confirmation") &&
confirm (STRING_TASK_SAFETY_VALVE))
return;
// If user is willing to be asked, this can be avoided.
if (context.config.getBoolean ("confirmation") &&
confirm (STRING_TASK_SAFETY_VALVE))
return;
// Sounds the alarm.
throw std::string (STRING_TASK_SAFETY_FAIL);
}
// Sounds the alarm.
throw std::string (STRING_TASK_SAFETY_FAIL);
}
// CMD was found.