'Return a dictionary of all repositories upon which the contents of self.repository_metadata
record depend.  The dictionary keys are name-spaced values consisting of:
self.tool_shed_url/repository_name/repository_owner/changeset_revision
and the values are lists of repository_dependency tuples consisting of:
( self.tool_shed_url, repository_name, repository_owner, changeset_revision ).
This method ensures that all required repositories to the nth degree are returned.'

def get_repository_dependencies_for_changeset_revision(self):

    current_repository_key = None
    metadata = self.repository_metadata.metadata
    if metadata:
        if ('repository_dependencies' in metadata):
            current_repository_key = self.get_key_for_repository_changeset_revision()
            repository_dependencies_dict = metadata['repository_dependencies']
            if (not self.all_repository_dependencies):
                self.initialize_all_repository_dependencies(current_repository_key, repository_dependencies_dict)
            current_repository_key_rd_dicts = self.populate_repository_dependency_objects_for_processing(current_repository_key, repository_dependencies_dict)
    if current_repository_key:
        if current_repository_key_rd_dicts:
            current_repository_key_rd_dict = current_repository_key_rd_dicts[0]
            if (not self.in_circular_repository_dependencies(current_repository_key_rd_dict)):
                if (current_repository_key in self.all_repository_dependencies):
                    self.handle_current_repository_dependency(current_repository_key)
            elif self.key_rd_dicts_to_be_processed:
                self.handle_next_repository_dependency()
        elif self.key_rd_dicts_to_be_processed:
            self.handle_next_repository_dependency()
    elif self.key_rd_dicts_to_be_processed:
        self.handle_next_repository_dependency()
    self.all_repository_dependencies = self.prune_invalid_repository_dependencies(self.all_repository_dependencies)
    return self.all_repository_dependencies
