anchor.diff:      [];
   map_rewrite_encoded(RO, _, _) ->
       {_, _, B2, K2} = decode_object(RO),
  -    copy_object(RO, B2, K2),
  -    [].
  +    case copy_object(RO, B2, K2) of
  +        ok ->
  +            [];
  +        _ ->
  +            [{riak_object:bucket(RO), riak_object:key(RO)}]
  +    end.
   
   %% Post-commit that can be installed to force live migration of newly
   %% inserted buckets/keys before cluster is switched over to proper
  
positive.code: %% Perform second phase of migration: delete objects with encoded buckets/keys.
  delete_migrated_objects(EObjs) ->
      {ok, RC} = riak:local_client(),
      [RC:delete(B, K) || {B, K} <- EObjs],
      io:format("All objects with URL encoded buckets/keys have been "
                "deleted.~n", []).
  
  %% @private
  decode_name({B1, K1}) ->
  
negative.code: 
  %% Returns true if any value is double (or more) encoded.
  check_double_encoding(EObjs) ->
      DL = lists:filter(fun(Name) ->
                                Name2 = decode_name(Name),
                                Name2 /= decode_name(Name2)
                        end, EObjs),
      case DL of
          [] ->
              {false, []};
          _ ->
              {true, DL}
      end.
  
  %% Determine if it is safe to perform migration (no bucket/key conflicts).
  check_safe(RC, EObjs) ->
      EObjs2 = [decode_name(Name) || Name <- EObjs],
      MR = RC:mapred(EObjs2, [map_unsafe()]),
      case MR of
          {ok, []} ->
              {safe, []};
          {ok, Unsafe} ->
              {unsafe, Unsafe}
      end.
  
  map_unsafe() ->
      {map, {modfun, ?MODULE, map_unsafe}, none, true}.
  map_unsafe({error, notfound}, _, _) ->
      [];
  map_unsafe(RO, _, _) ->
      [{list_to_binary(mochiweb_util:quote_plus(riak_object:bucket(RO))),
        list_to_binary(mochiweb_util:quote_plus(riak_object:key(RO)))}].
  
  %% Perform first phase of migration: copying encoded values to
  %% unencoded equivalents.
  migrate_objects(EObjs) ->
      {ok, RC} = riak:local_client(),
      riak_kv_mapred_cache:clear(),
      MR = RC:mapred(EObjs, [map_rewrite_encoded()]),
      case MR of
          {ok, []} ->
              io:format("All objects with URL encoded buckets/keys have been "
                        "copied to unencoded equivalents.~n", []),
              {ok, []};
          {ok, Failed} ->
              io:format("Some URL encoded objects failed to copy.~n", []),
              {failed, Failed};
          _ ->
              io:format("There was an error copying objects.~n", []),
              error
      end.
  
  map_rewrite_encoded() ->
      {map, {modfun, ?MODULE, map_rewrite_encoded}, none, true}.
  