Syncing historical taskwarrior data to taskd

January 16, 2014 at 08:13 PM | categories: software | View Comments

Taskwarrior, my to-do list software of choice, recently released the taskd task server to sync tasks across multiple devices.

Prior to this, your choices were to sync with Dropbox, which worked for the most part but didn't have real conflict resolution if multiple clients wrote at the same time, and a special "merge" command, but merging only really worked between exactly two peer clients and did not really support an arbitrary number of clients talking to a canonical server.

taskd fixes all this, so I wanted to migrate as soon as possible. Unfortunately, the blessed way of migrating to taskd only migrates tasks you have not yet finished; your already completed tasks are not synced. I have several years of completed tasks I'd like to keep, so I looked for a solution. Luckily, it is pretty simple to modify the import procedure to import both pending and completed tasks.

On your first import, the documentation says you should run:

task sync init

Instead of doing that, you need to trick taskwarrior into initializing with both your pending and completed tasks. To do that, all you need to do is append your completed.data file to pending.data; the task client just sends pending.data, but the two have the same format and the server knows how import completed tasks just fine. Put simply:

cp -r ~/.task ~/.task.backup # For safety
cd ~/.task
cp pending.data pending.data.old
cat completed.data >> pending.data
task sync init
mv pending.data.old pending.data

That should import everything. If you're like me and you have a huge history with taskwarrior, the server may complain that the request is too large. If you get an error like this, all you need to do on the server is increase the request size limit in your server's taskdrc:

request.limit=10485760

You should then be able to import a larger backlog. The paranoid will probably want to undo this change to request.limit after the initial import to protect server resources once at steady state.

You can now reconstitute both completed.data and pending.data on a fresh client by running:

task sync

Of course, you'll need to get the proper keys and certificates installed on the new client before syncing.

Have fun doing tasks!

blog comments powered by Disqus