Fix for a nasty bug where a document doesn't get assigned any channels
(nor gets validated!) when multiple revisions of it get pushed at once,
i.e. the parent rev of the new revision doesn't have a JSON body
available.
The sync function will now be called, with 'oldDoc' set to the nearest
available ancestor, or null if there's no ancestor with a body.
Added a unit test to catch this.
Fixes #300