'Generate a dictionary that contains the information about a repository that is necessary for installing
it into a local Galaxy instance.'

@web.json
def get_updated_repository_information(self, trans, name, owner, changeset_revision, **kwd):

    repository = repository_util.get_repository_by_name_and_owner(trans.app, name, owner)
    repository_id = trans.security.encode_id(repository.id)
    repository_clone_url = common_util.generate_clone_url_for_repository_in_tool_shed(trans.user, repository)
    repo = hg_util.get_repo_for_repository(trans.app, repository=repository, repo_path=None, create=False)
    repository_metadata = metadata_util.get_repository_metadata_by_changeset_revision(trans.app, repository_id, changeset_revision)
    if (not repository_metadata):
        changeset_revision = metadata_util.get_next_downloadable_changeset_revision(repository, repo, after_changeset_revision=changeset_revision)
        repository_metadata = metadata_util.get_repository_metadata_by_changeset_revision(trans.app, repository_id, changeset_revision)
    ctx = hg_util.get_changectx_for_changeset(repo, changeset_revision)
    repo_info_dict = repository_util.create_repo_info_dict(app=trans.app, repository_clone_url=repository_clone_url, changeset_revision=changeset_revision, ctx_rev=str(ctx.rev()), repository_owner=repository.user.username, repository_name=repository.name, repository=repository, repository_metadata=repository_metadata, tool_dependencies=None, repository_dependencies=None)
    includes_data_managers = False
    includes_datatypes = False
    includes_tools = False
    includes_tools_for_display_in_tool_panel = False
    includes_workflows = False
    readme_files_dict = None
    metadata = repository_metadata.metadata
    if metadata:
        if ('data_manager' in metadata):
            includes_data_managers = True
        if ('datatypes' in metadata):
            includes_datatypes = True
        if ('tools' in metadata):
            includes_tools = True
            tool_dicts = metadata['tools']
            for tool_dict in tool_dicts:
                if tool_dict.get('includes_tools_for_display_in_tool_panel', False):
                    includes_tools_for_display_in_tool_panel = True
                    break
        if ('workflows' in metadata):
            includes_workflows = True
        readme_files_dict = readme_util.build_readme_files_dict(trans.app, repository, changeset_revision, metadata)
    has_repository_dependencies = False
    has_repository_dependencies_only_if_compiling_contained_td = False
    includes_tool_dependencies = False
    for (name, repo_info_tuple) in repo_info_dict.items():
        if ((not has_repository_dependencies) or (not has_repository_dependencies_only_if_compiling_contained_td) or (not includes_tool_dependencies)):
            (description, reposectory_clone_url, changeset_revision, ctx_rev, repository_owner, repository_dependencies, tool_dependencies) = repository_util.get_repo_info_tuple_contents(repo_info_tuple)
            for (rd_key, rd_tups) in repository_dependencies.items():
                if (rd_key in ['root_key', 'description']):
                    continue
                (curr_has_repository_dependencies, curr_has_repository_dependencies_only_if_compiling_contained_td) = repository_util.get_repository_dependency_types(rd_tups)
                if (curr_has_repository_dependencies and (not has_repository_dependencies)):
                    has_repository_dependencies = True
                if (curr_has_repository_dependencies_only_if_compiling_contained_td and (not has_repository_dependencies_only_if_compiling_contained_td)):
                    has_repository_dependencies_only_if_compiling_contained_td = True
            if (tool_dependencies and (not includes_tool_dependencies)):
                includes_tool_dependencies = True
    return dict(includes_data_managers=includes_data_managers, includes_datatypes=includes_datatypes, includes_tools=includes_tools, includes_tools_for_display_in_tool_panel=includes_tools_for_display_in_tool_panel, 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_workflows=includes_workflows, readme_files_dict=readme_files_dict, repo_info_dict=repo_info_dict)
