From e7ba2ab76d5f614164a32e7257c4c74f51394586 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Wed, 1 Jul 2009 00:52:42 -0400 Subject: [PATCH] Code Cleanup - Converted std::cout diagnostics to context.debug calls. --- src/TDB.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/TDB.cpp b/src/TDB.cpp index d6d6d5765..2deddb47b 100644 --- a/src/TDB.cpp +++ b/src/TDB.cpp @@ -543,7 +543,7 @@ void TDB::undo () << std::endl << std::endl; - if (!confirm ("Are you sure you want to undo the last update?")) + if (!confirm ("The undo command is irreversible. Are you sure you want to undo the last update?")) throw std::string ("No changes made."); // Extract identifying uuid. @@ -563,6 +563,8 @@ void TDB::undo () { if (task->find (uuid) != std::string::npos) { + context.debug ("TDB::undo - task found in pending.data"); + // Either revert if there was a prior state, or remove the task. if (prior != "") { @@ -589,34 +591,30 @@ void TDB::undo () // is 'current' in completed? foreach (task, c) { - std::cout << "# loop " << *task << std::endl; - if (task->find (uuid) != std::string::npos) { - std::cout << "# found in completed" << std::endl; + context.debug ("TDB::undo - task found in completed.data"); // If task now belongs back in pending.data if (prior.find ("status:\"pending\"") != std::string::npos || prior.find ("status:\"waiting\"") != std::string::npos || prior.find ("status:\"recurring\"") != std::string::npos) { - std::cout << "# task belongs in pending.data" << std::endl; - c.erase (task); p.push_back (prior); spit (completedFile, c); spit (pendingFile, p); spit (undoFile, u); std::cout << "Modified task reverted." << std::endl; + context.debug ("TDB::undo - task belongs in pending.data"); } else { - std::cout << "# task belongs in pending.data" << std::endl; - *task = prior; spit (completedFile, c); spit (undoFile, u); std::cout << "Modified task reverted." << std::endl; + context.debug ("TDB::undo - task belongs in completed.data"); } std::cout << "Undo complete." << std::endl;