fix(replication): Fix function for bug #1418 when multiple revisions
fix(replication): Fix function for bug #1418 when multiple revisions

This commit fixes three things:
- When the bug occurs, the document on source server can have multiple
  new revisions (not only one), see the following diagram.
- Make sure we can fix the problem, before writing anything to the
  target server.
- Don't retry calling `bug_1418_create_missing_documents()` infinitely
  if, for some reason, it does not do its job.

                         tombstone rev
          first rev     (last common ancestor)     latest rev on source
             ↘               ↓                    ↙
    SOURCE    o----o----o----o----o----o----o----o
    TARGET    o----o----o----o
                              ↖
                               tombstone rev (latest rev on target)

Tested on two local servers where the bug is present.

adrienverge/coucharchive