'Compare the contents of two changeset revisions to determine if a new repository
metadata revision should be created.'

def compare_changeset_revisions(self, ancestor_changeset_revision, ancestor_metadata_dict):

    ancestor_datatypes = ancestor_metadata_dict.get('datatypes', [])
    ancestor_tools = ancestor_metadata_dict.get('tools', [])
    ancestor_guids = [tool_dict['guid'] for tool_dict in ancestor_tools]
    ancestor_guids.sort()
    ancestor_readme_files = ancestor_metadata_dict.get('readme_files', [])
    ancestor_repository_dependencies_dict = ancestor_metadata_dict.get('repository_dependencies', {})
    ancestor_repository_dependencies = ancestor_repository_dependencies_dict.get('repository_dependencies', [])
    ancestor_tool_dependencies = ancestor_metadata_dict.get('tool_dependencies', {})
    ancestor_workflows = ancestor_metadata_dict.get('workflows', [])
    ancestor_data_manager = ancestor_metadata_dict.get('data_manager', {})
    current_datatypes = self.metadata_dict.get('datatypes', [])
    current_tools = self.metadata_dict.get('tools', [])
    current_guids = [tool_dict['guid'] for tool_dict in current_tools]
    current_guids.sort()
    current_readme_files = self.metadata_dict.get('readme_files', [])
    current_repository_dependencies_dict = self.metadata_dict.get('repository_dependencies', {})
    current_repository_dependencies = current_repository_dependencies_dict.get('repository_dependencies', [])
    current_tool_dependencies = self.metadata_dict.get('tool_dependencies', {})
    current_workflows = self.metadata_dict.get('workflows', [])
    current_data_manager = self.metadata_dict.get('data_manager', {})
    no_datatypes = ((not ancestor_datatypes) and (not current_datatypes))
    no_readme_files = ((not ancestor_readme_files) and (not current_readme_files))
    no_repository_dependencies = ((not ancestor_repository_dependencies) and (not current_repository_dependencies))
    no_tool_dependencies = ((not ancestor_tool_dependencies) and (not current_tool_dependencies))
    no_tools = ((not ancestor_guids) and (not current_guids))
    no_workflows = ((not ancestor_workflows) and (not current_workflows))
    no_data_manager = ((not ancestor_data_manager) and (not current_data_manager))
    if (no_datatypes and no_readme_files and no_repository_dependencies and no_tool_dependencies and no_tools and no_workflows and no_data_manager):
        return self.NO_METADATA
    repository_dependency_comparison = self.compare_repository_dependencies(ancestor_repository_dependencies, current_repository_dependencies)
    tool_dependency_comparison = self.compare_tool_dependencies(ancestor_tool_dependencies, current_tool_dependencies)
    workflow_comparison = self.compare_workflows(ancestor_workflows, current_workflows)
    datatype_comparison = self.compare_datatypes(ancestor_datatypes, current_datatypes)
    data_manager_comparison = self.compare_data_manager(ancestor_data_manager, current_data_manager)
    if ((ancestor_guids == current_guids) and (repository_dependency_comparison == self.EQUAL) and (tool_dependency_comparison == self.EQUAL) and (workflow_comparison == self.EQUAL) and (datatype_comparison == self.EQUAL) and (data_manager_comparison == self.EQUAL)):
        return self.EQUAL
    repository_dependency_is_subset = (repository_dependency_comparison in self.SUBSET_VALUES)
    tool_dependency_is_subset = (tool_dependency_comparison in self.SUBSET_VALUES)
    workflow_dependency_is_subset = (workflow_comparison in self.SUBSET_VALUES)
    datatype_is_subset = (datatype_comparison in self.SUBSET_VALUES)
    datamanager_is_subset = (data_manager_comparison in self.SUBSET_VALUES)
    if (repository_dependency_is_subset and tool_dependency_is_subset and workflow_dependency_is_subset and datatype_is_subset and datamanager_is_subset):
        is_subset = True
        for guid in ancestor_guids:
            if (guid not in current_guids):
                is_subset = False
                break
        if is_subset:
            return self.SUBSET
    return self.NOT_EQUAL_AND_NOT_SUBSET
