anchor.diff:  
   flush_trees(_Db, [], AccFlushedTrees) ->
       {ok, lists:reverse(AccFlushedTrees)};
  -flush_trees(#db{fd=Fd}=Db, [Unflushed | RestUnflushed], AccFlushed) ->
  -       Flushed = couch_key_tree:map(
  +flush_trees(#db{fd=Fd}=Db, [InfoUnflushed | RestUnflushed], AccFlushed) ->
  +        #full_doc_info{rev_tree=Unflushed} = InfoUnflushed,
  +        Flushed = couch_key_tree:map(
           fun(_Rev, Value) ->
               case Value of
               #doc{attachments=Atts,deleted=IsDeleted}=Doc ->
  
positive.code:     
      % lookup up the existing documents, if they exist.
      OldDocLookups = couch_btree:lookup(DocInfoByIdBTree, Ids),
      OldDocTrees = lists:map(
          fun({ok, #full_doc_info{rev_tree=OldRevTree}}) ->
              OldRevTree;
          (not_found) ->
              []
          end,
          OldDocLookups),
      
      {OldCount, OldDelCount} = lists:foldl(
          fun({ok, FullDocInfo}, {OldCountAcc, OldDelCountAcc}) ->
  
negative.code:     {ok, Db2}  = update_local_docs(Db, NonRepDocs),
      
      % Write out the documents summaries (they are stored in the nodes of the rev trees)
      {ok, FlushedDocInfos} = flush_trees(Db2, NewDocInfos, []),
      
      {ok, NewDocsCount, NewDelCount, InfoById, InfoBySeq} =
          new_index_entries(FlushedDocInfos, 0, 0, [], []),
  
      % and the indexes to the documents
      {ok, DocInfoBySeqBTree2} = couch_btree:add_remove(DocInfoBySeqBTree, InfoBySeq, RemoveSeqs),
  