diff --git a/ChangeLog b/ChangeLog index fe7cf2486..2122abb10 100644 --- a/ChangeLog +++ b/ChangeLog @@ -43,6 +43,7 @@ + Improved text wrapping of UTF8 text. + When duplicating a parent recurring task, a new recurring parent task is created. When a child recurring task is duplicated, a plain task is created. + + The 'diagnostics' command now checks for duplicate UUID values in the data. # Tracked Features, sorted by ID. + Added feature #52, which provides improved text-wrapping support for UTF-8 diff --git a/src/commands/CmdDiagnostics.cpp b/src/commands/CmdDiagnostics.cpp index a7fd6feb5..b95824206 100644 --- a/src/commands/CmdDiagnostics.cpp +++ b/src/commands/CmdDiagnostics.cpp @@ -309,6 +309,37 @@ int CmdDiagnostics::execute (std::string& output) << "x" << context.getHeight () << ")\n"; + + // Scan tasks for duplicate UUIDs. + std::vector all = context.tdb2.all_tasks (); + std::map seen; + std::vector dups; + std::string uuid; + std::vector ::iterator i; + for (i = all.begin (); i != all.end (); ++i) + { + uuid = i->get ("uuid"); + if (seen.find (uuid) != seen.end ()) + dups.push_back (uuid); + else + seen[uuid] = 0; + } + + out << " Dups: " + << format (STRING_CMD_DIAG_UUID_SCAN, all.size ()) + << "\n"; + + if (dups.size ()) + { + std::vector ::iterator d; + for (d = dups.begin (); d != dups.end (); ++d) + out << " " << format (STRING_CMD_DIAG_UUID_DUP, *d) << "\n"; + } + else + { + out << " " << STRING_CMD_DIAG_UUID_NO_DUP + << "\n"; + } } out << "\n"; diff --git a/src/en-US.h b/src/en-US.h index 7193d6a7a..31f89e2d0 100644 --- a/src/en-US.h +++ b/src/en-US.h @@ -407,6 +407,9 @@ #define STRING_CMD_DIAG_TESTS "Tests" #define STRING_CMD_DIAG_UUID_GOOD "1000 unique UUIDs generated." #define STRING_CMD_DIAG_UUID_BAD "Failed - duplicate UUID at iteration {1}" +#define STRING_CMD_DIAG_UUID_SCAN "Scanned {1} tasks for duplicate UUIDs:" +#define STRING_CMD_DIAG_UUID_DUP "Found duplicate {1}" +#define STRING_CMD_DIAG_UUID_NO_DUP "No duplicates found" #define STRING_CMD_DIAG_NONE "-none-" #define STRING_CMD_PUSH_USAGE "Pushes the local files to the URL" #define STRING_CMD_PUSH_SAME "Cannot push files when the source and destination are the same."