def get_previous_metadata_changeset_revision(repository, repo, before_changeset_revision, downloadable=True):
 changeset_revisions = [revision[1] for revision in 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 hg_util.INITIAL_CHANGELOG_HASH
  else:
   previous_changeset_revision = changeset_revision

def get_previous_metadata_changeset_revision ( repository , repo , before_changeset_revision , downloadable = True ) : changeset_revisions = [ revision [ 1 ] for revision in 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 hg_util . INITIAL_CHANGELOG_HASH else : previous_changeset_revision = changeset_revision
return the changeset_revision in the repository changelog that has associated metadata prior to the changeset to which before_changeset_revision refers .