commit/galaxy-central: greg: Several miscellaneoud fixes for rendering repository contents and dependencies.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/03ec137ca8a3/ changeset: 03ec137ca8a3 user: greg date: 2012-11-30 22:02:54 summary: Several miscellaneoud fixes for rendering repository contents and dependencies. affected #: 6 files diff -r 5328ebe51a0eba8b0e2315f2ce9fedf2c4a02e83 -r 03ec137ca8a3148aa771769e80963b65194b7895 lib/galaxy/util/shed_util_common.py --- a/lib/galaxy/util/shed_util_common.py +++ b/lib/galaxy/util/shed_util_common.py @@ -996,6 +996,40 @@ fh.close() return tmp_filename return None +def get_next_downloadable_changeset_revision( repository, repo, after_changeset_revision ): + """ + Return the installable changeset_revision in the repository changelog after to the changeset to which after_changeset_revision + refers. If there isn't one, return None. + """ + changeset_revisions = get_ordered_downloadable_changeset_revisions( repository, repo ) + if len( changeset_revisions ) == 1: + changeset_revision = changeset_revisions[ 0 ] + if changeset_revision == after_changeset_revision: + return None + found_after_changeset_revision = False + for changeset in repo.changelog: + changeset_revision = str( repo.changectx( changeset ) ) + if found_after_changeset_revision: + if changeset_revision in changeset_revisions: + return changeset_revision + elif not found_after_changeset_revision and changeset_revision == after_changeset_revision: + # We've found the changeset in the changelog for which we need to get the next downloadable changset. + found_after_changeset_revision = True + return None +def get_ordered_downloadable_changeset_revisions( repository, repo ): + """Return an ordered list of changeset_revisions defined by a repository changelog.""" + changeset_tups = [] + for repository_metadata in repository.downloadable_revisions: + changeset_revision = repository_metadata.changeset_revision + ctx = get_changectx_for_changeset( repo, changeset_revision ) + if ctx: + rev = '%04d' % ctx.rev() + else: + rev = '-1' + changeset_tups.append( ( rev, changeset_revision ) ) + sorted_changeset_tups = sorted( changeset_tups ) + sorted_changeset_revisions = [ changeset_tup[ 1 ] for changeset_tup in sorted_changeset_tups ] + return sorted_changeset_revisions def get_parent_id( trans, id, old_id, version, guid, changeset_revisions ): parent_id = None # Compare from most recent to oldest. @@ -1014,6 +1048,27 @@ if parent_id is None: # The tool did not change through all of the changeset revisions. return old_id +def get_previous_downloadable_changset_revision( repository, repo, before_changeset_revision ): + """ + Return the installable changeset_revision in the repository changelog prior to the changeset to which before_changeset_revision + refers. If there isn't one, return the hash value of an empty repository changelog, INITIAL_CHANGELOG_HASH. + """ + changeset_revisions = get_ordered_downloadable_changeset_revisions( repository, repo ) + if len( changeset_revisions ) == 1: + changeset_revision = changeset_revisions[ 0 ] + if changeset_revision == before_changeset_revision: + return 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 INITIAL_CHANGELOG_HASH + else: + previous_changeset_revision = changeset_revision def get_readme_file_names( repository_name ): readme_files = [ 'readme', 'read_me', 'install' ] valid_filenames = [ r for r in readme_files ] @@ -1079,7 +1134,10 @@ # The repository changeset_revision is no longer installable, so see if there's been an update. required_repo_dir = required_repository.repo_path( trans.app ) required_repo = hg.repository( get_configured_ui(), required_repo_dir ) - required_repository_metadata = get_next_downloadable_changeset_revision( required_repository, required_repo, changeset_revision ) + required_changeset_revision = get_next_downloadable_changeset_revision( required_repository, required_repo, changeset_revision ) + required_repository_metadata = get_repository_metadata_by_repository_id_changset_revision( trans, + trans.security.encode_id( required_repository.id ), + required_changeset_revision ) if required_repository_metadata: # The required_repository_metadata changeset_revision is installable. required_metadata = required_repository_metadata.metadata diff -r 5328ebe51a0eba8b0e2315f2ce9fedf2c4a02e83 -r 03ec137ca8a3148aa771769e80963b65194b7895 lib/galaxy/webapps/community/controllers/common.py --- a/lib/galaxy/webapps/community/controllers/common.py +++ b/lib/galaxy/webapps/community/controllers/common.py @@ -270,61 +270,6 @@ fh.close() return tmp_filename return None -def get_next_downloadable_changeset_revision( repository, repo, after_changeset_revision ): - """ - Return the installable changeset_revision in the repository changelog after to the changeset to which after_changeset_revision - refers. If there isn't one, return None. - """ - changeset_revisions = get_ordered_downloadable_changeset_revisions( repository, repo ) - if len( changeset_revisions ) == 1: - changeset_revision = changeset_revisions[ 0 ] - if changeset_revision == after_changeset_revision: - return None - found_after_changeset_revision = False - for changeset in repo.changelog: - changeset_revision = str( repo.changectx( changeset ) ) - if found_after_changeset_revision: - if changeset_revision in downloadable_changeset_revisions: - return changeset_revision - elif not found_after_changeset_revision and changeset_revision == after_changeset_revision: - # We've found the changeset in the changelog for which we need to get the next downloadable changset. - found_after_changeset_revision = True - return None -def get_ordered_downloadable_changeset_revisions( repository, repo ): - """Return an ordered list of changeset_revisions defined by a repository changelog.""" - changeset_tups = [] - for repository_metadata in repository.downloadable_revisions: - changeset_revision = repository_metadata.changeset_revision - ctx = get_changectx_for_changeset( repo, changeset_revision ) - if ctx: - rev = '%04d' % ctx.rev() - else: - rev = '-1' - changeset_tups.append( ( rev, changeset_revision ) ) - sorted_changeset_tups = sorted( changeset_tups ) - sorted_changeset_revisions = [ changeset_tup[ 1 ] for changeset_tup in sorted_changeset_tups ] - return sorted_changeset_revisions -def get_previous_downloadable_changset_revision( repository, repo, before_changeset_revision ): - """ - Return the installable changeset_revision in the repository changelog prior to the changeset to which before_changeset_revision - refers. If there isn't one, return the hash value of an empty repository changelog, INITIAL_CHANGELOG_HASH. - """ - changeset_revisions = get_ordered_downloadable_changeset_revisions( repository, repo ) - if len( changeset_revisions ) == 1: - changeset_revision = changeset_revisions[ 0 ] - if changeset_revision == before_changeset_revision: - return 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 INITIAL_CHANGELOG_HASH - else: - previous_changeset_revision = changeset_revision def get_previous_repository_reviews( trans, repository, changeset_revision ): """Return an ordered dictionary of repository reviews up to and including the received changeset revision.""" repo = hg.repository( get_configured_ui(), repository.repo_path( trans.app ) ) diff -r 5328ebe51a0eba8b0e2315f2ce9fedf2c4a02e83 -r 03ec137ca8a3148aa771769e80963b65194b7895 lib/galaxy/webapps/community/util/container_util.py --- a/lib/galaxy/webapps/community/util/container_util.py +++ b/lib/galaxy/webapps/community/util/container_util.py @@ -1,5 +1,4 @@ import os, logging -from galaxy.web import url_for log = logging.getLogger( __name__ ) @@ -148,21 +147,29 @@ def build_readme_files_folder( folder_id, readme_files_dict, label='Readme files' ): """Return a folder hierarchy containing readme text files.""" if readme_files_dict: + multiple_readme_files = len( readme_files_dict ) > 1 readme_id = 0 folder_id += 1 readme_files_root_folder = Folder( id=folder_id, key='root', label='root' ) - folder_id += 1 - readme_files_folder = Folder( id=folder_id, key='readme_files', label=label ) - readme_files_root_folder.folders.append( readme_files_folder ) + if multiple_readme_files: + folder_id += 1 + readme_files_folder = Folder( id=folder_id, key='readme_files', label=label ) + readme_files_root_folder.folders.append( readme_files_folder ) for readme_file_name, readme_file_text in readme_files_dict.items(): readme_id += 1 readme = ReadMe( id=readme_id, name=readme_file_name, text=readme_file_text ) - folder_id += 1 - folder = Folder( id=folder_id, key=readme.name, label=readme.name ) - folder.readme_files.append( readme ) - readme_files_folder.folders.append( folder ) + if multiple_readme_files: + folder_id += 1 + folder = Folder( id=folder_id, key=readme.name, label=readme.name ) + folder.readme_files.append( readme ) + readme_files_folder.folders.append( folder ) + else: + folder_id += 1 + readme_files_folder = Folder( id=folder_id, key='readme_files', label=readme.name ) + readme_files_folder.readme_files.append( readme ) + readme_files_root_folder.folders.append( readme_files_folder ) else: readme_files_root_folder = None return folder_id, readme_files_root_folder diff -r 5328ebe51a0eba8b0e2315f2ce9fedf2c4a02e83 -r 03ec137ca8a3148aa771769e80963b65194b7895 templates/admin/tool_shed_repository/reselect_tool_panel_section.mako --- a/templates/admin/tool_shed_repository/reselect_tool_panel_section.mako +++ b/templates/admin/tool_shed_repository/reselect_tool_panel_section.mako @@ -15,7 +15,7 @@ %if readme_files_dict: <div class="form-row"><table class="colored" width="100%"> - <th bgcolor="#EBD9B2">Repository README file (may contain important installation or license information)</th> + <th bgcolor="#EBD9B2">Repository README files - may contain important installation or license information</th></table></div> ${render_readme_section( containers_dict )} diff -r 5328ebe51a0eba8b0e2315f2ce9fedf2c4a02e83 -r 03ec137ca8a3148aa771769e80963b65194b7895 templates/admin/tool_shed_repository/select_tool_panel_section.mako --- a/templates/admin/tool_shed_repository/select_tool_panel_section.mako +++ b/templates/admin/tool_shed_repository/select_tool_panel_section.mako @@ -41,7 +41,7 @@ %if readme_files_dict: <div class="form-row"><table class="colored" width="100%"> - <th bgcolor="#EBD9B2">Repository README file (may contain important installation or license information)</th> + <th bgcolor="#EBD9B2">Repository README file - may contain important installation or license information</th></table></div> ${render_readme_section( containers_dict )} diff -r 5328ebe51a0eba8b0e2315f2ce9fedf2c4a02e83 -r 03ec137ca8a3148aa771769e80963b65194b7895 templates/webapps/community/repository/common.mako --- a/templates/webapps/community/repository/common.mako +++ b/templates/webapps/community/repository/common.mako @@ -206,8 +206,6 @@ col_span_str = 'colspan="4"' elif folder.label == 'Repository dependencies': folder_label = "%s<i> - this repository requires installation of these additional repositories</i>" % folder_label - elif folder.key == 'readme_files': - folder_label = "%s<i> - may contain important installation or license information</i>" % folder_label elif folder.invalid_tools: folder_label = "%s<i> - click the tool config file name to see why the tool is invalid</i>" % folder_label elif folder.tool_dependencies: @@ -484,7 +482,7 @@ %> %if readme_files_root_folder: <div class="toolForm"> - <div class="toolFormTitle">Repository README files (may contain important installation or license information)</div> + <div class="toolFormTitle">Repository README files - may contain important installation or license information</div><div class="toolFormBody"><p/><% row_counter = RowCounter() %> Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket