mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Bug Fix - #252
- Fixed bug that prevented the chaining of two attributes with different modifiers to effect a date range, such as: task ls due.after:8/1/2009 due.before:8/31/2009 Thanks to John Florian.
This commit is contained in:
parent
d3fcd40279
commit
1355571876
7 changed files with 35 additions and 38 deletions
|
@ -17,6 +17,9 @@
|
|||
for colored header and footnotes (thanks to John Florian).
|
||||
+ Fixed bug #248 where single and double quotes are both stored as
|
||||
ampersand-quot-semi (thanks to John Florian).
|
||||
+ Fixed bug #252 that prevented use of attribute modifiers on dates to effect
|
||||
a range, such as "task ls due.after:eom due.before:eoy" (thanks to John
|
||||
Florian).
|
||||
|
||||
------ old releases ------------------------------
|
||||
|
||||
|
|
|
@ -539,7 +539,12 @@ void Context::parse (
|
|||
attribute.mod (mod);
|
||||
attribute.value (value);
|
||||
|
||||
parseTask[attribute.name ()] = attribute;
|
||||
// Preserve modifier in the key, to allow multiple modifiers on the
|
||||
// same attribute. Bug #252.
|
||||
if (name != "" && mod != "")
|
||||
parseTask[name + "." + mod] = attribute;
|
||||
else
|
||||
parseTask[name] = attribute;
|
||||
}
|
||||
|
||||
// *arg has the appearance of an attribute (foo:bar), but isn't
|
||||
|
@ -668,46 +673,46 @@ void Context::autoFilter (Task& t, Filter& f)
|
|||
foreach (att, t)
|
||||
{
|
||||
// Words are found in the description using the .has modifier.
|
||||
if (att->first == "description" && att->second.mod () == "")
|
||||
if (att->second.name () == "description" && att->second.mod () == "")
|
||||
{
|
||||
std::vector <std::string> words;
|
||||
split (words, att->second.value (), ' ');
|
||||
foreach (word, words)
|
||||
{
|
||||
f.push_back (Att ("description", "has", *word));
|
||||
debug ("auto filter: " + att->first + ".has:" + *word);
|
||||
debug ("auto filter: " + att->second.name () + ".has:" + *word);
|
||||
}
|
||||
}
|
||||
|
||||
// Projects are matched left-most.
|
||||
else if (att->first == "project" && att->second.mod () == "")
|
||||
else if (att->second.name () == "project" && att->second.mod () == "")
|
||||
{
|
||||
if (att->second.value () != "")
|
||||
{
|
||||
f.push_back (Att ("project", "startswith", att->second.value ()));
|
||||
debug ("auto filter: " + att->first + ".startswith:" + att->second.value ());
|
||||
debug ("auto filter: " + att->second.name () + ".startswith:" + att->second.value ());
|
||||
}
|
||||
else
|
||||
{
|
||||
f.push_back (Att ("project", "is", att->second.value ()));
|
||||
debug ("auto filter: " + att->first + ".is:" + att->second.value ());
|
||||
debug ("auto filter: " + att->second.name () + ".is:" + att->second.value ());
|
||||
}
|
||||
}
|
||||
|
||||
// The limit attribute does not participate in filtering, and needs to be
|
||||
// specifically handled in handleCustomReport.
|
||||
else if (att->first == "limit")
|
||||
else if (att->second.name () == "limit")
|
||||
{
|
||||
}
|
||||
|
||||
// Every task has a unique uuid by default, and it shouldn't be included,
|
||||
// because it is guaranteed to not match.
|
||||
else if (att->first == "uuid")
|
||||
else if (att->second.name () == "uuid")
|
||||
{
|
||||
}
|
||||
|
||||
// The mechanism for filtering on tags is +/-<tag>.
|
||||
else if (att->first == "tags")
|
||||
else if (att->second.name () == "tags")
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -716,7 +721,7 @@ void Context::autoFilter (Task& t, Filter& f)
|
|||
{
|
||||
f.push_back (att->second);
|
||||
debug ("auto filter: " +
|
||||
att->first +
|
||||
att->second.name () +
|
||||
(att->second.mod () != "" ?
|
||||
("." + att->second.mod () + ":") :
|
||||
":") +
|
||||
|
|
|
@ -70,7 +70,7 @@ bool Filter::pass (const Record& record) const
|
|||
return false;
|
||||
}
|
||||
|
||||
// Annotations are skipped.
|
||||
// Annotations are skipped, because they are handled above.
|
||||
else if (att->name ().length () > 11 &&
|
||||
att->name ().substr (0, 11) == "annotation_")
|
||||
{
|
||||
|
|
|
@ -67,8 +67,8 @@ bool Task::operator== (const Task& other)
|
|||
return false;
|
||||
|
||||
foreach (att, *this)
|
||||
if (att->first != "uuid")
|
||||
if (att->second.value () != other.get (att->first))
|
||||
if (att->second.name () != "uuid")
|
||||
if (att->second.value () != other.get (att->second.name ()))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
|
@ -103,7 +103,6 @@ std::string handleAdd ()
|
|||
// All this, just for an id number.
|
||||
std::vector <Task> all;
|
||||
Filter none;
|
||||
handleRecurrence ();
|
||||
context.tdb.loadPending (all, none);
|
||||
out << "Created task " << context.tdb.nextId () << std::endl;
|
||||
#endif
|
||||
|
@ -123,7 +122,6 @@ std::string handleProjects ()
|
|||
|
||||
std::vector <Task> tasks;
|
||||
context.tdb.lock (context.config.get ("locking", true));
|
||||
handleRecurrence ();
|
||||
int quantity = context.tdb.loadPending (tasks, context.filter);
|
||||
context.tdb.commit ();
|
||||
context.tdb.unlock ();
|
||||
|
@ -209,7 +207,6 @@ std::string handleCompletionProjects ()
|
|||
{
|
||||
std::vector <Task> tasks;
|
||||
context.tdb.lock (context.config.get ("locking", true));
|
||||
handleRecurrence ();
|
||||
|
||||
Filter filter;
|
||||
if (context.config.get (std::string ("complete.all.projects"), false))
|
||||
|
@ -243,7 +240,6 @@ std::string handleTags ()
|
|||
|
||||
std::vector <Task> tasks;
|
||||
context.tdb.lock (context.config.get ("locking", true));
|
||||
handleRecurrence ();
|
||||
int quantity = context.tdb.loadPending (tasks, context.filter);
|
||||
context.tdb.commit ();
|
||||
context.tdb.unlock ();
|
||||
|
@ -306,7 +302,6 @@ std::string handleCompletionTags ()
|
|||
{
|
||||
std::vector <Task> tasks;
|
||||
context.tdb.lock (context.config.get ("locking", true));
|
||||
handleRecurrence ();
|
||||
|
||||
Filter filter;
|
||||
if (context.config.get (std::string ("complete.all.tags"), false))
|
||||
|
@ -369,7 +364,6 @@ std::string handleCompletionIDs ()
|
|||
{
|
||||
std::vector <Task> tasks;
|
||||
context.tdb.lock (context.config.get ("locking", true));
|
||||
handleRecurrence ();
|
||||
Filter filter;
|
||||
context.tdb.loadPending (tasks, filter);
|
||||
context.tdb.commit ();
|
||||
|
@ -565,7 +559,6 @@ std::string handleDelete ()
|
|||
|
||||
std::vector <Task> tasks;
|
||||
context.tdb.lock (context.config.get ("locking", true));
|
||||
handleRecurrence ();
|
||||
Filter filter;
|
||||
context.tdb.loadPending (tasks, filter);
|
||||
|
||||
|
@ -665,7 +658,6 @@ std::string handleStart ()
|
|||
|
||||
std::vector <Task> tasks;
|
||||
context.tdb.lock (context.config.get ("locking", true));
|
||||
handleRecurrence ();
|
||||
Filter filter;
|
||||
context.tdb.loadPending (tasks, filter);
|
||||
|
||||
|
@ -717,7 +709,6 @@ std::string handleStop ()
|
|||
|
||||
std::vector <Task> tasks;
|
||||
context.tdb.lock (context.config.get ("locking", true));
|
||||
handleRecurrence ();
|
||||
Filter filter;
|
||||
context.tdb.loadPending (tasks, filter);
|
||||
|
||||
|
@ -764,7 +755,6 @@ std::string handleDone ()
|
|||
|
||||
std::vector <Task> tasks;
|
||||
context.tdb.lock (context.config.get ("locking", true));
|
||||
handleRecurrence ();
|
||||
Filter filter;
|
||||
context.tdb.loadPending (tasks, filter);
|
||||
|
||||
|
@ -895,7 +885,6 @@ std::string handleModify ()
|
|||
|
||||
std::vector <Task> tasks;
|
||||
context.tdb.lock (context.config.get ("locking", true));
|
||||
handleRecurrence ();
|
||||
Filter filter;
|
||||
context.tdb.loadPending (tasks, filter);
|
||||
|
||||
|
@ -973,7 +962,6 @@ std::string handleAppend ()
|
|||
|
||||
std::vector <Task> tasks;
|
||||
context.tdb.lock (context.config.get ("locking", true));
|
||||
handleRecurrence ();
|
||||
Filter filter;
|
||||
context.tdb.loadPending (tasks, filter);
|
||||
|
||||
|
@ -1369,12 +1357,12 @@ int deltaAttributes (Task& task)
|
|||
|
||||
foreach (att, context.task)
|
||||
{
|
||||
if (att->first != "uuid" &&
|
||||
att->first != "description" &&
|
||||
att->first != "tags")
|
||||
if (att->second.name () != "uuid" &&
|
||||
att->second.name () != "description" &&
|
||||
att->second.name () != "tags")
|
||||
{
|
||||
// Modifying "wait" changes status.
|
||||
if (att->first == "wait")
|
||||
if (att->second.name () == "wait")
|
||||
{
|
||||
if (att->second.value () == "")
|
||||
task.setStatus (Task::pending);
|
||||
|
@ -1383,8 +1371,9 @@ int deltaAttributes (Task& task)
|
|||
}
|
||||
|
||||
if (att->second.value () == "")
|
||||
task.remove (att->first);
|
||||
task.remove (att->second.name ());
|
||||
else
|
||||
// One of the few places where the compound attribute name is used.
|
||||
task.set (att->first, att->second.value ());
|
||||
|
||||
++changes;
|
||||
|
|
|
@ -75,9 +75,9 @@ int main (int argc, char** argv)
|
|||
Att a5 ("name", "value");
|
||||
t.is (a5.composeF4 (), "name:\"value\"", "Att::composeF4 simple");
|
||||
a5.value ("\"");
|
||||
t.is (a5.composeF4 (), "name:\""\"", "Att::composeF4 encoded \"");
|
||||
t.is (a5.composeF4 (), "name:\"&dquot;\"", "Att::composeF4 encoded \"");
|
||||
a5.value ("\t\",[]:");
|
||||
t.is (a5.composeF4 (), "name:\"&tab;",&open;&close;:\"", "Att::composeF4 fully encoded \\t\",[]:");
|
||||
t.is (a5.composeF4 (), "name:\"&tab;&dquot;,&open;&close;:\"", "Att::composeF4 fully encoded \\t\",[]:");
|
||||
|
||||
Att a6 ("name", 6);
|
||||
t.is (a6.value_int (), 6, "Att::value_int get");
|
||||
|
@ -174,12 +174,12 @@ int main (int argc, char** argv)
|
|||
|
||||
n = Nibbler ("name:\""\"");
|
||||
a7.parse (n);
|
||||
t.is (a7.composeF4 (), "name:\""\"",
|
||||
t.is (a7.composeF4 (), "name:\"&dquot;\"",
|
||||
"Att::parse (name:\""\")");
|
||||
|
||||
n = Nibbler ("name:\"&tab;",&open;&close;:\"");
|
||||
a7.parse (n);
|
||||
t.is (a7.composeF4 (), "name:\"&tab;",&open;&close;:\"",
|
||||
t.is (a7.composeF4 (), "name:\"&tab;&dquot;,&open;&close;:\"",
|
||||
"Att::parse (name:\"&tab;",&open;&close;:\")");
|
||||
|
||||
n = Nibbler ("total gibberish");
|
||||
|
@ -216,19 +216,19 @@ int main (int argc, char** argv)
|
|||
good = true;
|
||||
try {a7.parse (n);} catch (...) {good = false;}
|
||||
t.ok (good, "Att::parse (name:\"value)");
|
||||
t.is (a7.composeF4 (), "name:\""value\"", "Att::composeF4 -> name:\""value\"");
|
||||
t.is (a7.composeF4 (), "name:\"&dquot;value\"", "Att::composeF4 -> name:\"&dquot;value\"");
|
||||
|
||||
n = Nibbler ("name:value\"");
|
||||
good = true;
|
||||
try {a7.parse (n);} catch (...) {good = false;}
|
||||
t.ok (good, "Att::parse (name:value\")");
|
||||
t.is (a7.composeF4 (), "name:\"value"\"", "Att::composeF4 -> name:\"value"\"");
|
||||
t.is (a7.composeF4 (), "name:\"value&dquot;\"", "Att::composeF4 -> name:\"value&dquot;\"");
|
||||
|
||||
n = Nibbler ("name:val\"ue");
|
||||
good = true;
|
||||
try {a7.parse (n);} catch (...) {good = false;}
|
||||
t.ok (good, "Att::parse (name:val\"ue)");
|
||||
t.is (a7.composeF4 (), "name:\"val"ue\"", "Att::composeF4 -> name:\"val"ue\"");
|
||||
t.is (a7.composeF4 (), "name:\"val&dquot;ue\"", "Att::composeF4 -> name:\"val&dquot;ue\"");
|
||||
|
||||
n = Nibbler ("name\"");
|
||||
good = true;
|
||||
|
|
|
@ -42,7 +42,7 @@ if (open my $fh, '>', 'custom.rc')
|
|||
ok (-r 'custom.rc', 'Created custom.rc');
|
||||
}
|
||||
|
||||
# Generate the usage screen, and locate the custom report on it.
|
||||
# Add a recurring and non-recurring task, look for the indicator.
|
||||
qx{../task rc:custom.rc add foo due:tomorrow recur:weekly};
|
||||
qx{../task rc:custom.rc add bar};
|
||||
my $output = qx{../task rc:custom.rc foo 2>&1};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue