mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Code Cleanup
- Converted std::cout diagnostics to context.debug calls.
This commit is contained in:
parent
569d31da7a
commit
e7ba2ab76d
1 changed files with 6 additions and 8 deletions
14
src/TDB.cpp
14
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue