anchor.diff:          writer_loop(Parent, Reader, Target)
       end.
   
  -write_docs(#http_db{} = Db, Docs) ->
  +write_docs(#http_db{} = Db, Docs, ErrorsAcc) ->
       ErrorsJson = couch_rep_httpc:request(Db#http_db{
           resource = "_bulk_docs",
           method = post,
  
positive.code: 
  -include("couch_db.hrl").
  
  start_link(Parent, Target, Reader, _PostProps) ->
      {ok, spawn_link(fun() -> writer_loop(Parent, Reader, Target) end)}.
  
  make_chunk(Data) when is_list(Data) ->
      make_chunk(list_to_binary(Data));
  make_chunk(Data) ->
      [ibrowse_lib:dec2hex(8, size(Data)), "\r\n", Data, "\r\n"].
  
  upload_docs({start, Docs}) ->
      Data = make_chunk(<<"{\"new_edits\":false, \"docs\":[">>),
      {ok, Data, {continue, Docs, ""}};
  upload_docs({continue, [Doc|Rest], Prepend}) ->
      JsonDoc = ?JSON_ENCODE(couch_doc:to_json_obj(Doc, [revs,attachments])),
      {ok, make_chunk([Prepend, JsonDoc]), {continue, Rest, ","}};
  upload_docs({continue, [], _}) ->
      {ok, make_chunk(<<"]}\n">>), last_chunk};
  upload_docs(last_chunk) ->
      {ok, "0\r\n\r\n", finish};
  upload_docs(finish) ->
  
negative.code:         ok;
      {HighSeq, Docs} ->
          DocCount = length(Docs),
          try write_docs(Target, Docs, []) of
          {ok, []} ->
              Parent ! {update_stats, docs_written, DocCount};
          {ok, Errors} ->
  