Merge branch '1.9.4' of tasktools.org:task into 1.9.4

This commit is contained in:
Johannes Schlatow 2011-01-04 21:57:23 +01:00
commit 86f778f504
7 changed files with 48 additions and 12 deletions

View file

@ -59,9 +59,16 @@
Steve Rader). Steve Rader).
+ Fixed bug #589, where the man page did not adequately describe searching + Fixed bug #589, where the man page did not adequately describe searching
or usage of attribute modifiers (thanks to Steve Rader). 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 + Fixed bug #595, where taskwarrior ignored changes to the wait date during
the edit command, consequently not changing task status (thanks to Eric the edit command, consequently not changing task status (thanks to Eric
Fluger). 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).
------ old releases ------------------------------ ------ old releases ------------------------------

View file

@ -24,7 +24,7 @@ add_executable (task_executable main.cpp)
target_link_libraries (task_executable task ${TASK_LIBRARIES}) target_link_libraries (task_executable task ${TASK_LIBRARIES})
set_property (TARGET task_executable PROPERTY OUTPUT_NAME "task") 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_BUILD_TYPE debug)
set (CMAKE_C_FLAGS_DEBUG "-ggdb3") set (CMAKE_C_FLAGS_DEBUG "-ggdb3")

View file

@ -40,26 +40,36 @@ Thread::~Thread ()
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
int Thread::start (void* inArg) int Thread::start (void* inArg)
{ {
#ifdef HAVE_LIBPTHREAD
mArg = inArg; mArg = inArg;
return pthread_create (&mTID, NULL, (void*(*)(void*)) Thread::entryPoint, (void*) this); return pthread_create (&mTID, NULL, (void*(*)(void*)) Thread::entryPoint, (void*) this);
#else
return 0;
#endif
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Thread::wait () void Thread::wait ()
{ {
#ifdef HAVE_LIBPTHREAD
pthread_join (mTID, NULL); pthread_join (mTID, NULL);
#endif
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Thread::cancel () void Thread::cancel ()
{ {
#ifdef HAVE_LIBPTHREAD
pthread_cancel (mTID); pthread_cancel (mTID);
#endif
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Thread::detach () void Thread::detach ()
{ {
#ifdef HAVE_LIBPTHREAD
pthread_detach (mTID); pthread_detach (mTID);
#endif
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -27,7 +27,11 @@
#ifndef INCLUDED_THREAD #ifndef INCLUDED_THREAD
#define INCLUDED_THREAD #define INCLUDED_THREAD
#include <../auto.h>
#ifdef HAVE_LIBPTHREAD
#include <pthread.h> #include <pthread.h>
#endif
class Thread class Thread
{ {

View file

@ -250,6 +250,7 @@ int handleProjects (std::string& outs)
std::map <std::string, int> medium; std::map <std::string, int> medium;
std::map <std::string, int> low; std::map <std::string, int> low;
std::map <std::string, int> none; std::map <std::string, int> none;
bool no_project = false;
std::string project; std::string project;
std::string priority; std::string priority;
foreach (t, tasks) foreach (t, tasks)
@ -258,6 +259,8 @@ int handleProjects (std::string& outs)
priority = t->get ("priority"); priority = t->get ("priority");
unique[project] += 1; unique[project] += 1;
if (project == "")
no_project = true;
if (priority == "H") high[project] += 1; if (priority == "H") high[project] += 1;
else if (priority == "M") medium[project] += 1; else if (priority == "M") medium[project] += 1;
@ -298,7 +301,7 @@ int handleProjects (std::string& outs)
foreach (i, unique) foreach (i, unique)
{ {
int row = table.addRow (); 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, 1, i->second);
table.addCell (row, 2, none[i->first]); table.addCell (row, 2, none[i->first]);
table.addCell (row, 3, low[i->first]); table.addCell (row, 3, low[i->first]);
@ -306,11 +309,15 @@ int handleProjects (std::string& outs)
table.addCell (row, 5, high[i->first]); table.addCell (row, 5, high[i->first]);
} }
int number_projects = unique.size ();
if (no_project)
--number_projects;
out << optionalBlankLine () out << optionalBlankLine ()
<< table.render () << table.render ()
<< optionalBlankLine () << optionalBlankLine ()
<< unique.size () << number_projects
<< (unique.size () == 1 ? " project" : " projects") << (number_projects == 1 ? " project" : " projects")
<< " (" << quantity << (quantity == 1 ? " task" : " tasks") << ")\n"; << " (" << quantity << (quantity == 1 ? " task" : " tasks") << ")\n";
} }
else else

View file

@ -83,8 +83,10 @@ int confirm3 (const std::string& question)
{ {
std::vector <std::string> options; std::vector <std::string> options;
options.push_back ("Yes"); options.push_back ("Yes");
options.push_back ("yes");
options.push_back ("no"); options.push_back ("no");
options.push_back ("All"); options.push_back ("All");
options.push_back ("all");
std::string answer; std::string answer;
std::vector <std::string> matches; std::vector <std::string> matches;
@ -93,9 +95,9 @@ int confirm3 (const std::string& question)
{ {
std::cout << question std::cout << question
<< " (" << " ("
<< options[0] << "/"
<< options[1] << "/" << options[1] << "/"
<< options[2] << options[2] << "/"
<< options[4]
<< ") "; << ") ";
std::getline (std::cin, answer); std::getline (std::cin, answer);
@ -105,7 +107,9 @@ int confirm3 (const std::string& question)
while (matches.size () != 1); while (matches.size () != 1);
if (matches[0] == "Yes") return 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] == "all") return 2;
else return 0; else return 0;
} }
@ -118,8 +122,10 @@ int confirm4 (const std::string& question)
{ {
std::vector <std::string> options; std::vector <std::string> options;
options.push_back ("Yes"); options.push_back ("Yes");
options.push_back ("yes");
options.push_back ("no"); options.push_back ("no");
options.push_back ("All"); options.push_back ("All");
options.push_back ("all");
options.push_back ("quit"); options.push_back ("quit");
std::string answer; std::string answer;
@ -129,10 +135,10 @@ int confirm4 (const std::string& question)
{ {
std::cout << question std::cout << question
<< " (" << " ("
<< options[0] << "/"
<< options[1] << "/" << options[1] << "/"
<< options[2] << "/" << options[2] << "/"
<< options[3] << options[4] << "/"
<< options[5]
<< ") "; << ") ";
std::getline (std::cin, answer); std::getline (std::cin, answer);
@ -142,7 +148,9 @@ int confirm4 (const std::string& question)
while (matches.size () != 1); while (matches.size () != 1);
if (matches[0] == "Yes") return 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] == "all") return 2;
else if (matches[0] == "quit") return 3; else if (matches[0] == "quit") return 3;
else return 0; else return 0;
} }

View file

@ -93,7 +93,7 @@ like ($output, qr/Task not deleted\./, 'confirmation - N works');
# Test Yes for multiple changes # Test Yes for multiple changes
$output = qx{echo -e "y\nY\nY\nY\nY" | ../src/task rc:confirm.rc 7-10 +bar}; $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 7 "foo"/, 'multiple confirmations - Y works');
like ($output, qr/Task 8 "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'); 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 # Test no for multiple changes
$output = qx{echo -e "N\nn\nn\nn\nn" | ../src/task rc:confirm.rc 7-10 -bar}; $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 7 "foo"/, 'multiple confirmations - n works');
like ($output, qr/Task 8 "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'); 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 # Test All for multiple changes
$output = qx{echo -e "a\nA" | ../src/task rc:confirm.rc 7-10 -bar}; $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'); like ($output, qr/Task 7 "foo"/, 'multiple confirmations - A works');
unlike ($output, qr/Task 8 "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'); like ($output, qr/Modified 4 tasks/, 'multiple confirmations - A works');
# Test quit for multiple changes # Test quit for multiple changes
$output = qx{echo "q" | ../src/task rc:confirm.rc 7-10 +bar}; $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'); like ($output, qr/Task 7 "foo"/, 'multiple confirmations - q works');
unlike ($output, qr/Task 8 "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'); like ($output, qr/Modified 0 tasks/, 'multiple confirmations - q works');