From 3d7bb9d253127d0430e801d53eca648f564ec6d8 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 27 Dec 2010 00:22:57 -0500 Subject: [PATCH] Bug #564 - Fixed bug #564, which allowed the deletion of parent recurring tasks (thanks to Peter De Poorter). --- ChangeLog | 6 ++++-- src/TDB.cpp | 5 ++++- src/Task.cpp | 1 + src/tests/add.t | 8 +------ src/tests/bug.360.t | 6 +++--- src/tests/bug.annual.t | 42 ++++++++++++++++++------------------ src/tests/confirmation.t | 2 +- src/tests/custom.recur_ind.t | 8 +++---- src/tests/dependencies.t | 3 ++- src/tests/recur.until.t | 4 ++-- src/tests/recur.weekdays.t | 3 +-- 11 files changed, 44 insertions(+), 44 deletions(-) diff --git a/ChangeLog b/ChangeLog index d5d5a90d9..ec81f81c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -36,14 +36,16 @@ + Fixed bug #538, where some color legend items were not readable. + Fixed bug #539, where the man page task-color(5) contained a line that began with a ' and was not displayed. - + Fixed bug #540, where user names containing @s could not be parsed + + Fixed bug #540, where user names containing @s could not be parsed. + Fixed bug #541, which prevented sorting by 'age' column in some situations. + Fixed bug #542, which sorted the countdown columns incorrectly (thanks to Michelle Crane). + Fixed bug #555, which caused a segfault when logging a task with a project (thanks to Itay Perl). + + Fixed bug #564, which allowed the deletion of parent recurring tasks (thanks + to Peter De Poorter). + Fixed bug #570, which used unsupported brace expansion with dash (default - /bin/sh in Ubuntu) + /bin/sh in Ubuntu). + Fixed bug #579, which displayed incorrect counts when using the 'limit:N' filter (thanks to Thomas Sattler). + Fixed bug #580, where reusing the merge uri for autopush failed when the diff --git a/src/TDB.cpp b/src/TDB.cpp index 45fc77727..fae17a8a9 100644 --- a/src/TDB.cpp +++ b/src/TDB.cpp @@ -309,7 +309,10 @@ int TDB::loadPending (std::vector & tasks, Filter& filter) { // TODO Add hidden attribute indicating source? Task task (line); - task.id = mId++; + + Task::status status = task.getStatus (); + if (status != Task::recurring) + task.id = mId++; mPending.push_back (task); diff --git a/src/Task.cpp b/src/Task.cpp index 6b4e787fe..71ea08076 100644 --- a/src/Task.cpp +++ b/src/Task.cpp @@ -81,6 +81,7 @@ bool Task::operator== (const Task& other) //////////////////////////////////////////////////////////////////////////////// Task::Task (const std::string& input) { + id = 0; parse (input); } diff --git a/src/tests/add.t b/src/tests/add.t index 48af4663a..4c32c285d 100755 --- a/src/tests/add.t +++ b/src/tests/add.t @@ -28,7 +28,7 @@ use strict; use warnings; -use Test::More tests => 14; +use Test::More tests => 12; # Create the rc file. if (open my $fh, '>', 'add.rc') @@ -55,12 +55,6 @@ like ($output, qr/ID\s+1\n/, 'add ID'); like ($output, qr/Status\s+Pending\n/, 'add Pending'); like ($output, qr/Description\s+This a TEST\n/, 'add ID'); -# Test delete. -qx{../task rc:add.rc delete 1}; -$output = qx{../task rc:add.rc info 1}; -like ($output, qr/ID\s+1\n/, 'add ID'); -like ($output, qr/Status\s+Deleted\n/, 'add Deleted'); - # Cleanup. unlink 'pending.data'; ok (!-r 'pending.data', 'Removed pending.data'); diff --git a/src/tests/bug.360.t b/src/tests/bug.360.t index 3c5e3c1f7..54a2f840e 100755 --- a/src/tests/bug.360.t +++ b/src/tests/bug.360.t @@ -45,16 +45,16 @@ qx{../task rc:bug.rc ls}; # Result: trying to add the project generates an error about removing # recurrence from a task. -my $output = qx{../task rc:bug.rc 2 project:bar}; +my $output = qx{../task rc:bug.rc 1 project:bar}; unlike ($output, qr/You cannot remove the recurrence from a recurring task./ms, 'No recurrence removal error'); # Now try to generate the error above via regular means - ie, is it actually # doing what it should? -$output = qx{../task rc:bug.rc 2 recur:}; +$output = qx{../task rc:bug.rc 1 recur:}; like ($output, qr/You cannot remove the recurrence from a recurring task./ms, 'Recurrence removal error'); # Prevent removal of the due date from a recurring task. -$output = qx{../task rc:bug.rc 2 due:}; +$output = qx{../task rc:bug.rc 1 due:}; like ($output, qr/You cannot remove the due date from a recurring task./ms, 'Cannot remove due date from a recurring task'); # Allow removal of the due date from a non-recurring task. diff --git a/src/tests/bug.annual.t b/src/tests/bug.annual.t index a4cfff2c1..a50f8cebe 100755 --- a/src/tests/bug.annual.t +++ b/src/tests/bug.annual.t @@ -43,30 +43,30 @@ if (open my $fh, '>', 'annual.rc') # # ID Project Pri Due Active Age Description # -- ------- --- ---------- ------ --- ----------- -# 2 1/1/2000 - foo -# 3 12/31/2000 - foo -# 4 12/31/2001 - foo -# 5 12/31/2002 - foo -# 6 12/31/2003 - foo -# 7 12/30/2004 - foo -# 8 12/30/2005 - foo -# 9 12/30/2006 - foo -# 10 12/30/2007 - foo -# 11 12/29/2008 - foo -# 12 12/29/2009 - foo +# 1 1/1/2000 - foo +# 2 12/31/2000 - foo +# 3 12/31/2001 - foo +# 4 12/31/2002 - foo +# 5 12/31/2003 - foo +# 6 12/30/2004 - foo +# 7 12/30/2005 - foo +# 8 12/30/2006 - foo +# 9 12/30/2007 - foo +# 10 12/29/2008 - foo +# 11 12/29/2009 - foo qx{../task rc:annual.rc add foo due:1/1/2000 recur:annual until:1/1/2009}; my $output = qx{../task rc:annual.rc list}; -like ($output, qr/2\s+1\/1\/2000\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 1 no creep'); -like ($output, qr/3\s+1\/1\/2001\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 2 no creep'); -like ($output, qr/4\s+1\/1\/2002\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 3 no creep'); -like ($output, qr/5\s+1\/1\/2003\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 4 no creep'); -like ($output, qr/6\s+1\/1\/2004\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 5 no creep'); -like ($output, qr/7\s+1\/1\/2005\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 6 no creep'); -like ($output, qr/8\s+1\/1\/2006\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 7 no creep'); -like ($output, qr/9\s+1\/1\/2007\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 8 no creep'); -like ($output, qr/10\s+1\/1\/2008\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 9 no creep'); -like ($output, qr/11\s+1\/1\/2009\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 10 no creep'); +like ($output, qr/1\s+1\/1\/2000\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 1 no creep'); +like ($output, qr/2\s+1\/1\/2001\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 2 no creep'); +like ($output, qr/3\s+1\/1\/2002\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 3 no creep'); +like ($output, qr/4\s+1\/1\/2003\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 4 no creep'); +like ($output, qr/5\s+1\/1\/2004\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 5 no creep'); +like ($output, qr/6\s+1\/1\/2005\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 6 no creep'); +like ($output, qr/7\s+1\/1\/2006\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 7 no creep'); +like ($output, qr/8\s+1\/1\/2007\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 8 no creep'); +like ($output, qr/9\s+1\/1\/2008\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 9 no creep'); +like ($output, qr/10\s+1\/1\/2009\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 10 no creep'); # Cleanup. unlink 'pending.data'; diff --git a/src/tests/confirmation.t b/src/tests/confirmation.t index c2ffb6856..67edf973a 100755 --- a/src/tests/confirmation.t +++ b/src/tests/confirmation.t @@ -47,7 +47,7 @@ if (open my $fh, '>', 'response.txt') ok (-r 'response.txt', 'Created response.txt'); } -qx{../task rc:confirm.rc add foo} for 1 .. 10; +qx{../task rc:confirm.rc add foo} for 1..10; # Test the various forms of "Yes". my $output = qx{echo "Yes" | ../task rc:confirm.rc del 1}; diff --git a/src/tests/custom.recur_ind.t b/src/tests/custom.recur_ind.t index 2fce02adb..94184af6a 100755 --- a/src/tests/custom.recur_ind.t +++ b/src/tests/custom.recur_ind.t @@ -47,12 +47,12 @@ 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}; like ($output, qr/ID R/, 'Recurrence indicator heading'); -like ($output, qr/3\s+R/, 'Recurrence indicator t1'); -unlike ($output, qr/2\s+R/, 'No recurrence indicator t2'); +like ($output, qr/2\s+R/, 'Recurrence indicator t1'); +unlike ($output, qr/1\s+R/, 'No recurrence indicator t2'); $output = qx{../task rc:custom.rc foo rc.recurrence.indicator=RE 2>&1}; -like ($output, qr/3\s+RE/, 'Custom recurrence indicator t1'); -unlike ($output, qr/2\s+RE/, 'No custom recurrence indicator t2'); +like ($output, qr/2\s+RE/, 'Custom recurrence indicator t1'); +unlike ($output, qr/1\s+RE/, 'No custom recurrence indicator t2'); # Cleanup. unlink 'pending.data'; diff --git a/src/tests/dependencies.t b/src/tests/dependencies.t index b94177e30..6e90bf538 100755 --- a/src/tests/dependencies.t +++ b/src/tests/dependencies.t @@ -121,11 +121,12 @@ qx{../task rc:dep.rc add Five}; qx{../task rc:dep.rc add Six recurring due:tomorrow recur:daily}; # [20] +qx{../task rc:dep.rc ls}; # To force handleRecurrence call. $output = qx{../task rc:dep.rc 6 dep:5}; like ($output, qr/Modified \d+ task/, 'dependencies - recurring task depending on another task'); # [21] -$output = qx{../task rc:dep.rc 5 dep:6}; +$output = qx{../task rc:dep.rc 4 dep:5}; like ($output, qr/Modified \d+ task/, 'dependencies - task depending on recurring task'); # [22] t 1 dep:2,3,4; t 1 dep:-2,-4,5; t info 1 => blocked by 3,5 diff --git a/src/tests/recur.until.t b/src/tests/recur.until.t index 71a255754..9c42c34a4 100755 --- a/src/tests/recur.until.t +++ b/src/tests/recur.until.t @@ -43,12 +43,12 @@ qx{../task rc:recur.rc add foo due:now recur:2sec until:5sec}; diag ("Sleeping for 6 seconds"); sleep 6; my $output = qx{../task rc:recur.rc list}; +like ($output, qr/^\s+1/ms, 'Found 1'); like ($output, qr/^\s+2/ms, 'Found 2'); like ($output, qr/^\s+3/ms, 'Found 3'); like ($output, qr/^\s+4/ms, 'Found 4'); -like ($output, qr/^\s+5/ms, 'Found 5'); -qx{../task rc:recur.rc do $_} for 2..6; +qx{../task rc:recur.rc do $_} for 1..5; $output = qx{../task rc:recur.rc list}; like ($output, qr/and has been deleted/, 'Parent task deleted'); diff --git a/src/tests/recur.weekdays.t b/src/tests/recur.weekdays.t index bc69bd0e0..129c170e8 100755 --- a/src/tests/recur.weekdays.t +++ b/src/tests/recur.weekdays.t @@ -28,7 +28,7 @@ use strict; use warnings; -use Test::More tests => 8; +use Test::More tests => 7; # Create the rc file. if (open my $fh, '>', 'recur.rc') @@ -44,7 +44,6 @@ my $output = qx{../task rc:recur.rc list}; like ($output, qr/one/, 'recur weekdays'); $output = qx{../task rc:recur.rc info 1}; -like ($output, qr/Status\s+Recurring/, 'task is recurring'); like ($output, qr/Recurrence\s+weekdays/, 'task recurs every weekday'); qx{../task rc:recur.rc do 1};