def get_version_lineage_for_tool( self, repository_id, repository_metadata, guid ): """ Return the tool version lineage chain in descendant order for the received guid contained in the received repsitory_metadata.tool_versions. This function is called only from the Tool Shed. """ repository = suc.get_repository_by_id( self.app, repository_id ) repo = hg_util.get_repo_for_repository( self.app, repository=repository, repo_path=None, create=False ) # Initialize the tool lineage version_lineage = [ guid ] # Get all ancestor guids of the received guid. current_child_guid = guid for changeset in hg_util.reversed_upper_bounded_changelog( repo, repository_metadata.changeset_revision ): ctx = repo.changectx( changeset ) rm = suc.get_repository_metadata_by_changeset_revision( self.app, repository_id, str( ctx ) ) if rm: parent_guid = rm.tool_versions.get( current_child_guid, None ) if parent_guid: version_lineage.append( parent_guid ) current_child_guid = parent_guid # Get all descendant guids of the received guid. current_parent_guid = guid for changeset in hg_util.reversed_lower_upper_bounded_changelog( repo, repository_metadata.changeset_revision, repository.tip( self.app ) ): ctx = repo.changectx( changeset ) rm = suc.get_repository_metadata_by_changeset_revision( self.app, repository_id, str( ctx ) ) if rm: tool_versions = rm.tool_versions for child_guid, parent_guid in tool_versions.items(): if parent_guid == current_parent_guid: version_lineage.insert( 0, child_guid ) current_parent_guid = child_guid break return version_lineage
def get_version_lineage_for_tool(self, repository_id, repository_metadata, guid): """ Return the tool version lineage chain in descendant order for the received guid contained in the received repsitory_metadata.tool_versions. This function is called only from the Tool Shed. """ repository = repository_util.get_repository_by_id(self.app, repository_id) repo = hg_util.get_repo_for_repository(self.app, repository=repository) # Initialize the tool lineage version_lineage = [guid] # Get all ancestor guids of the received guid. current_child_guid = guid for changeset in hg_util.reversed_upper_bounded_changelog(repo, repository_metadata.changeset_revision): ctx = repo.changectx(changeset) rm = metadata_util.get_repository_metadata_by_changeset_revision(self.app, repository_id, str(ctx)) if rm: parent_guid = rm.tool_versions.get(current_child_guid, None) if parent_guid: version_lineage.append(parent_guid) current_child_guid = parent_guid # Get all descendant guids of the received guid. current_parent_guid = guid for changeset in hg_util.reversed_lower_upper_bounded_changelog(repo, repository_metadata.changeset_revision, repository.tip(self.app)): ctx = repo.changectx(changeset) rm = metadata_util.get_repository_metadata_by_changeset_revision(self.app, repository_id, str(ctx)) if rm: tool_versions = rm.tool_versions for child_guid, parent_guid in tool_versions.items(): if parent_guid == current_parent_guid: version_lineage.insert(0, child_guid) current_parent_guid = child_guid break return version_lineage
def get_updated_changeset_revisions(app, name, owner, changeset_revision): """ Return a string of comma-separated changeset revision hashes for all available updates to the received changeset revision for the repository defined by the received name and owner. """ repository = tool_shed.util.repository_util.get_repository_by_name_and_owner( app, name, owner) repo = hg_util.get_repo_for_repository(app, repository=repository, repo_path=None, create=False) # Get the upper bound changeset revision. upper_bound_changeset_revision = get_next_downloadable_changeset_revision( repository, repo, changeset_revision) # Build the list of changeset revision hashes defining each available update up to, but excluding # upper_bound_changeset_revision. changeset_hashes = [] for changeset in hg_util.reversed_lower_upper_bounded_changelog( repo, changeset_revision, upper_bound_changeset_revision): # Make sure to exclude upper_bound_changeset_revision. if changeset != upper_bound_changeset_revision: changeset_hashes.append(str(repo.changectx(changeset))) if changeset_hashes: changeset_hashes_str = ','.join(changeset_hashes) return changeset_hashes_str return ''
def get_updated_changeset_revisions( app, name, owner, changeset_revision ): """ Return a string of comma-separated changeset revision hashes for all available updates to the received changeset revision for the repository defined by the received name and owner. """ repository = tool_shed.util.repository_util.get_repository_by_name_and_owner( app, name, owner ) repo = hg_util.get_repo_for_repository( app, repository=repository, repo_path=None, create=False ) # Get the upper bound changeset revision. upper_bound_changeset_revision = get_next_downloadable_changeset_revision( repository, repo, changeset_revision ) # Build the list of changeset revision hashes defining each available update up to, but excluding # upper_bound_changeset_revision. changeset_hashes = [] for changeset in hg_util.reversed_lower_upper_bounded_changelog( repo, changeset_revision, upper_bound_changeset_revision ): # Make sure to exclude upper_bound_changeset_revision. if changeset != upper_bound_changeset_revision: changeset_hashes.append( str( repo.changectx( changeset ) ) ) if changeset_hashes: changeset_hashes_str = ','.join( changeset_hashes ) return changeset_hashes_str return ''