mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Sync: 'init' now uploads pending + completed/deleted tasks
This commit is contained in:
parent
8337f78efe
commit
c023e3e721
2 changed files with 11 additions and 4 deletions
|
@ -7,6 +7,8 @@
|
||||||
- TW-1313 some recurring intervals reset due time to midnight
|
- TW-1313 some recurring intervals reset due time to midnight
|
||||||
(thanks to James Dietrich).
|
(thanks to James Dietrich).
|
||||||
- TW-1425 The 'age' format rounds in odd ways (thanks to Black Ops testing).
|
- 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
|
- TW-1446 Difference in how relative dates are specified in report filters since 2.3.0
|
||||||
(thanks to atomicules).
|
(thanks to atomicules).
|
||||||
- TW-1481 Unable to assign a completed task as dependency (thanks to Tomas
|
- TW-1481 Unable to assign a completed task as dependency (thanks to Tomas
|
||||||
|
|
|
@ -125,8 +125,8 @@ int CmdSync::execute (std::string& output)
|
||||||
if (! key.exists ())
|
if (! key.exists ())
|
||||||
throw std::string (STRING_CMD_SYNC_BAD_KEY);
|
throw std::string (STRING_CMD_SYNC_BAD_KEY);
|
||||||
|
|
||||||
// If this is a first-time initialization, send pending.data, not
|
// If this is a first-time initialization, send pending.data and
|
||||||
// backlog.data.
|
// completed.data, but not backlog.data.
|
||||||
std::string payload = "";
|
std::string payload = "";
|
||||||
int upload_count = 0;
|
int upload_count = 0;
|
||||||
if (first_time_init)
|
if (first_time_init)
|
||||||
|
@ -135,8 +135,8 @@ int CmdSync::execute (std::string& output)
|
||||||
// deltas is meaningless.
|
// deltas is meaningless.
|
||||||
context.tdb2.backlog._file.truncate ();
|
context.tdb2.backlog._file.truncate ();
|
||||||
|
|
||||||
auto pending = context.tdb2.pending.get_tasks ();
|
auto all_tasks = context.tdb2.all_tasks ();
|
||||||
for (auto& i : pending)
|
for (auto& i : all_tasks)
|
||||||
{
|
{
|
||||||
payload += i.composeJSON () + "\n";
|
payload += i.composeJSON () + "\n";
|
||||||
++upload_count;
|
++upload_count;
|
||||||
|
@ -162,6 +162,11 @@ int CmdSync::execute (std::string& output)
|
||||||
request.set ("user", credentials[1]);
|
request.set ("user", credentials[1]);
|
||||||
request.set ("key", credentials[2]);
|
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);
|
request.setPayload (payload);
|
||||||
|
|
||||||
if (context.verbose ("sync"))
|
if (context.verbose ("sync"))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue