Issue a warning if .data files remain (#3321)

This will help users realize that they have updated to an incompatible
version and must export and import their tasks.
This commit is contained in:
Dustin J. Mitchell 2024-03-31 18:55:30 -04:00 committed by GitHub
parent 5a56cff88b
commit 8a0a98d3ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -57,6 +57,14 @@ TDB2::TDB2 ()
////////////////////////////////////////////////////////////////////////////////
void TDB2::open_replica (const std::string& location, bool create_if_missing)
{
File pending_data = File (location + "/pending.data");
if (pending_data.exists()) {
Color warning = Color (Context::getContext ().config.get ("color.warning"));
std::cerr << warning.colorize (
format ("Found existing '.data' files in {1}", location)) << "\n";
std::cerr << " Taskwarrior's storage format changed in 3.0, requiring a manual migration.\n";
std::cerr << " See https://github.com/GothenburgBitFactory/taskwarrior/releases.\n";
}
replica = tc::Replica(location, create_if_missing);
}