'Return dictionaries containing the sets of installed and missing tool dependencies and repository
dependencies associated with the repository defined by the received repo_info_dict.'

def get_dependencies_for_repository(self, tool_shed_url, repo_info_dict, includes_tool_dependencies, updating=False):

    rdim = repository_dependency_manager.RepositoryDependencyInstallManager(self.app)
    repository = None
    installed_rd = {}
    installed_td = {}
    missing_rd = {}
    missing_td = {}
    name = next(iter(repo_info_dict))
    repo_info_tuple = repo_info_dict[name]
    (description, repository_clone_url, changeset_revision, ctx_rev, repository_owner, repository_dependencies, tool_dependencies) = repository_util.get_repo_info_tuple_contents(repo_info_tuple)
    if tool_dependencies:
        if (not includes_tool_dependencies):
            includes_tool_dependencies = True
        (installed_td, missing_td) = self.get_installed_and_missing_tool_dependencies_for_repository(tool_dependencies)
    if repository_dependencies:
        if (not repository):
            repository = repository_util.get_repository_for_dependency_relationship(self.app, tool_shed_url, name, repository_owner, changeset_revision)
        if ((not updating) and repository and repository.metadata):
            (installed_rd, missing_rd) = self.get_installed_and_missing_repository_dependencies(repository)
        else:
            (installed_rd, missing_rd) = self.get_installed_and_missing_repository_dependencies_for_new_or_updated_install(repo_info_tuple)
        all_repo_info_dict = rdim.get_required_repo_info_dicts(tool_shed_url, util.listify(repo_info_dict))
        has_repository_dependencies = all_repo_info_dict.get('has_repository_dependencies', False)
        has_repository_dependencies_only_if_compiling_contained_td = all_repo_info_dict.get('has_repository_dependencies_only_if_compiling_contained_td', False)
        includes_tools_for_display_in_tool_panel = all_repo_info_dict.get('includes_tools_for_display_in_tool_panel', False)
        includes_tool_dependencies = all_repo_info_dict.get('includes_tool_dependencies', False)
        includes_tools = all_repo_info_dict.get('includes_tools', False)
        required_repo_info_dicts = all_repo_info_dict.get('all_repo_info_dicts', [])
        if required_repo_info_dicts:
            required_tool_dependencies = {}
            for rid in required_repo_info_dicts:
                for (name, repo_info_tuple) in rid.items():
                    (description, repository_clone_url, changeset_revision, ctx_rev, repository_owner, rid_repository_dependencies, rid_tool_dependencies) = repository_util.get_repo_info_tuple_contents(repo_info_tuple)
                    if rid_tool_dependencies:
                        for (td_key, td_dict) in rid_tool_dependencies.items():
                            if (td_key not in required_tool_dependencies):
                                required_tool_dependencies[td_key] = td_dict
            if required_tool_dependencies:
                (required_installed_td, required_missing_td) = self.get_installed_and_missing_tool_dependencies_for_repository(required_tool_dependencies)
                if required_installed_td:
                    if (not includes_tool_dependencies):
                        includes_tool_dependencies = True
                    for (td_key, td_dict) in required_installed_td.items():
                        if (td_key not in installed_td):
                            installed_td[td_key] = td_dict
                if required_missing_td:
                    if (not includes_tool_dependencies):
                        includes_tool_dependencies = True
                    for (td_key, td_dict) in required_missing_td.items():
                        if (td_key not in missing_td):
                            missing_td[td_key] = td_dict
    else:
        all_repo_info_dict = rdim.get_required_repo_info_dicts(tool_shed_url, util.listify(repo_info_dict))
        has_repository_dependencies = all_repo_info_dict.get('has_repository_dependencies', False)
        has_repository_dependencies_only_if_compiling_contained_td = all_repo_info_dict.get('has_repository_dependencies_only_if_compiling_contained_td', False)
        includes_tools_for_display_in_tool_panel = all_repo_info_dict.get('includes_tools_for_display_in_tool_panel', False)
        includes_tool_dependencies = all_repo_info_dict.get('includes_tool_dependencies', False)
        includes_tools = all_repo_info_dict.get('includes_tools', False)
        required_repo_info_dicts = all_repo_info_dict.get('all_repo_info_dicts', [])
    dependencies_for_repository_dict = dict(changeset_revision=changeset_revision, has_repository_dependencies=has_repository_dependencies, has_repository_dependencies_only_if_compiling_contained_td=has_repository_dependencies_only_if_compiling_contained_td, includes_tool_dependencies=includes_tool_dependencies, includes_tools=includes_tools, includes_tools_for_display_in_tool_panel=includes_tools_for_display_in_tool_panel, installed_repository_dependencies=installed_rd, installed_tool_dependencies=installed_td, missing_repository_dependencies=missing_rd, missing_tool_dependencies=missing_td, name=name, repository_owner=repository_owner)
    return dependencies_for_repository_dict
