Exemple #1
0
def get_previous_metadata_changeset_revision(repository,
                                             repo,
                                             before_changeset_revision,
                                             downloadable=True):
    """
    Return the changeset_revision in the repository changelog that has associated metadata prior to
    the changeset to which before_changeset_revision refers.  If there isn't one, return the hash value
    of an empty repository changelog, hg_util.INITIAL_CHANGELOG_HASH.
    """
    changeset_revisions = [
        revision[1]
        for revision in suc.get_metadata_revisions(repository, repo)
    ]
    if len(changeset_revisions) == 1:
        changeset_revision = changeset_revisions[0]
        if changeset_revision == before_changeset_revision:
            return hg_util.INITIAL_CHANGELOG_HASH
        return changeset_revision
    previous_changeset_revision = None
    for changeset_revision in changeset_revisions:
        if changeset_revision == before_changeset_revision:
            if previous_changeset_revision:
                return previous_changeset_revision
            else:
                # Return the hash value of an empty repository changelog - note that this will not be a valid changeset revision.
                return hg_util.INITIAL_CHANGELOG_HASH
        else:
            previous_changeset_revision = changeset_revision
def get_latest_changeset_revision( app, repository, repo ):
    repository_tip = repository.tip( app )
    repository_metadata = suc.get_repository_metadata_by_changeset_revision( app,
                                                                             app.security.encode_id( repository.id ),
                                                                             repository_tip )
    if repository_metadata and repository_metadata.downloadable:
        return repository_tip
    changeset_revisions = [ revision[ 1 ] for revision in suc.get_metadata_revisions( repository, repo ) ]
    if changeset_revisions:
        return changeset_revisions[ -1 ]
    return hg_util.INITIAL_CHANGELOG_HASH
Exemple #3
0
def get_latest_changeset_revision(app, repository, repo):
    repository_tip = repository.tip(app)
    repository_metadata = suc.get_repository_metadata_by_changeset_revision(
        app, app.security.encode_id(repository.id), repository_tip)
    if repository_metadata and repository_metadata.downloadable:
        return repository_tip
    changeset_revisions = [
        revision[1]
        for revision in suc.get_metadata_revisions(repository, repo)
    ]
    if changeset_revisions:
        return changeset_revisions[-1]
    return hg_util.INITIAL_CHANGELOG_HASH
def should_set_do_not_test_flag( app, repository, changeset_revision, testable_revision ):
    """
    The received testable_revision is True if the tool has defined tests and test files are in the repository
    This method returns True if the received repository has multiple downloadable revisions and the received
    changeset_revision is not the most recent downloadable revision and the received testable_revision is False.
    In this case, the received changeset_revision will never be updated with correct data, and re-testing it
    would be redundant.
    """
    if not testable_revision:
        repo = hg_util.get_repo_for_repository( app, repository=repository, repo_path=None, create=False )
        changeset_revisions = [ revision[ 1 ] for revision in suc.get_metadata_revisions( repository, repo ) ]
        if len( changeset_revisions ) > 1:
            latest_downloadable_revision = changeset_revisions[ -1 ]
            if changeset_revision != latest_downloadable_revision:
                return True
    return False
def get_previous_metadata_changeset_revision( repository, repo, before_changeset_revision, downloadable=True ):
    """
    Return the changeset_revision in the repository changelog that has associated metadata prior to
    the changeset to which before_changeset_revision refers.  If there isn't one, return the hash value
    of an empty repository changelog, hg_util.INITIAL_CHANGELOG_HASH.
    """
    changeset_revisions = [ revision[ 1 ] for revision in suc.get_metadata_revisions( repository, repo ) ]
    if len( changeset_revisions ) == 1:
        changeset_revision = changeset_revisions[ 0 ]
        if changeset_revision == before_changeset_revision:
            return hg_util.INITIAL_CHANGELOG_HASH
        return changeset_revision
    previous_changeset_revision = None
    for changeset_revision in changeset_revisions:
        if changeset_revision == before_changeset_revision:
            if previous_changeset_revision:
                return previous_changeset_revision
            else:
                # Return the hash value of an empty repository changelog - note that this will not be a valid changeset revision.
                return hg_util.INITIAL_CHANGELOG_HASH
        else:
            previous_changeset_revision = changeset_revision
Exemple #6
0
 def installable_revisions(self, app, sort_revisions=True):
     return suc.get_metadata_revisions(self,
                                       hg.repository(
                                           ui.ui(), self.repo_path(app)),
                                       sort_revisions=sort_revisions)
Exemple #7
0
 def ordered_installable_revisions( self, app ):
     return [ revision[ 1 ] for revision in suc.get_metadata_revisions( self, hg.repository( ui.ui(), self.repo_path( app ) ), downloadable=True ) ]
Exemple #8
0
 def installable_revisions( self, app ):
     return suc.get_metadata_revisions( self, hg.repository( ui.ui(), self.repo_path( app ) ), sort_revisions=True )