Complete issue #120

- Port the fix for the issue couchbase/couchbase-lite-java-core#95. The
fix ensures that the last sequence will be updated correct in the case
that one of the lower sequence doc (esp with the attachment) is failed
while being uploaded to the sync gateway.
- Port ReplicationTest. TestPushReplicationCanMissDocs().
Rebase and fix conflicts
Fix merge conflicts
Cleaned up debug logging calls, tabs > spaces.
Merge pull request #168 from couchbaselabs/issue-120

Complete issue #120 - Port Pusher updating lastSequence bug fix