From 6b18a2842f8cc3d9831d43c754aca24d8845b971 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 3 Jan 2011 19:34:00 -0500 Subject: [PATCH 1/5] Build - Made pthreads usage conditional upon HAVE_LIBPTHREAD. --- src/Thread.cpp | 10 ++++++++++ src/Thread.h | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/src/Thread.cpp b/src/Thread.cpp index 2de65ebf4..c2e79884f 100644 --- a/src/Thread.cpp +++ b/src/Thread.cpp @@ -40,26 +40,36 @@ Thread::~Thread () //////////////////////////////////////////////////////////////////////////////// int Thread::start (void* inArg) { +#ifdef HAVE_LIBPTHREAD mArg = inArg; return pthread_create (&mTID, NULL, (void*(*)(void*)) Thread::entryPoint, (void*) this); +#else + return 0; +#endif } //////////////////////////////////////////////////////////////////////////////// void Thread::wait () { +#ifdef HAVE_LIBPTHREAD pthread_join (mTID, NULL); +#endif } //////////////////////////////////////////////////////////////////////////////// void Thread::cancel () { +#ifdef HAVE_LIBPTHREAD pthread_cancel (mTID); +#endif } //////////////////////////////////////////////////////////////////////////////// void Thread::detach () { +#ifdef HAVE_LIBPTHREAD pthread_detach (mTID); +#endif } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/Thread.h b/src/Thread.h index 987585fd5..8c5a962f6 100644 --- a/src/Thread.h +++ b/src/Thread.h @@ -27,7 +27,11 @@ #ifndef INCLUDED_THREAD #define INCLUDED_THREAD +#include <../auto.h> + +#ifdef HAVE_LIBPTHREAD #include +#endif class Thread { From 07755e2c56dd1fe7d86bc7878358c5571f04b540 Mon Sep 17 00:00:00 2001 From: Steve Rader Date: Mon, 3 Jan 2011 22:04:10 -0500 Subject: [PATCH 2/5] Bug #613 - Missing projects are now consistently reported as "(none)" in the summary chart and the projects command. Signed-off-by: Paul Beckingham --- ChangeLog | 3 +++ src/command.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index bcf3f22ff..c6c07634c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -62,6 +62,9 @@ + Fixed bug #595, where taskwarrior ignored changes to the wait date during the edit command, consequently not changing task status (thanks to Eric Fluger). + + Applied patch to fix bug #613, so that the summary report and the projects + command now consistently show a missing project as "(none)" (thanks to + Steve Rader). ------ old releases ------------------------------ diff --git a/src/command.cpp b/src/command.cpp index dc74a3653..52a16659a 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -298,7 +298,7 @@ int handleProjects (std::string& outs) foreach (i, unique) { int row = table.addRow (); - table.addCell (row, 0, i->first); + table.addCell (row, 0, (i->first == "" ? "(none)" : i->first)); table.addCell (row, 1, i->second); table.addCell (row, 2, none[i->first]); table.addCell (row, 3, low[i->first]); From b553954d378a47e6efd574f0201de0865958272a Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 3 Jan 2011 22:21:51 -0500 Subject: [PATCH 3/5] Bug #597 - Fixed bug #597, which caused a missing project to be counted as a project in the projects command (thanks to Steve Rader). --- ChangeLog | 2 ++ src/command.cpp | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c6c07634c..bfe45a440 100644 --- a/ChangeLog +++ b/ChangeLog @@ -62,6 +62,8 @@ + Fixed bug #595, where taskwarrior ignored changes to the wait date during the edit command, consequently not changing task status (thanks to Eric Fluger). + + Fixed bug #597, which caused a missing project to be counted as a project + in the projects command (thanks to Steve Rader). + Applied patch to fix bug #613, so that the summary report and the projects command now consistently show a missing project as "(none)" (thanks to Steve Rader). diff --git a/src/command.cpp b/src/command.cpp index 52a16659a..160e6face 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -250,6 +250,7 @@ int handleProjects (std::string& outs) std::map medium; std::map low; std::map none; + bool no_project = false; std::string project; std::string priority; foreach (t, tasks) @@ -258,6 +259,8 @@ int handleProjects (std::string& outs) priority = t->get ("priority"); unique[project] += 1; + if (project == "") + no_project = true; if (priority == "H") high[project] += 1; else if (priority == "M") medium[project] += 1; @@ -306,11 +309,15 @@ int handleProjects (std::string& outs) table.addCell (row, 5, high[i->first]); } + int number_projects = unique.size (); + if (no_project) + --number_projects; + out << optionalBlankLine () << table.render () << optionalBlankLine () - << unique.size () - << (unique.size () == 1 ? " project" : " projects") + << number_projects + << (number_projects == 1 ? " project" : " projects") << " (" << quantity << (quantity == 1 ? " task" : " tasks") << ")\n"; } else From e2d11d8575d118fbb270b3ca379c19506a7b5c0c Mon Sep 17 00:00:00 2001 From: Steve Rader Date: Mon, 3 Jan 2011 23:11:38 -0500 Subject: [PATCH 4/5] Bug #590 - Applied patch to fix bug #590, which makes the yes/no/all/quit confirmation prompts consistent (thanks to Steve Rader). - Patch modified to work with autocomplete. Signed-off-by: Paul Beckingham --- ChangeLog | 2 ++ src/util.cpp | 16 ++++++++++++---- test/confirmation.t | 8 ++++---- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index bfe45a440..44d5fb9b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -59,6 +59,8 @@ Steve Rader). + Fixed bug #589, where the man page did not adequately describe searching or usage of attribute modifiers (thanks to Steve Rader). + + Applied patch to fix bug #590, which makes the yes/no/all/quit confirmation + prompts consistent (thanks to Steve Rader). + Fixed bug #595, where taskwarrior ignored changes to the wait date during the edit command, consequently not changing task status (thanks to Eric Fluger). diff --git a/src/util.cpp b/src/util.cpp index a56f9b314..aceb46472 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -83,8 +83,10 @@ int confirm3 (const std::string& question) { std::vector options; options.push_back ("Yes"); + options.push_back ("yes"); options.push_back ("no"); options.push_back ("All"); + options.push_back ("all"); std::string answer; std::vector matches; @@ -93,9 +95,9 @@ int confirm3 (const std::string& question) { std::cout << question << " (" - << options[0] << "/" << options[1] << "/" - << options[2] + << options[2] << "/" + << options[4] << ") "; std::getline (std::cin, answer); @@ -105,7 +107,9 @@ int confirm3 (const std::string& question) while (matches.size () != 1); if (matches[0] == "Yes") return 1; + else if (matches[0] == "yes") return 1; else if (matches[0] == "All") return 2; + else if (matches[0] == "all") return 2; else return 0; } @@ -118,8 +122,10 @@ int confirm4 (const std::string& question) { std::vector options; options.push_back ("Yes"); + options.push_back ("yes"); options.push_back ("no"); options.push_back ("All"); + options.push_back ("all"); options.push_back ("quit"); std::string answer; @@ -129,10 +135,10 @@ int confirm4 (const std::string& question) { std::cout << question << " (" - << options[0] << "/" << options[1] << "/" << options[2] << "/" - << options[3] + << options[4] << "/" + << options[5] << ") "; std::getline (std::cin, answer); @@ -142,7 +148,9 @@ int confirm4 (const std::string& question) while (matches.size () != 1); if (matches[0] == "Yes") return 1; + else if (matches[0] == "yes") return 1; else if (matches[0] == "All") return 2; + else if (matches[0] == "all") return 2; else if (matches[0] == "quit") return 3; else return 0; } diff --git a/test/confirmation.t b/test/confirmation.t index 2760d7769..292adca69 100755 --- a/test/confirmation.t +++ b/test/confirmation.t @@ -93,7 +93,7 @@ like ($output, qr/Task not deleted\./, 'confirmation - N works'); # Test Yes for multiple changes $output = qx{echo -e "y\nY\nY\nY\nY" | ../src/task rc:confirm.rc 7-10 +bar}; -like ($output, qr/Proceed with change\? \(Yes\/no\/All\/quit\)/, 'multiple confirmations - Y works'); +like ($output, qr/Proceed with change\? \(yes\/no\/all\/quit\)/, 'multiple confirmations - Y works'); like ($output, qr/Task 7 "foo"/, 'multiple confirmations - Y works'); like ($output, qr/Task 8 "foo"/, 'multiple confirmations - Y works'); like ($output, qr/Task 9 "foo"/, 'multiple confirmations - Y works'); @@ -102,7 +102,7 @@ like ($output, qr/Modified 4 tasks/, 'multiple confirmations - Y works'); # Test no for multiple changes $output = qx{echo -e "N\nn\nn\nn\nn" | ../src/task rc:confirm.rc 7-10 -bar}; -like ($output, qr/Proceed with change\? \(Yes\/no\/All\/quit\)/, 'multiple confirmations - n works'); +like ($output, qr/Proceed with change\? \(yes\/no\/all\/quit\)/, 'multiple confirmations - n works'); like ($output, qr/Task 7 "foo"/, 'multiple confirmations - n works'); like ($output, qr/Task 8 "foo"/, 'multiple confirmations - n works'); like ($output, qr/Task 9 "foo"/, 'multiple confirmations - n works'); @@ -111,14 +111,14 @@ like ($output, qr/Modified 0 tasks/, 'multiple confirmations - n works'); # Test All for multiple changes $output = qx{echo -e "a\nA" | ../src/task rc:confirm.rc 7-10 -bar}; -like ($output, qr/Proceed with change\? \(Yes\/no\/All\/quit\)/, 'multiple confirmations - A works'); +like ($output, qr/Proceed with change\? \(yes\/no\/all\/quit\)/, 'multiple confirmations - A works'); like ($output, qr/Task 7 "foo"/, 'multiple confirmations - A works'); unlike ($output, qr/Task 8 "foo"/, 'multiple confirmations - A works'); like ($output, qr/Modified 4 tasks/, 'multiple confirmations - A works'); # Test quit for multiple changes $output = qx{echo "q" | ../src/task rc:confirm.rc 7-10 +bar}; -like ($output, qr/Proceed with change\? \(Yes\/no\/All\/quit\)/, 'multiple confirmations - q works'); +like ($output, qr/Proceed with change\? \(yes\/no\/all\/quit\)/, 'multiple confirmations - q works'); like ($output, qr/Task 7 "foo"/, 'multiple confirmations - q works'); unlike ($output, qr/Task 8 "foo"/, 'multiple confirmations - q works'); like ($output, qr/Modified 0 tasks/, 'multiple confirmations - q works'); From 9429c961729e8c9797e1a1808e2cfb00200603cb Mon Sep 17 00:00:00 2001 From: Federico Hernandez Date: Tue, 4 Jan 2011 08:44:59 +0100 Subject: [PATCH 5/5] CMake - install command for task binary had wrong target --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e9cf0232b..e1e731e15 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -24,7 +24,7 @@ add_executable (task_executable main.cpp) target_link_libraries (task_executable task ${TASK_LIBRARIES}) set_property (TARGET task_executable PROPERTY OUTPUT_NAME "task") -install (TARGETS task DESTINATION bin) +install (TARGETS task_executable DESTINATION bin) set (CMAKE_BUILD_TYPE debug) set (CMAKE_C_FLAGS_DEBUG "-ggdb3")