anchor.diff:          Filter ->
               [Filter, couch_util:get_value(<<"query_params">>, Props, {[]})]
           end,
  -    Extension = maybe_append_options(
  -        [<<"continuous">>, <<"create_target">>], Props),
  -    {couch_util:to_hex(couch_util:md5(term_to_binary(Base))), Extension}.
  +    couch_util:to_hex(couch_util:md5(term_to_binary(Base2))).
   
   maybe_add_trailing_slash(Url) ->
       re:replace(Url, "[^/]$", "&/", [{return, list}]).
  
positive.code: 
  -include("couch_db.hrl").
  
  -record(state, {
      changes_feed,
      missing_revs,
  
negative.code: get_rep_endpoint(UserCtx, <<DbName/binary>>) ->
      {local, DbName, UserCtx}.
  
  find_replication_logs(Logs, RepId, {Props}, UserCtx) ->
      LogId = ?l2b(?LOCAL_DOC_PREFIX ++ RepId),
      fold_replication_logs(Logs, ?REP_ID_VERSION,
          LogId, LogId, {Props}, UserCtx, []).
  
  % Accumulate the replication logs
  % Falls back to older log document ids and migrates them
  fold_replication_logs([], _Vsn, _LogId, _NewId, {_Props}, _UserCtx, Acc) ->
      lists:reverse(Acc);
  fold_replication_logs([Db|Rest]=Dbs, Vsn, LogId, NewId,
          {Props}, UserCtx, Acc) ->
      case open_replication_log(Db, LogId) of
      {error, not_found} when Vsn > 1 ->
          OldRepId = make_replication_id({Props}, UserCtx, Vsn - 1),
          fold_replication_logs(Dbs, Vsn - 1,
              ?l2b(?LOCAL_DOC_PREFIX ++ OldRepId), NewId, {Props}, UserCtx, Acc);
      {error, not_found} ->
          fold_replication_logs(Rest, ?REP_ID_VERSION, NewId, NewId,
              {Props}, UserCtx, [#doc{id=NewId}|Acc]);
      {ok, Doc} when LogId =:= NewId ->
          fold_replication_logs(Rest, ?REP_ID_VERSION, NewId, NewId,
              {Props}, UserCtx, [Doc|Acc]);
      {ok, Doc} ->
          MigratedLog = #doc{id=NewId,body=Doc#doc.body},
          fold_replication_logs(Rest, ?REP_ID_VERSION, NewId, NewId,
              {Props}, UserCtx, [MigratedLog|Acc])
      end.
  
  open_replication_log(#http_db{}=Db, DocId) ->
      Req = Db#http_db{resource=couch_util:url_encode(?b2l(DocId))},
      case couch_rep_httpc:request(Req) of
      {[{<<"error">>, _}, {<<"reason">>, _}]} ->
          ?LOG_DEBUG("didn't find a replication log for ~s", [Db#http_db.url]),
          {error, not_found};
      Doc ->
          ?LOG_DEBUG("found a replication log for ~s", [Db#http_db.url]),
          {ok, couch_doc:from_json_obj(Doc)}
      end;
  open_replication_log(Db, DocId) ->
      case couch_db:open_doc(Db, DocId, []) of
      {ok, Doc} ->
          ?LOG_DEBUG("found a replication log for ~s", [Db#db.name]),
          {ok, Doc};
      _ ->
          ?LOG_DEBUG("didn't find a replication log for ~s", [Db#db.name]),
          {error, not_found}
      end.
  
  open_db(Props, UserCtx) ->
  