'Remove all repository dependencies that point to a revision within its own repository.'

def remove_repository_dependency_reference_to_self(self, key_rd_dicts):

    clean_key_rd_dicts = []
    key = next(iter(key_rd_dicts[0]))
    repository_tup = key.split(container_util.STRSEP)
    (rd_toolshed, rd_name, rd_owner, rd_changeset_revision, rd_prior_installation_required, rd_only_if_compiling_contained_td) = common_util.parse_repository_dependency_tuple(repository_tup)
    cleaned_rd_toolshed = common_util.remove_protocol_from_tool_shed_url(rd_toolshed)
    for key_rd_dict in key_rd_dicts:
        k = next(iter(key_rd_dict))
        repository_dependency = key_rd_dict[k]
        (toolshed, name, owner, changeset_revision, prior_installation_required, only_if_compiling_contained_td) = common_util.parse_repository_dependency_tuple(repository_dependency)
        cleaned_toolshed = common_util.remove_protocol_from_tool_shed_url(toolshed)
        if ((cleaned_rd_toolshed == cleaned_toolshed) and (rd_name == name) and (rd_owner == owner)):
            debug_msg = ('Removing    repository    dependency    for    repository    %s    owned    by    %s    ' % (name, owner))
            debug_msg += 'since    it    refers    to    a    revision    within    itself.'
            log.debug(debug_msg)
        else:
            new_key_rd_dict = {}
            new_key_rd_dict[key] = repository_dependency
            clean_key_rd_dicts.append(new_key_rd_dict)
    return clean_key_rd_dicts
