mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
CmdDiagnostics: Add broken reference detection
This commit is contained in:
parent
0693f3cfc4
commit
de8c7d230f
10 changed files with 77 additions and 0 deletions
|
@ -377,6 +377,47 @@ int CmdDiagnostics::execute (std::string& output)
|
|||
<< "\n";
|
||||
}
|
||||
|
||||
|
||||
// Check all the UUID references
|
||||
|
||||
bool noBrokenRefs = true;
|
||||
out << " Broken ref: "
|
||||
<< format (STRING_CMD_DIAG_REF_SCAN, all.size ())
|
||||
<< "\n";
|
||||
|
||||
for (auto& task : all)
|
||||
{
|
||||
// Check dependencies
|
||||
std::vector <std::string> dependencies;
|
||||
task.getDependencies(dependencies);
|
||||
|
||||
for (auto& uuid : dependencies)
|
||||
{
|
||||
if (! context.tdb2.has (uuid))
|
||||
{
|
||||
out << " "
|
||||
<< format (STRING_CMD_DIAG_MISS_DEP, task.get ("uuid"), uuid)
|
||||
<< "\n";
|
||||
noBrokenRefs = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Check recurrence parent
|
||||
std::string parentUUID = task.get ("parent");
|
||||
|
||||
if (parentUUID != "" && ! context.tdb2.has (parentUUID))
|
||||
{
|
||||
out << " "
|
||||
<< format (STRING_CMD_DIAG_MISS_PAR, task.get ("uuid"), parentUUID)
|
||||
<< "\n";
|
||||
noBrokenRefs = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (noBrokenRefs)
|
||||
out << " " << STRING_CMD_DIAG_REF_OK
|
||||
<< "\n";
|
||||
|
||||
out << "\n";
|
||||
output = out.str ();
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue