diff --git a/ChangeLog b/ChangeLog index ea6e3c83f..a5507cfe0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,8 @@ - TW-1313 some recurring intervals reset due time to midnight (thanks to James Dietrich). - TW-1425 The 'age' format rounds in odd ways (thanks to Black Ops testing). +- TW-1435 Ability to sync the full history of tasks including completed ones + (thanks to Renato Alves). - TW-1446 Difference in how relative dates are specified in report filters since 2.3.0 (thanks to atomicules). - TW-1481 Unable to assign a completed task as dependency (thanks to Tomas diff --git a/src/commands/CmdSync.cpp b/src/commands/CmdSync.cpp index 361729723..0001fa3ab 100644 --- a/src/commands/CmdSync.cpp +++ b/src/commands/CmdSync.cpp @@ -125,8 +125,8 @@ int CmdSync::execute (std::string& output) if (! key.exists ()) throw std::string (STRING_CMD_SYNC_BAD_KEY); - // If this is a first-time initialization, send pending.data, not - // backlog.data. + // If this is a first-time initialization, send pending.data and + // completed.data, but not backlog.data. std::string payload = ""; int upload_count = 0; if (first_time_init) @@ -135,8 +135,8 @@ int CmdSync::execute (std::string& output) // deltas is meaningless. context.tdb2.backlog._file.truncate (); - auto pending = context.tdb2.pending.get_tasks (); - for (auto& i : pending) + auto all_tasks = context.tdb2.all_tasks (); + for (auto& i : all_tasks) { payload += i.composeJSON () + "\n"; ++upload_count; @@ -162,6 +162,11 @@ int CmdSync::execute (std::string& output) request.set ("user", credentials[1]); request.set ("key", credentials[2]); + // Tell the server that this is a full upload, allowing it to perhaps compact + // its data. + if (first_time_init) + request.set ("subtype", "init"); + request.setPayload (payload); if (context.verbose ("sync"))