anchor.diff:      
       % Merge the new docs into the revision trees.
       NoConflicts = lists:member(no_conflicts, Options),
  -    {ok, NewRevTrees} = merge_rev_trees(NoConflicts, DocsList2, OldDocTrees, []),
  -    
  -    RemoveSeqs = [ OldSeq || {ok, #full_doc_info{update_seq=OldSeq}} <- OldDocLookups],
  +    {ok, NewDocInfos, NewSeq} = merge_rev_trees(NoConflicts, DocsList2, OldDocInfos, [], LastSeq),
  +    
  +    RemoveSeqs =
  +        [ OldSeq || {ok, #full_doc_info{update_seq=OldSeq}} <- OldDocLookups],
       
       % All regular documents are now ready to write.
       
  
positive.code: 
  flush_trees(_Db, [], AccFlushedTrees) ->
      {ok, lists:reverse(AccFlushedTrees)};
  flush_trees(#db{fd=Fd}=Db, [Unflushed | RestUnflushed], AccFlushed) ->
         Flushed = couch_key_tree:map(
          fun(_Rev, Value) ->
              case Value of
              #doc{attachments=Atts,deleted=IsDeleted}=Doc ->
  
negative.code:             #doc_info{deleted=false} ->
                  {OldCountAcc + 1, OldDelCountAcc};
              _ ->
                  {OldCountAcc, OldDelCountAcc + 1}
              end;
          (not_found, Acc) ->
              Acc
  