'Return the changeset revision hash to which the repository can be updated.'

def get_update_to_changeset_revision_and_ctx_rev(self, repository):

    changeset_revision_dict = {}
    tool_shed_url = common_util.get_tool_shed_url_from_tool_shed_registry(self.app, str(repository.tool_shed))
    params = dict(name=str(repository.name), owner=str(repository.owner), changeset_revision=str(repository.installed_changeset_revision))
    pathspec = ['repository', 'get_changeset_revision_and_ctx_rev']
    try:
        encoded_update_dict = util.url_get(tool_shed_url, password_mgr=self.app.tool_shed_registry.url_auth(tool_shed_url), pathspec=pathspec, params=params)
        if encoded_update_dict:
            update_dict = encoding_util.tool_shed_decode(encoded_update_dict)
            includes_data_managers = update_dict.get('includes_data_managers', False)
            includes_datatypes = update_dict.get('includes_datatypes', False)
            includes_tools = update_dict.get('includes_tools', False)
            includes_tools_for_display_in_tool_panel = update_dict.get('includes_tools_for_display_in_tool_panel', False)
            includes_tool_dependencies = update_dict.get('includes_tool_dependencies', False)
            includes_workflows = update_dict.get('includes_workflows', False)
            has_repository_dependencies = update_dict.get('has_repository_dependencies', False)
            has_repository_dependencies_only_if_compiling_contained_td = update_dict.get('has_repository_dependencies_only_if_compiling_contained_td', False)
            changeset_revision = update_dict.get('changeset_revision', None)
            ctx_rev = update_dict.get('ctx_rev', None)
        changeset_revision_dict['includes_data_managers'] = includes_data_managers
        changeset_revision_dict['includes_datatypes'] = includes_datatypes
        changeset_revision_dict['includes_tools'] = includes_tools
        changeset_revision_dict['includes_tools_for_display_in_tool_panel'] = includes_tools_for_display_in_tool_panel
        changeset_revision_dict['includes_tool_dependencies'] = includes_tool_dependencies
        changeset_revision_dict['includes_workflows'] = includes_workflows
        changeset_revision_dict['has_repository_dependencies'] = has_repository_dependencies
        changeset_revision_dict['has_repository_dependencies_only_if_compiling_contained_td'] = has_repository_dependencies_only_if_compiling_contained_td
        changeset_revision_dict['changeset_revision'] = changeset_revision
        changeset_revision_dict['ctx_rev'] = ctx_rev
    except Exception as e:
        log.debug(("Error    getting    change    set    revision    for    update    from    the    tool    shed    for    repository    '%s':    %s" % (repository.name, str(e))))
        changeset_revision_dict['includes_data_managers'] = False
        changeset_revision_dict['includes_datatypes'] = False
        changeset_revision_dict['includes_tools'] = False
        changeset_revision_dict['includes_tools_for_display_in_tool_panel'] = False
        changeset_revision_dict['includes_tool_dependencies'] = False
        changeset_revision_dict['includes_workflows'] = False
        changeset_revision_dict['has_repository_dependencies'] = False
        changeset_revision_dict['has_repository_dependencies_only_if_compiling_contained_td'] = False
        changeset_revision_dict['changeset_revision'] = None
        changeset_revision_dict['ctx_rev'] = None
    return changeset_revision_dict
