1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/e20408b06d65/ Changeset: e20408b06d65 User: greg Date: 2014-04-10 23:11:01 Summary: Add a new tool shed mercurial utility module named hg_util.py and begin to extract hg related utility functions out of the shed_util_common.py module. Enhance the functions that display the mercurial changeset rev and hash string to display one or the other or both. Display only the rev and not the hash string on the prominent grids in the tool shed, but continue to display the hash string on admin grids. Affected #: 27 files diff -r 452af6869205b773d42f6e49197fbbe413947eca -r e20408b06d65f4902017bdca1cbc08bc1ec0fdd1 lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py --- a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py @@ -16,6 +16,7 @@ from tool_shed.util import data_manager_util from tool_shed.util import datatype_util from tool_shed.util import encoding_util +from tool_shed.util import hg_util from tool_shed.util import metadata_util from tool_shed.util import readme_util from tool_shed.util import repository_dependency_util @@ -1851,7 +1852,7 @@ repo_files_dir = os.path.abspath( os.path.join( tool_path, relative_install_dir, name ) ) else: repo_files_dir = os.path.abspath( os.path.join( relative_install_dir, name ) ) - repo = hg.repository( suc.get_configured_ui(), path=repo_files_dir ) + repo = hg.repository( hg_util.get_configured_ui(), path=repo_files_dir ) repository_clone_url = os.path.join( tool_shed_url, 'repos', owner, name ) repository_util.pull_repository( repo, repository_clone_url, latest_ctx_rev ) suc.update_repository( repo, latest_ctx_rev ) diff -r 452af6869205b773d42f6e49197fbbe413947eca -r e20408b06d65f4902017bdca1cbc08bc1ec0fdd1 lib/galaxy/webapps/tool_shed/api/repositories.py --- a/lib/galaxy/webapps/tool_shed/api/repositories.py +++ b/lib/galaxy/webapps/tool_shed/api/repositories.py @@ -13,6 +13,7 @@ import tool_shed.util.shed_util_common as suc from tool_shed.galaxy_install import repository_util from tool_shed.util import encoding_util +from tool_shed.util import hg_util from tool_shed.util import import_util from tool_shed.util import metadata_util from tool_shed.util import repository_maintenance_util @@ -49,7 +50,7 @@ log.debug( error_message ) return [] repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) ordered_installable_revisions = suc.get_ordered_metadata_changeset_revisions( repository, repo, downloadable=True ) return ordered_installable_revisions else: @@ -133,7 +134,7 @@ # The changeset_revision column in the repository_metadata table has been updated with a new # value value, so find the changeset_revision to which we need to update. repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) new_changeset_revision = suc.get_next_downloadable_changeset_revision( repository, repo, changeset_revision ) repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, encoded_repository_id, diff -r 452af6869205b773d42f6e49197fbbe413947eca -r e20408b06d65f4902017bdca1cbc08bc1ec0fdd1 lib/galaxy/webapps/tool_shed/api/repository_revisions.py --- a/lib/galaxy/webapps/tool_shed/api/repository_revisions.py +++ b/lib/galaxy/webapps/tool_shed/api/repository_revisions.py @@ -6,6 +6,7 @@ from galaxy.model.orm import and_, not_, select from galaxy.web.base.controller import BaseAPIController, HTTPBadRequest from tool_shed.util import export_util +from tool_shed.util import hg_util import tool_shed.util.shed_util_common as suc from galaxy import eggs @@ -168,7 +169,7 @@ # The changeset_revision column in the repository_metadata table has been updated with a new # value value, so find the changeset_revision to which we need to update. repo_dir = repository_dependency.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) new_changeset_revision = suc.get_next_downloadable_changeset_revision( repository_dependency, repo, changeset_revision ) diff -r 452af6869205b773d42f6e49197fbbe413947eca -r e20408b06d65f4902017bdca1cbc08bc1ec0fdd1 lib/galaxy/webapps/tool_shed/controllers/repository.py --- a/lib/galaxy/webapps/tool_shed/controllers/repository.py +++ b/lib/galaxy/webapps/tool_shed/controllers/repository.py @@ -19,6 +19,7 @@ from tool_shed.util import container_util from tool_shed.util import encoding_util from tool_shed.util import export_util +from tool_shed.util import hg_util from tool_shed.util import import_util from tool_shed.util import metadata_util from tool_shed.util import readme_util @@ -719,7 +720,7 @@ status = kwd.get( 'status', 'done' ) commit_message = kwd.get( 'commit_message', 'Deleted selected files' ) repository = suc.get_repository_in_tool_shed( trans, id ) - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) + repo = hg.repository( hg_util.get_configured_ui(), repository.repo_path( trans.app ) ) # Update repository files for browsing. suc.update_repository( repo ) changeset_revision = repository.tip( trans.app ) @@ -891,9 +892,9 @@ changeset_revision = kwd.get( 'changeset_revision', None ) repository = suc.get_repository_by_name_and_owner( trans.app, name, owner ) repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) # Default to the current changeset revision. - update_to_ctx = suc.get_changectx_for_changeset( repo, changeset_revision ) + update_to_ctx = hg_util.get_changectx_for_changeset( repo, changeset_revision ) latest_changeset_revision = changeset_revision from_update_manager = kwd.get( 'from_update_manager', False ) if from_update_manager: @@ -937,10 +938,10 @@ update_to_changeset_hash = None for changeset in repo.changelog: changeset_hash = str( repo.changectx( changeset ) ) - ctx = suc.get_changectx_for_changeset( repo, changeset_hash ) + ctx = hg_util.get_changectx_for_changeset( repo, changeset_hash ) if update_to_changeset_hash: if changeset_hash == repository.tip( trans.app ): - update_to_ctx = suc.get_changectx_for_changeset( repo, changeset_hash ) + update_to_ctx = hg_util.get_changectx_for_changeset( repo, changeset_hash ) latest_changeset_revision = changeset_hash break else: @@ -949,7 +950,7 @@ changeset_hash ) if repository_metadata: # We found a RepositoryMetadata record. - update_to_ctx = suc.get_changectx_for_changeset( repo, changeset_hash ) + update_to_ctx = hg_util.get_changectx_for_changeset( repo, changeset_hash ) latest_changeset_revision = changeset_hash break else: @@ -1213,7 +1214,7 @@ else: containers_dict = None export_repository_dependencies_check_box = None - revision_label = suc.get_revision_label( trans, repository, changeset_revision, include_date=True ) + revision_label = hg_util.get_revision_label( trans, repository, changeset_revision, include_date=True ) return trans.fill_template( "/webapps/tool_shed/repository/export_repository.mako", changeset_revision=changeset_revision, containers_dict=containers_dict, @@ -1466,9 +1467,9 @@ has_repository_dependencies_only_if_compiling_contained_td = has_galaxy_utilities_dict[ 'has_repository_dependencies_only_if_compiling_contained_td' ] includes_workflows = has_galaxy_utilities_dict[ 'includes_workflows' ] repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) # Default to the received changeset revision and ctx_rev. - update_to_ctx = suc.get_changectx_for_changeset( repo, changeset_revision ) + update_to_ctx = hg_util.get_changectx_for_changeset( repo, changeset_revision ) ctx_rev = str( update_to_ctx.rev() ) latest_changeset_revision = changeset_revision update_dict = dict( changeset_revision=changeset_revision, @@ -1497,7 +1498,7 @@ has_repository_dependencies = False has_repository_dependencies_only_if_compiling_contained_td = False changeset_hash = str( repo.changectx( changeset ) ) - ctx = suc.get_changectx_for_changeset( repo, changeset_hash ) + ctx = hg_util.get_changectx_for_changeset( repo, changeset_hash ) if update_to_changeset_hash: update_to_repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, trans.security.encode_id( repository.id ), @@ -1515,10 +1516,10 @@ # We found a RepositoryMetadata record. if changeset_hash == repository.tip( trans.app ): # The current ctx is the repository tip, so use it. - update_to_ctx = suc.get_changectx_for_changeset( repo, changeset_hash ) + update_to_ctx = hg_util.get_changectx_for_changeset( repo, changeset_hash ) latest_changeset_revision = changeset_hash else: - update_to_ctx = suc.get_changectx_for_changeset( repo, update_to_changeset_hash ) + update_to_ctx = hg_util.get_changectx_for_changeset( repo, update_to_changeset_hash ) latest_changeset_revision = update_to_changeset_hash break elif not update_to_changeset_hash and changeset_hash == changeset_revision: @@ -1544,8 +1545,8 @@ changeset_revision = kwd[ 'changeset_revision' ] repository = suc.get_repository_by_name_and_owner( trans.app, repository_name, repository_owner ) repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) - ctx = suc.get_changectx_for_changeset( repo, changeset_revision ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) + ctx = hg_util.get_changectx_for_changeset( repo, changeset_revision ) if ctx: return str( ctx.rev() ) return '' @@ -1560,8 +1561,8 @@ def get_file_from_changeset_revision( self, repo_files_dir, changeset_revision, file_name, dir ): """Return file_name from the received changeset_revision of the repository manifest.""" stripped_file_name = suc.strip_path( file_name ) - repo = hg.repository( suc.get_configured_ui(), repo_files_dir ) - ctx = suc.get_changectx_for_changeset( repo, changeset_revision ) + repo = hg.repository( hg_util.get_configured_ui(), repo_files_dir ) + ctx = hg_util.get_changectx_for_changeset( repo, changeset_revision ) named_tmp_file = suc.get_named_tmpfile_from_ctx( ctx, file_name, dir ) return named_tmp_file @@ -1604,7 +1605,7 @@ trans.model.Repository.table.c.user_id == user.id ) ): repository = repository_metadata.repository repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) latest_downloadable_changeset_revsion = suc.get_latest_downloadable_changeset_revision( trans, repository, repo ) if repository_metadata.changeset_revision == latest_downloadable_changeset_revsion: # We'll display only the test run for the latest installable revision in the rss feed. @@ -1672,7 +1673,7 @@ if repository_name is not None and repository_owner is not None: repository = suc.get_repository_by_name_and_owner( trans.app, repository_name, repository_owner ) if repository: - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) + repo = hg.repository( hg_util.get_configured_ui(), repository.repo_path( trans.app ) ) return suc.get_latest_downloadable_changeset_revision( trans, repository, repo ) return suc.INITIAL_CHANGELOG_HASH @@ -1855,7 +1856,7 @@ changeset_revision = kwd[ 'changeset_revision' ] repository = suc.get_repository_by_name_and_owner( trans.app, name, owner ) repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) tool_version_dicts = [] for changeset in repo.changelog: current_changeset_revision = str( repo.changectx( changeset ) ) @@ -1880,7 +1881,7 @@ repository_id = trans.security.encode_id( repository.id ) repository_clone_url = common_util.generate_clone_url_for_repository_in_tool_shed( trans, repository ) repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, repository_id, changeset_revision ) if not repository_metadata: # The received changeset_revision is no longer associated with metadata, so get the next changeset_revision in the repository @@ -1889,7 +1890,7 @@ repo, after_changeset_revision=changeset_revision ) repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, repository_id, changeset_revision ) - ctx = suc.get_changectx_for_changeset( repo, changeset_revision ) + ctx = hg_util.get_changectx_for_changeset( repo, changeset_revision ) repo_info_dict = repository_util.create_repo_info_dict( trans=trans, repository_clone_url=repository_clone_url, changeset_revision=changeset_revision, @@ -2165,7 +2166,7 @@ repository = suc.get_repository_in_tool_shed( trans, id ) repository_type = kwd.get( 'repository_type', str( repository.type ) ) repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) repo_name = kwd.get( 'repo_name', repository.name ) changeset_revision = kwd.get( 'changeset_revision', repository.tip( trans.app ) ) description = kwd.get( 'description', repository.description ) @@ -2317,7 +2318,7 @@ selected_value=changeset_revision, add_id_to_name=False, downloadable=False ) - revision_label = suc.get_revision_label( trans, repository, repository.tip( trans.app ), include_date=False ) + revision_label = hg_util.get_revision_label( trans, repository, repository.tip( trans.app ), include_date=False ) repository_metadata = None metadata = None is_malicious = False @@ -2326,7 +2327,7 @@ if changeset_revision != suc.INITIAL_CHANGELOG_HASH: repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, id, changeset_revision ) if repository_metadata: - revision_label = suc.get_revision_label( trans, repository, changeset_revision, include_date=False ) + revision_label = hg_util.get_revision_label( trans, repository, changeset_revision, include_date=False ) metadata = repository_metadata.metadata is_malicious = repository_metadata.malicious else: @@ -2337,7 +2338,7 @@ if previous_changeset_revision != suc.INITIAL_CHANGELOG_HASH: repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, id, previous_changeset_revision ) if repository_metadata: - revision_label = suc.get_revision_label( trans, repository, previous_changeset_revision, include_date=False ) + revision_label = hg_util.get_revision_label( trans, repository, previous_changeset_revision, include_date=False ) metadata = repository_metadata.metadata is_malicious = repository_metadata.malicious changeset_revision = previous_changeset_revision @@ -2443,7 +2444,7 @@ # There is no repository_metadata defined for the changeset_revision, so see if it was defined # in a previous changeset in the changelog. repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) previous_changeset_revision = \ suc.get_previous_metadata_changeset_revision( repository, repo, @@ -2520,7 +2521,7 @@ changeset_revision = kwd.get( 'changeset_revision', None ) repository = suc.get_repository_by_name_and_owner( trans.app, name, owner ) repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) # Get the next installable changeset_revision beyond the received changeset_revision. changeset_revision = suc.get_next_downloadable_changeset_revision( repository, repo, changeset_revision ) if changeset_revision: @@ -2540,7 +2541,7 @@ status = kwd.get( 'status', 'done' ) repository = suc.get_repository_in_tool_shed( trans, repository_id ) repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) changeset_revision = kwd.get( 'changeset_revision', repository.tip( trans.app ) ) repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, repository_id, changeset_revision ) if repository_metadata: @@ -2577,7 +2578,7 @@ repository_metadata_id = None metadata = None repository_dependencies = None - revision_label = suc.get_revision_label( trans, repository, changeset_revision, include_date=True ) + revision_label = hg_util.get_revision_label( trans, repository, changeset_revision, include_date=True ) changeset_revision_select_field = grids_util.build_changeset_revision_select_field( trans, repository, selected_value=changeset_revision, @@ -2607,7 +2608,7 @@ changeset_revision = kwd.get( 'changeset_revision', None ) repository = suc.get_repository_by_name_and_owner( trans.app, name, owner ) repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) # Get the lower bound changeset revision. lower_bound_changeset_revision = suc.get_previous_metadata_changeset_revision( repository, repo, changeset_revision, downloadable=True ) # Build the list of changeset revision hashes. @@ -2633,7 +2634,7 @@ status='error' ) ) repository = suc.get_repository_in_tool_shed( trans, id ) changeset_revision = repository.tip( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) + repo = hg.repository( hg_util.get_configured_ui(), repository.repo_path( trans.app ) ) if repository.user == trans.user: return trans.response.send_redirect( web.url_for( controller='repository', action='browse_repositories', @@ -2651,7 +2652,7 @@ changeset_revision, metadata_only=True ) repository_type_select_field = rt_util.build_repository_type_select_field( trans, repository=repository ) - revision_label = suc.get_revision_label( trans, repository, changeset_revision, include_date=True ) + revision_label = hg_util.get_revision_label( trans, repository, changeset_revision, include_date=True ) return trans.fill_template( '/webapps/tool_shed/repository/rate_repository.mako', repository=repository, metadata=metadata, @@ -2702,7 +2703,7 @@ commit_message = kwd.get( 'commit_message', 'Deleted selected files' ) repository = suc.get_repository_in_tool_shed( trans, id ) repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) selected_files_to_delete = kwd.get( 'selected_files_to_delete', '' ) if kwd.get( 'select_files_to_delete_button', False ): if selected_files_to_delete: @@ -2742,7 +2743,7 @@ # Update the repository files for browsing. suc.update_repository( repo ) # Get the new repository tip. - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) if tip == repository.tip( trans.app ): message += 'No changes to repository. ' kwd[ 'message' ] = message @@ -2931,7 +2932,7 @@ if not repository_metadata: # Get updates to the received changeset_revision if any exist. repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) upper_bound_changeset_revision = suc.get_next_downloadable_changeset_revision( repository, repo, changeset_revision ) if upper_bound_changeset_revision: changeset_revision = upper_bound_changeset_revision @@ -2971,7 +2972,7 @@ trans.security.encode_id( repository.id ), changeset_revision ) repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) tool_shed_status_dict = {} # Handle repository deprecation. tool_shed_status_dict[ 'repository_deprecated' ] = str( repository.deprecated ) @@ -3063,7 +3064,7 @@ message = kwd.get( 'message', '' ) status = kwd.get( 'status', 'done' ) repository = suc.get_repository_in_tool_shed( trans, id ) - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) + repo = hg.repository( hg_util.get_configured_ui(), repository.repo_path( trans.app ) ) changesets = [] for changeset in repo.changelog: ctx = repo.changectx( changeset ) @@ -3074,7 +3075,7 @@ change_dict = { 'ctx' : ctx, 'rev' : str( ctx.rev() ), 'date' : date, - 'display_date' : suc.get_readable_ctx_date( ctx ), + 'display_date' : hg_util.get_readable_ctx_date( ctx ), 'description' : ctx.description(), 'files' : ctx.files(), 'user' : ctx.user(), @@ -3098,8 +3099,8 @@ message = kwd.get( 'message', '' ) status = kwd.get( 'status', 'done' ) repository = suc.get_repository_in_tool_shed( trans, id ) - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) - ctx = suc.get_changectx_for_changeset( repo, ctx_str ) + repo = hg.repository( hg_util.get_configured_ui(), repository.repo_path( trans.app ) ) + ctx = hg_util.get_changectx_for_changeset( repo, ctx_str ) if ctx is None: message = "Repository does not include changeset revision '%s'." % str( ctx_str ) status = 'error' @@ -3129,7 +3130,7 @@ metadata = metadata_util.get_repository_metadata_by_repository_id_changeset_revision( trans, id, ctx_str, metadata_only=True ) # For rendering the prev button. if ctx_parent: - ctx_parent_date = suc.get_readable_ctx_date( ctx_parent ) + ctx_parent_date = hg_util.get_readable_ctx_date( ctx_parent ) ctx_parent_rev = ctx_parent.rev() if ctx_parent_rev < 0: prev = None @@ -3138,7 +3139,7 @@ else: prev = None if ctx_child: - ctx_child_date = suc.get_readable_ctx_date( ctx_child ) + ctx_child_date = hg_util.get_readable_ctx_date( ctx_child ) ctx_child_rev = ctx_child.rev() next = "<b>%s:%s</b><i>(%s)</i>" % ( ctx_child_rev, ctx_child, ctx_child_date ) else: @@ -3187,7 +3188,7 @@ message = kwd.get( 'message', '' ) status = kwd.get( 'status', 'done' ) repository = suc.get_repository_in_tool_shed( trans, id ) - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) + repo = hg.repository( hg_util.get_configured_ui(), repository.repo_path( trans.app ) ) avg_rating, num_ratings = self.get_ave_item_rating_data( trans.sa_session, repository, webapp_model=trans.model ) changeset_revision = kwd.get( 'changeset_revision', repository.tip( trans.app ) ) display_reviews = kwd.get( 'display_reviews', False ) @@ -3221,7 +3222,7 @@ selected_value=changeset_revision, add_id_to_name=False, downloadable=False ) - revision_label = suc.get_revision_label( trans, repository, changeset_revision, include_date=False ) + revision_label = hg_util.get_revision_label( trans, repository, changeset_revision, include_date=False ) repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, id, changeset_revision ) if repository_metadata: metadata = repository_metadata.metadata @@ -3277,13 +3278,13 @@ render_repository_actions_for = kwd.get( 'render_repository_actions_for', 'tool_shed' ) repository = suc.get_repository_in_tool_shed( trans, repository_id ) repo_files_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_files_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_files_dir ) tool_metadata_dict = {} tool_lineage = [] tool = None guid = None original_tool_data_path = trans.app.config.tool_data_path - revision_label = suc.get_revision_label( trans, repository, changeset_revision, include_date=False ) + revision_label = hg_util.get_revision_label( trans, repository, changeset_revision, include_date=False ) repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, repository_id, changeset_revision ) if repository_metadata: repository_metadata_id = trans.security.encode_id( repository_metadata.id ) diff -r 452af6869205b773d42f6e49197fbbe413947eca -r e20408b06d65f4902017bdca1cbc08bc1ec0fdd1 lib/galaxy/webapps/tool_shed/controllers/repository_review.py --- a/lib/galaxy/webapps/tool_shed/controllers/repository_review.py +++ b/lib/galaxy/webapps/tool_shed/controllers/repository_review.py @@ -7,6 +7,7 @@ from galaxy.webapps.tool_shed.util import ratings_util from tool_shed.util.container_util import STRSEP import tool_shed.util.shed_util_common as suc +from tool_shed.util import hg_util from tool_shed.util import review_util from galaxy.util.odict import odict import tool_shed.grids.repository_review_grids as repository_review_grids @@ -72,8 +73,8 @@ status = kwd.get( 'status', 'done' ) review = review_util.get_review( trans, kwd[ 'id' ] ) repository = review.repository - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) - rev, changeset_revision_label = suc.get_rev_label_from_changeset_revision( repo, review.changeset_revision ) + repo = hg.repository( hg_util.get_configured_ui(), repository.repo_path( trans.app ) ) + rev, changeset_revision_label = hg_util.get_rev_label_from_changeset_revision( repo, review.changeset_revision ) return trans.fill_template( '/webapps/tool_shed/repository_review/browse_review.mako', repository=repository, changeset_revision_label=changeset_revision_label, @@ -232,7 +233,7 @@ for component in review_util.get_components( trans ): components_dict[ component.name ] = dict( component=component, component_review=None ) repository = review.repository - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) + repo = hg.repository( hg_util.get_configured_ui(), repository.repo_path( trans.app ) ) for component_review in review.component_reviews: if component_review and component_review.component: component_name = component_review.component.name @@ -337,7 +338,7 @@ name='revision_approved', selected_value=selected_value, for_component=False ) - rev, changeset_revision_label = suc.get_rev_label_from_changeset_revision( repo, review.changeset_revision ) + rev, changeset_revision_label = hg_util.get_rev_label_from_changeset_revision( repo, review.changeset_revision ) return trans.fill_template( '/webapps/tool_shed/repository_review/edit_review.mako', repository=repository, review=review, @@ -470,7 +471,7 @@ if repository_id: repository = suc.get_repository_in_tool_shed( trans, repository_id ) repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) metadata_revision_hashes = [ metadata_revision.changeset_revision for metadata_revision in repository.metadata_revisions ] reviewed_revision_hashes = [ review.changeset_revision for review in repository.reviews ] reviews_dict = odict() @@ -478,7 +479,7 @@ ctx = repo.changectx( changeset ) changeset_revision = str( ctx ) if changeset_revision in metadata_revision_hashes or changeset_revision in reviewed_revision_hashes: - rev, changeset_revision_label = suc.get_rev_label_from_changeset_revision( repo, changeset_revision ) + rev, changeset_revision_label = hg_util.get_rev_label_from_changeset_revision( repo, changeset_revision ) if changeset_revision in reviewed_revision_hashes: # Find the review for this changeset_revision repository_reviews = review_util.get_reviews_by_repository_id_changeset_revision( trans, repository_id, changeset_revision ) @@ -517,9 +518,9 @@ changeset_revision = kwd.get( 'changeset_revision', None ) repository = suc.get_repository_in_tool_shed( trans, repository_id ) repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) installable = changeset_revision in [ metadata_revision.changeset_revision for metadata_revision in repository.metadata_revisions ] - rev, changeset_revision_label = suc.get_rev_label_from_changeset_revision( repo, changeset_revision ) + rev, changeset_revision_label = hg_util.get_rev_label_from_changeset_revision( repo, changeset_revision ) reviews = review_util.get_reviews_by_repository_id_changeset_revision( trans, repository_id, changeset_revision ) return trans.fill_template( '/webapps/tool_shed/repository_review/reviews_of_changeset_revision.mako', repository=repository, @@ -582,9 +583,9 @@ status = kwd.get( 'status', 'done' ) repository = suc.get_repository_in_tool_shed( trans, kwd[ 'id' ] ) changeset_revision = kwd.get( 'changeset_revision', None ) - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) + repo = hg.repository( hg_util.get_configured_ui(), repository.repo_path( trans.app ) ) previous_reviews_dict = review_util.get_previous_repository_reviews( trans, repository, changeset_revision ) - rev, changeset_revision_label = suc.get_rev_label_from_changeset_revision( repo, changeset_revision ) + rev, changeset_revision_label = hg_util.get_rev_label_from_changeset_revision( repo, changeset_revision ) return trans.fill_template( '/webapps/tool_shed/repository_review/select_previous_review.mako', repository=repository, changeset_revision=changeset_revision, diff -r 452af6869205b773d42f6e49197fbbe413947eca -r e20408b06d65f4902017bdca1cbc08bc1ec0fdd1 lib/galaxy/webapps/tool_shed/controllers/upload.py --- a/lib/galaxy/webapps/tool_shed/controllers/upload.py +++ b/lib/galaxy/webapps/tool_shed/controllers/upload.py @@ -11,6 +11,7 @@ import tool_shed.repository_types.util as rt_util import tool_shed.util.shed_util_common as suc from tool_shed.util import commit_util +from tool_shed.util import hg_util from tool_shed.util import metadata_util from tool_shed.util import repository_dependency_util from tool_shed.util import tool_dependency_util @@ -39,7 +40,7 @@ repository_id = kwd.get( 'repository_id', '' ) repository = suc.get_repository_in_tool_shed( trans, repository_id ) repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) uncompress_file = util.string_as_bool( kwd.get( 'uncompress_file', 'true' ) ) remove_repo_files_not_in_tar = util.string_as_bool( kwd.get( 'remove_repo_files_not_in_tar', 'true' ) ) uploaded_file = None @@ -63,7 +64,7 @@ repo_url = 'http%s' % url[ len( 'hg' ): ] repo_url = repo_url.encode( 'ascii', 'replace' ) try: - commands.clone( suc.get_configured_ui(), repo_url, uploaded_directory ) + commands.clone( hg_util.get_configured_ui(), repo_url, uploaded_directory ) except Exception, e: message = 'Error uploading via mercurial clone: %s' % suc.to_html_string( str( e ) ) status = 'error' @@ -323,7 +324,7 @@ def upload_directory( self, trans, repository, uploaded_directory, upload_point, remove_repo_files_not_in_tar, commit_message, new_repo_alert ): repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) undesirable_dirs_removed = 0 undesirable_files_removed = 0 if upload_point is not None: @@ -387,7 +388,7 @@ def upload_tar( self, trans, repository, tar, uploaded_file, upload_point, remove_repo_files_not_in_tar, commit_message, new_repo_alert ): # Upload a tar archive of files. repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) undesirable_dirs_removed = 0 undesirable_files_removed = 0 ok, message = commit_util.check_archive( repository, tar ) diff -r 452af6869205b773d42f6e49197fbbe413947eca -r e20408b06d65f4902017bdca1cbc08bc1ec0fdd1 lib/tool_shed/galaxy_install/repository_util.py --- a/lib/tool_shed/galaxy_install/repository_util.py +++ b/lib/tool_shed/galaxy_install/repository_util.py @@ -15,6 +15,7 @@ from tool_shed.util import data_manager_util from tool_shed.util import datatype_util from tool_shed.util import encoding_util +from tool_shed.util import hg_util from tool_shed.util import repository_dependency_util from tool_shed.util import metadata_util from tool_shed.util import tool_dependency_util @@ -186,7 +187,7 @@ def get_repo_info_dict( trans, repository_id, changeset_revision ): repository = suc.get_repository_in_tool_shed( trans, repository_id ) repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) repository_clone_url = common_util.generate_clone_url_for_repository_in_tool_shed( trans, repository ) repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, repository_id, @@ -225,7 +226,7 @@ has_repository_dependencies_only_if_compiling_contained_td = False includes_tool_dependencies = False includes_tools_for_display_in_tool_panel = False - ctx = suc.get_changectx_for_changeset( repo, changeset_revision ) + ctx = hg_util.get_changectx_for_changeset( repo, changeset_revision ) repo_info_dict = create_repo_info_dict( trans=trans, repository_clone_url=repository_clone_url, changeset_revision=changeset_revision, @@ -574,7 +575,7 @@ current_changeset_revision = changeset_revision_dict.get( 'changeset_revision', None ) current_ctx_rev = changeset_revision_dict.get( 'ctx_rev', None ) if current_ctx_rev != ctx_rev: - repo = hg.repository( suc.get_configured_ui(), path=os.path.abspath( install_dir ) ) + repo = hg.repository( hg_util.get_configured_ui(), path=os.path.abspath( install_dir ) ) pull_repository( repo, repository_clone_url, current_changeset_revision ) suc.update_repository( repo, ctx_rev=current_ctx_rev ) handle_repository_contents( trans, @@ -804,7 +805,7 @@ def pull_repository( repo, repository_clone_url, ctx_rev ): """Pull changes from a remote repository to a local one.""" - commands.pull( suc.get_configured_ui(), repo, source=repository_clone_url, rev=[ ctx_rev ] ) + commands.pull( hg_util.get_configured_ui(), repo, source=repository_clone_url, rev=[ ctx_rev ] ) def repair_tool_shed_repository( trans, repository, repo_info_dict ): diff -r 452af6869205b773d42f6e49197fbbe413947eca -r e20408b06d65f4902017bdca1cbc08bc1ec0fdd1 lib/tool_shed/grids/admin_grids.py --- a/lib/tool_shed/grids/admin_grids.py +++ b/lib/tool_shed/grids/admin_grids.py @@ -5,6 +5,7 @@ from galaxy.webapps.tool_shed import model from galaxy.model.orm import and_ import tool_shed.util.shed_util_common as suc +from tool_shed.util import hg_util from tool_shed.grids.repository_grids import CategoryGrid from tool_shed.grids.repository_grids import RepositoryGrid @@ -425,9 +426,11 @@ def get_value( self, trans, grid, repository_metadata ): repository = repository_metadata.repository - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) - ctx = suc.get_changectx_for_changeset( repo, repository_metadata.changeset_revision ) - return suc.get_revision_label( trans, repository, repository_metadata.changeset_revision, include_date=True ) + return hg_util.get_revision_label( trans, + repository, + repository_metadata.changeset_revision, + include_date=True, + include_hash=True ) class ToolsColumn( grids.TextColumn ): diff -r 452af6869205b773d42f6e49197fbbe413947eca -r e20408b06d65f4902017bdca1cbc08bc1ec0fdd1 lib/tool_shed/grids/repository_grids.py --- a/lib/tool_shed/grids/repository_grids.py +++ b/lib/tool_shed/grids/repository_grids.py @@ -6,6 +6,7 @@ from galaxy.model.orm import or_ from galaxy.util import json from galaxy.util import listify +from tool_shed.util import hg_util import tool_shed.util.shed_util_common as suc import tool_shed.grids.util as grids_util import tool_shed.repository_types.util as rt_util @@ -116,7 +117,7 @@ def get_value( self, trans, grid, repository ): """Display the current repository heads.""" repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) heads = suc.get_repository_heads( repo ) multiple_heads = len( heads ) > 1 if multiple_heads: @@ -124,7 +125,7 @@ else: heads_str = '' for ctx in heads: - heads_str += '%s<br/>' % suc.get_revision_label_from_ctx( ctx, include_date=True ) + heads_str += '%s<br/>' % hg_util.get_revision_label_from_ctx( ctx, include_date=True ) heads_str.rstrip( '<br/>' ) if multiple_heads: heads_str += '</font>' @@ -1338,7 +1339,7 @@ def get_value( self, trans, grid, repository_metadata ): repository = repository_metadata.repository changeset_revision = repository_metadata.changeset_revision - changeset_revision_label = suc.get_revision_label( trans, repository, changeset_revision, include_date=True ) + changeset_revision_label = hg_util.get_revision_label( trans, repository, changeset_revision, include_date=True ) return changeset_revision_label @@ -1482,7 +1483,7 @@ changeset_revision ) if not required_repository_metadata: repo_dir = required_repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) updated_changeset_revision = suc.get_next_downloadable_changeset_revision( required_repository, repo, changeset_revision ) required_repository_metadata = metadata_util.get_repository_metadata_by_repository_id_changeset_revision( trans, required_repository_id, @@ -2029,7 +2030,7 @@ tool_dependency_definition. """ encoded_repository_id = trans.security.encode_id( repository.id ) - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) + repo = hg.repository( hg_util.get_configured_ui(), repository.repo_path( trans.app ) ) tip_ctx = str( repo.changectx( repo.changelog.tip() ) ) repository_metadata = None try: @@ -2077,7 +2078,7 @@ tool_dependency_definition. """ encoded_repository_id = trans.security.encode_id( repository.id ) - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) + repo = hg.repository( hg_util.get_configured_ui(), repository.repo_path( trans.app ) ) tip_ctx = str( repo.changectx( repo.changelog.tip() ) ) try: repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, encoded_repository_id, tip_ctx ) diff -r 452af6869205b773d42f6e49197fbbe413947eca -r e20408b06d65f4902017bdca1cbc08bc1ec0fdd1 lib/tool_shed/grids/repository_review_grids.py --- a/lib/tool_shed/grids/repository_review_grids.py +++ b/lib/tool_shed/grids/repository_review_grids.py @@ -6,6 +6,7 @@ from galaxy.model.orm import or_ from tool_shed.grids.repository_grids import RepositoryGrid import tool_shed.util.shed_util_common as suc +from tool_shed.util import hg_util from tool_shed.util import metadata_util from galaxy import eggs @@ -66,10 +67,10 @@ # Restrict to revisions that have been reviewed. if repository.reviews: rval = '' - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) + repo = hg.repository( hg_util.get_configured_ui(), repository.repo_path( trans.app ) ) for review in repository.reviews: changeset_revision = review.changeset_revision - rev, label = suc.get_rev_label_from_changeset_revision( repo, changeset_revision ) + rev, label = hg_util.get_rev_label_from_changeset_revision( repo, changeset_revision ) rval += '<a href="manage_repository_reviews_of_revision?id=%s&changeset_revision=%s">%s</a><br/>' % \ ( trans.security.encode_id( repository.id ), changeset_revision, label ) return rval @@ -85,9 +86,11 @@ rval = '' for repository_metadata in repository_metadata_revisions: rev, label, changeset_revision = \ - metadata_util.get_rev_label_changeset_revision_from_repository_metadata( trans, - repository_metadata, - repository=repository ) + hg_util.get_rev_label_changeset_revision_from_repository_metadata( trans, + repository_metadata, + repository=repository, + include_date=True, + include_hash=False ) rval += '<a href="manage_repository_reviews_of_revision?id=%s&changeset_revision=%s">%s</a><br/>' % \ ( trans.security.encode_id( repository.id ), changeset_revision, label ) return rval @@ -308,7 +311,11 @@ rval += 'edit_review' else: rval +='browse_review' - revision_label = suc.get_revision_label( trans, review.repository, review.changeset_revision, include_date=True ) + revision_label = hg_util.get_revision_label( trans, + review.repository, + review.changeset_revision, + include_date=True, + include_hash=False ) rval += '?id=%s">%s</a>' % ( encoded_review_id, revision_label ) return rval diff -r 452af6869205b773d42f6e49197fbbe413947eca -r e20408b06d65f4902017bdca1cbc08bc1ec0fdd1 lib/tool_shed/grids/util.py --- a/lib/tool_shed/grids/util.py +++ b/lib/tool_shed/grids/util.py @@ -1,7 +1,7 @@ import logging import os import tool_shed.util.shed_util_common as suc -import tool_shed.util.metadata_util as metadata_util +from tool_shed.util import hg_util from galaxy.web.form_builder import SelectField from galaxy.util.bunch import Bunch @@ -96,9 +96,11 @@ repository_metadata_revisions = repository.metadata_revisions for repository_metadata in repository_metadata_revisions: rev, label, changeset_revision = \ - metadata_util.get_rev_label_changeset_revision_from_repository_metadata( trans, - repository_metadata, - repository=repository ) + hg_util.get_rev_label_changeset_revision_from_repository_metadata( trans, + repository_metadata, + repository=repository, + include_date=True, + include_hash=False ) changeset_tups.append( ( rev, label, changeset_revision ) ) refresh_on_change_values.append( changeset_revision ) # Sort options by the revision label. Even though the downloadable_revisions query sorts by update_time, diff -r 452af6869205b773d42f6e49197fbbe413947eca -r e20408b06d65f4902017bdca1cbc08bc1ec0fdd1 lib/tool_shed/scripts/check_repositories_for_functional_tests.py --- a/lib/tool_shed/scripts/check_repositories_for_functional_tests.py +++ b/lib/tool_shed/scripts/check_repositories_for_functional_tests.py @@ -14,6 +14,7 @@ import ConfigParser import galaxy.webapps.tool_shed.config as tool_shed_config +from tool_shed.util import hg_util import tool_shed.util.shed_util_common as suc import logging import shutil @@ -109,7 +110,7 @@ if tool_dicts is not None: # Clone the repository up to the changeset revision we're checking. repo_dir = repository.repo_path( app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) work_dir = tempfile.mkdtemp( prefix="tmp-toolshed-cafr" ) cloned_ok, error_message = suc.clone_repository( repo_dir, work_dir, changeset_revision ) if cloned_ok: @@ -368,7 +369,7 @@ """ if not testable_revision: repo_dir = repository.repo_path( app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) changeset_revisions = suc.get_ordered_metadata_changeset_revisions( repository, repo, downloadable=True ) if len( changeset_revisions ) > 1: latest_downloadable_revision = changeset_revisions[ -1 ] diff -r 452af6869205b773d42f6e49197fbbe413947eca -r e20408b06d65f4902017bdca1cbc08bc1ec0fdd1 lib/tool_shed/util/commit_util.py --- a/lib/tool_shed/util/commit_util.py +++ b/lib/tool_shed/util/commit_util.py @@ -12,6 +12,7 @@ from galaxy.util.odict import odict from galaxy.web import url_for import tool_shed.util.shed_util_common as suc +from tool_shed.util import hg_util from tool_shed.util import tool_util from tool_shed.util import xml_util import tool_shed.repository_types.util as rt_util @@ -156,7 +157,7 @@ def handle_directory_changes( trans, repository, full_path, filenames_in_archive, remove_repo_files_not_in_tar, new_repo_alert, commit_message, undesirable_dirs_removed, undesirable_files_removed ): repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) content_alert_str = '' files_to_remove = [] filenames_in_archive = [ os.path.join( full_path, name ) for name in filenames_in_archive ] @@ -342,7 +343,7 @@ repository = suc.get_repository_by_name_and_owner( trans.app, name, owner ) if repository: repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) lastest_installable_changeset_revision = suc.get_latest_downloadable_changeset_revision( trans, repository, repo ) if lastest_installable_changeset_revision != suc.INITIAL_CHANGELOG_HASH: elem.attrib[ 'changeset_revision' ] = lastest_installable_changeset_revision diff -r 452af6869205b773d42f6e49197fbbe413947eca -r e20408b06d65f4902017bdca1cbc08bc1ec0fdd1 lib/tool_shed/util/export_util.py --- a/lib/tool_shed/util/export_util.py +++ b/lib/tool_shed/util/export_util.py @@ -14,6 +14,7 @@ from tool_shed.util import common_install_util from tool_shed.util import common_util from tool_shed.util import encoding_util +from tool_shed.util import hg_util from tool_shed.util import repository_dependency_util from tool_shed.util import xml_util @@ -37,7 +38,7 @@ def archive_repository_revision( trans, ui, repository, archive_dir, changeset_revision ): '''Create an un-versioned archive of a repository.''' - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) + repo = hg.repository( hg_util.get_configured_ui(), repository.repo_path( trans.app ) ) options_dict = suc.get_mercurial_default_options_dict( 'archive' ) options_dict[ 'rev' ] = changeset_revision error_message = '' @@ -233,8 +234,8 @@ key_rd_dicts_to_be_processed=None, all_repository_dependencies=None, handled_key_rd_dicts=None ) - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) - ctx = suc.get_changectx_for_changeset( repo, changeset_revision ) + repo = hg.repository( hg_util.get_configured_ui(), repository.repo_path( trans.app ) ) + ctx = hg_util.get_changectx_for_changeset( repo, changeset_revision ) repo_info_dict = {} # Cast unicode to string. repo_info_dict[ str( repository.name ) ] = ( str( repository.description ), diff -r 452af6869205b773d42f6e49197fbbe413947eca -r e20408b06d65f4902017bdca1cbc08bc1ec0fdd1 lib/tool_shed/util/hg_util.py --- /dev/null +++ b/lib/tool_shed/util/hg_util.py @@ -0,0 +1,108 @@ +import logging +from datetime import datetime +from time import gmtime +from time import strftime + +from galaxy import eggs +eggs.require( 'mercurial' ) + +from mercurial import cmdutil +from mercurial import commands +from mercurial import hg +from mercurial import ui + +def get_changectx_for_changeset( repo, changeset_revision, **kwd ): + """Retrieve a specified changectx from a repository.""" + for changeset in repo.changelog: + ctx = repo.changectx( changeset ) + if str( ctx ) == changeset_revision: + return ctx + return None + +def get_configured_ui(): + """Configure any desired ui settings.""" + _ui = ui.ui() + # The following will suppress all messages. This is + # the same as adding the following setting to the repo + # hgrc file' [ui] section: + # quiet = True + _ui.setconfig( 'ui', 'quiet', True ) + return _ui + +def get_readable_ctx_date( ctx ): + """Convert the date of the changeset (the received ctx) to a human-readable date.""" + t, tz = ctx.date() + date = datetime( *gmtime( float( t ) - tz )[ :6 ] ) + ctx_date = date.strftime( "%Y-%m-%d" ) + return ctx_date + +def get_revision_label( trans, repository, changeset_revision, include_date=True, include_hash=True ): + """ + Return a string consisting of the human read-able changeset rev and the changeset revision string + which includes the revision date if the receive include_date is True. + """ + repo = hg.repository( get_configured_ui(), repository.repo_path( trans.app ) ) + ctx = get_changectx_for_changeset( repo, changeset_revision ) + if ctx: + return get_revision_label_from_ctx( ctx, include_date=include_date, include_hash=include_hash ) + else: + if include_hash: + return "-1:%s" % changeset_revision + else: + return "-1" + +def get_rev_label_changeset_revision_from_repository_metadata( trans, repository_metadata, repository=None, + include_date=True, include_hash=True ): + if repository is None: + repository = repository_metadata.repository + repo = hg.repository( get_configured_ui(), repository.repo_path( trans.app ) ) + changeset_revision = repository_metadata.changeset_revision + ctx = get_changectx_for_changeset( repo, changeset_revision ) + if ctx: + rev = '%04d' % ctx.rev() + if include_date: + changeset_revision_date = get_readable_ctx_date( ctx ) + if include_hash: + label = "%s:%s (%s)" % ( str( ctx.rev() ), changeset_revision, changeset_revision_date ) + else: + label = "%s (%s)" % ( str( ctx.rev() ), changeset_revision_date ) + else: + if include_hash: + label = "%s:%s" % ( str( ctx.rev() ), changeset_revision ) + else: + label = "%s" % str( ctx.rev() ) + else: + rev = '-1' + if include_hash: + label = "-1:%s" % changeset_revision + else: + label = "-1" + return rev, label, changeset_revision + +def get_revision_label_from_ctx( ctx, include_date=True, include_hash=True ): + if include_date: + if include_hash: + return '%s:%s <i><font color="#666666">(%s)</font></i>' % \ + ( str( ctx.rev() ), str( ctx ), str( get_readable_ctx_date( ctx ) ) ) + else: + return '%s <i><font color="#666666">(%s)</font></i>' % \ + ( str( ctx.rev() ), str( get_readable_ctx_date( ctx ) ) ) + else: + if include_hash: + return '%s:%s' % ( str( ctx.rev() ), str( ctx ) ) + else: + return '%s' % str( ctx.rev() ) + +def get_rev_label_from_changeset_revision( repo, changeset_revision, include_date=True, include_hash=True ): + """ + Given a changeset revision hash, return two strings, the changeset rev and the changeset revision hash + which includes the revision date if the receive include_date is True. + """ + ctx = get_changectx_for_changeset( repo, changeset_revision ) + if ctx: + rev = '%04d' % ctx.rev() + label = get_revision_label_from_ctx( ctx, include_date=include_date ) + else: + rev = '-1' + label = "-1:%s" % changeset_revision + return rev, label diff -r 452af6869205b773d42f6e49197fbbe413947eca -r e20408b06d65f4902017bdca1cbc08bc1ec0fdd1 lib/tool_shed/util/import_util.py --- a/lib/tool_shed/util/import_util.py +++ b/lib/tool_shed/util/import_util.py @@ -8,6 +8,7 @@ from galaxy.datatypes import checkers from tool_shed.util import commit_util from tool_shed.util import encoding_util +from tool_shed.util import hg_util from tool_shed.util import metadata_util from tool_shed.util import xml_util import tool_shed.util.shed_util_common as suc @@ -212,7 +213,7 @@ archive_file_path = os.path.join( file_path, archive_file_name ) archive = tarfile.open( archive_file_path, 'r:*' ) repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) undesirable_dirs_removed = 0 undesirable_files_removed = 0 ok, error_message = commit_util.check_archive( repository, archive ) diff -r 452af6869205b773d42f6e49197fbbe413947eca -r e20408b06d65f4902017bdca1cbc08bc1ec0fdd1 lib/tool_shed/util/metadata_util.py --- a/lib/tool_shed/util/metadata_util.py +++ b/lib/tool_shed/util/metadata_util.py @@ -15,6 +15,7 @@ from tool_shed.util import common_util from tool_shed.util import common_install_util from tool_shed.util import container_util +from tool_shed.util import hg_util from tool_shed.util import readme_util from tool_shed.util import tool_dependency_util from tool_shed.util import tool_util @@ -347,7 +348,7 @@ # changeset revision in the received repository's changelog (up to the received changeset revision) to see if it is contained in the # skip_tool_test table. If it is, but is not associated with a repository_metadata record, reset that skip_tool_test record to the # newly created repository_metadata record. - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) + repo = hg.repository( hg_util.get_configured_ui(), repository.repo_path( trans.app ) ) for changeset in repo.changelog: changeset_hash = str( repo.changectx( changeset ) ) skip_tool_test = suc.get_skip_tool_test_by_changeset_revision( trans, changeset_hash ) @@ -1048,7 +1049,7 @@ def get_latest_repository_metadata( trans, decoded_repository_id, downloadable=False ): """Get last metadata defined for a specified repository from the database.""" repository = trans.sa_session.query( trans.model.Repository ).get( decoded_repository_id ) - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) + repo = hg.repository( hg_util.get_configured_ui(), repository.repo_path( trans.app ) ) if downloadable: changeset_revision = suc.get_latest_downloadable_changeset_revision( trans, repository, repo ) else: @@ -1121,21 +1122,6 @@ repository_metadata_revisions.append( metadata_revision ) return repository_metadata_revisions -def get_rev_label_changeset_revision_from_repository_metadata( trans, repository_metadata, repository=None ): - if repository is None: - repository = repository_metadata.repository - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) - changeset_revision = repository_metadata.changeset_revision - ctx = suc.get_changectx_for_changeset( repo, changeset_revision ) - if ctx: - changeset_revision_date = suc.get_readable_ctx_date( ctx ) - rev = '%04d' % ctx.rev() - label = "%s:%s (%s)" % ( str( ctx.rev() ), changeset_revision, changeset_revision_date ) - else: - rev = '-1' - label = "-1:%s" % changeset_revision - return rev, label, changeset_revision - def get_sample_files_from_disk( repository_files_dir, tool_path=None, relative_install_dir=None, resetting_all_metadata_on_repository=False ): if resetting_all_metadata_on_repository: @@ -1294,7 +1280,7 @@ log.debug( error_message ) is_valid = False return repository_dependency_tup, is_valid, error_message - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( app ) ) + repo = hg.repository( hg_util.get_configured_ui(), repository.repo_path( app ) ) # The received changeset_revision may be None since defining it in the dependency definition is optional. # If this is the case, the default will be to set it's value to the repository dependency tip revision. # This probably occurs only when handling circular dependency definitions. @@ -1360,7 +1346,7 @@ """ if repository.deleted: return ( None, False ) - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) + repo = hg.repository( hg_util.get_configured_ui(), repository.repo_path( trans.app ) ) # Get the latest installable changeset revision since that is all that is currently configured for testing. latest_installable_changeset_revision = suc.get_latest_downloadable_changeset_revision( trans, repository, repo ) if latest_installable_changeset_revision not in [ None, suc.INITIAL_CHANGELOG_HASH ]: @@ -1797,7 +1783,7 @@ repository = suc.get_repository_in_tool_shed( trans, id ) log.debug( "Resetting all metadata on repository: %s" % repository.name ) repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) repository_clone_url = common_util.generate_clone_url_for_repository_in_tool_shed( trans, repository ) # The list of changeset_revisions refers to repository_metadata records that have been created or updated. When the following loop # completes, we'll delete all repository_metadata records for this repository that do not have a changeset_revision value in this list. @@ -1978,7 +1964,7 @@ encoded_id = trans.security.encode_id( repository.id ) repository_clone_url = common_util.generate_clone_url_for_repository_in_tool_shed( trans, repository ) repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) metadata_dict, invalid_file_tups = generate_metadata_for_changeset_revision( app=trans.app, repository=repository, changeset_revision=repository.tip( trans.app ), diff -r 452af6869205b773d42f6e49197fbbe413947eca -r e20408b06d65f4902017bdca1cbc08bc1ec0fdd1 lib/tool_shed/util/readme_util.py --- a/lib/tool_shed/util/readme_util.py +++ b/lib/tool_shed/util/readme_util.py @@ -9,6 +9,7 @@ from galaxy.util import unicodify import tool_shed.util.shed_util_common as suc from tool_shed.util import common_util +from tool_shed.util import hg_util eggs.require( 'mercurial' ) @@ -25,7 +26,7 @@ if trans.webapp.name == 'galaxy': can_use_disk_files = True else: - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) + repo = hg.repository( hg_util.get_configured_ui(), repository.repo_path( trans.app ) ) latest_downloadable_changeset_revision = suc.get_latest_downloadable_changeset_revision( trans, repository, repo ) can_use_disk_files = changeset_revision == latest_downloadable_changeset_revision readme_files_dict = {} @@ -74,7 +75,7 @@ readme_files_dict[ readme_file_name ] = text_of_reasonable_length else: # We must be in the tool shed and have an old changeset_revision, so we need to retrieve the file contents from the repository manifest. - ctx = suc.get_changectx_for_changeset( repo, changeset_revision ) + ctx = hg_util.get_changectx_for_changeset( repo, changeset_revision ) if ctx: fctx = suc.get_file_context_from_ctx( ctx, readme_file_name ) if fctx and fctx not in [ 'DELETED' ]: diff -r 452af6869205b773d42f6e49197fbbe413947eca -r e20408b06d65f4902017bdca1cbc08bc1ec0fdd1 lib/tool_shed/util/repository_dependency_util.py --- a/lib/tool_shed/util/repository_dependency_util.py +++ b/lib/tool_shed/util/repository_dependency_util.py @@ -9,6 +9,7 @@ from tool_shed.util import common_install_util from tool_shed.util import container_util from tool_shed.util import encoding_util +from tool_shed.util import hg_util from tool_shed.util import metadata_util from tool_shed.util import tool_util @@ -532,7 +533,7 @@ else: # The repository changeset_revision is no longer installable, so see if there's been an update. repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) changeset_revision = suc.get_next_downloadable_changeset_revision( repository, repo, rd_changeset_revision ) repository_metadata = metadata_util.get_repository_metadata_by_repository_id_changeset_revision( trans, trans.security.encode_id( repository.id ), diff -r 452af6869205b773d42f6e49197fbbe413947eca -r e20408b06d65f4902017bdca1cbc08bc1ec0fdd1 lib/tool_shed/util/repository_maintenance_util.py --- a/lib/tool_shed/util/repository_maintenance_util.py +++ b/lib/tool_shed/util/repository_maintenance_util.py @@ -3,6 +3,7 @@ import os import re import tool_shed.util.shed_util_common as suc +from tool_shed.util import hg_util from tool_shed.util import import_util from galaxy import util from galaxy.web.form_builder import build_select_field @@ -47,7 +48,7 @@ # Since we support both http and https, we set push_ssl to False to override the default (which is True) in the mercurial api. The hg # purge extension purges all files and directories not being tracked by mercurial in the current repository. It'll remove unknown files # and empty directories. This is not currently used because it is not supported in the mercurial API. - repo = hg.repository( suc.get_configured_ui(), path=repository.repo_path( trans.app ) ) + repo = hg.repository( hg_util.get_configured_ui(), path=repository.repo_path( trans.app ) ) fp = repo.opener( 'hgrc', 'wb' ) fp.write( '[paths]\n' ) fp.write( 'default = .\n' ) @@ -83,7 +84,7 @@ if not os.path.exists( repository_path ): os.makedirs( repository_path ) # Create the local repository. - repo = hg.repository( suc.get_configured_ui(), repository_path, create=True ) + repo = hg.repository( hg_util.get_configured_ui(), repository_path, create=True ) # Add an entry in the hgweb.config file for the local repository. lhs = "repos/%s/%s" % ( repository.user.username, repository.name ) trans.app.hgweb_config_manager.add_entry( lhs, repository_path ) diff -r 452af6869205b773d42f6e49197fbbe413947eca -r e20408b06d65f4902017bdca1cbc08bc1ec0fdd1 lib/tool_shed/util/review_util.py --- a/lib/tool_shed/util/review_util.py +++ b/lib/tool_shed/util/review_util.py @@ -3,6 +3,7 @@ from galaxy import eggs from galaxy.model.orm import and_ from galaxy.util.odict import odict +from tool_shed.util import hg_util import tool_shed.util.shed_util_common as suc eggs.require( 'mercurial' ) @@ -58,13 +59,13 @@ 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( suc.get_configured_ui(), repository.repo_path( trans.app ) ) + repo = hg.repository( hg_util.get_configured_ui(), repository.repo_path( trans.app ) ) reviewed_revision_hashes = [ review.changeset_revision for review in repository.reviews ] previous_reviews_dict = odict() for changeset in suc.reversed_upper_bounded_changelog( repo, changeset_revision ): previous_changeset_revision = str( repo.changectx( changeset ) ) if previous_changeset_revision in reviewed_revision_hashes: - previous_rev, previous_changeset_revision_label = suc.get_rev_label_from_changeset_revision( repo, previous_changeset_revision ) + previous_rev, previous_changeset_revision_label = hg_util.get_rev_label_from_changeset_revision( repo, previous_changeset_revision ) revision_reviews = get_reviews_by_repository_id_changeset_revision( trans, trans.security.encode_id( repository.id ), previous_changeset_revision ) @@ -93,7 +94,7 @@ def has_previous_repository_reviews( trans, repository, changeset_revision ): """Determine if a repository has a changeset revision review prior to the received changeset revision.""" - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) + repo = hg.repository( hg_util.get_configured_ui(), repository.repo_path( trans.app ) ) reviewed_revision_hashes = [ review.changeset_revision for review in repository.reviews ] for changeset in suc.reversed_upper_bounded_changelog( repo, changeset_revision ): previous_changeset_revision = str( repo.changectx( changeset ) ) diff -r 452af6869205b773d42f6e49197fbbe413947eca -r e20408b06d65f4902017bdca1cbc08bc1ec0fdd1 lib/tool_shed/util/shed_util_common.py --- a/lib/tool_shed/util/shed_util_common.py +++ b/lib/tool_shed/util/shed_util_common.py @@ -4,9 +4,6 @@ import shutil import string import tempfile -from datetime import datetime -from time import gmtime -from time import strftime from galaxy import util from galaxy.util import asbool from galaxy.util import json @@ -19,6 +16,7 @@ import sqlalchemy.orm.exc from tool_shed.util import common_util from tool_shed.util import encoding_util +from tool_shed.util import hg_util from tool_shed.util import xml_util import tool_shed.repository_types.util as rt_util from xml.etree import ElementTree as XmlET @@ -143,7 +141,7 @@ def changeset_is_valid( app, repository, changeset_revision ): """Make sure a changeset hash is valid for a specified repository.""" - repo = hg.repository( get_configured_ui(), repository.repo_path( app ) ) + repo = hg.repository( hg_util.get_configured_ui(), repository.repo_path( app ) ) for changeset in repo.changelog: changeset_hash = str( repo.changectx( changeset ) ) if changeset_revision == changeset_hash: @@ -167,7 +165,7 @@ def clone_repository( repository_clone_url, repository_file_dir, ctx_rev ): """Clone the repository up to the specified changeset_revision. No subsequent revisions will be present in the cloned repository.""" try: - commands.clone( get_configured_ui(), + commands.clone( hg_util.get_configured_ui(), str( repository_clone_url ), dest=str( repository_file_dir ), pull=True, @@ -469,14 +467,6 @@ except sqlalchemy.orm.exc.NoResultFound: return None -def get_changectx_for_changeset( repo, changeset_revision, **kwd ): - """Retrieve a specified changectx from a repository.""" - for changeset in repo.changelog: - ctx = repo.changectx( changeset ) - if str( ctx ) == changeset_revision: - return ctx - return None - def get_config( config_file, repo, ctx, dir ): """Return the latest version of config_filename from the repository manifest.""" config_file = strip_path( config_file ) @@ -496,16 +486,6 @@ return os.path.abspath( os.path.join( root, name ) ) return None -def get_configured_ui(): - """Configure any desired ui settings.""" - _ui = ui.ui() - # The following will suppress all messages. This is - # the same as adding the following setting to the repo - # hgrc file' [ui] section: - # quiet = True - _ui.setconfig( 'ui', 'quiet', True ) - return _ui - def get_ctx_rev( app, tool_shed_url, name, owner, changeset_revision ): """ Send a request to the tool shed to retrieve the ctx_rev for a repository defined by the @@ -539,7 +519,7 @@ if repository_metadata: return repository_metadata # The installable changeset_revision may have been changed because it was "moved ahead" in the repository changelog. - repo = hg.repository( get_configured_ui(), repository.repo_path( trans.app ) ) + repo = hg.repository( hg_util.get_configured_ui(), repository.repo_path( trans.app ) ) updated_changeset_revision = get_next_downloadable_changeset_revision( repository, repo, after_changeset_revision=changeset_revision ) if updated_changeset_revision: repository_metadata = get_repository_metadata_by_changeset_revision( trans, encoded_repository_id, updated_changeset_revision ) @@ -590,7 +570,7 @@ # record, so updates must be necessary. defined_repository = get_repository_by_name_and_owner( trans.app, name, owner ) defined_repo_dir = defined_repository.repo_path( trans.app ) - defined_repo = hg.repository( get_configured_ui(), defined_repo_dir ) + defined_repo = hg.repository( hg_util.get_configured_ui(), defined_repo_dir ) updated_changeset_revision = \ get_next_downloadable_changeset_revision( defined_repository, defined_repo, @@ -799,7 +779,7 @@ changeset_tups = [] for repository_metadata in metadata_revisions: changeset_revision = repository_metadata.changeset_revision - ctx = get_changectx_for_changeset( repo, changeset_revision ) + ctx = hg_util.get_changectx_for_changeset( repo, changeset_revision ) if ctx: rev = '%04d' % ctx.rev() else: @@ -913,13 +893,6 @@ return trans.install_model.context.query( trans.install_model.ToolShedRepository ) \ .filter( trans.install_model.ToolShedRepository.table.c.uninstalled == False ) -def get_readable_ctx_date( ctx ): - """Convert the date of the changeset (the received ctx) to a human-readable date.""" - t, tz = ctx.date() - date = datetime( *gmtime( float( t ) - tz )[ :6 ] ) - ctx_date = date.strftime( "%Y-%m-%d" ) - return ctx_date - def get_repo_info_tuple_contents( repo_info_tuple ): """Take care in handling the repo_info_tuple as it evolves over time as new tool shed features are introduced.""" if len( repo_info_tuple ) == 6: @@ -1211,38 +1184,6 @@ reversed_changelog.insert( 0, changeset ) return reversed_changelog -def get_revision_label( trans, repository, changeset_revision, include_date=True ): - """ - Return a string consisting of the human read-able changeset rev and the changeset revision string - which includes the revision date if the receive include_date is True. - """ - repo = hg.repository( get_configured_ui(), repository.repo_path( trans.app ) ) - ctx = get_changectx_for_changeset( repo, changeset_revision ) - if ctx: - return get_revision_label_from_ctx( ctx, include_date=include_date ) - else: - return "-1:%s" % changeset_revision - -def get_revision_label_from_ctx( ctx, include_date=True ): - if include_date: - return '%s:%s <i><font color="#666666">(%s)</font></i>' % \ - ( str( ctx.rev() ), str( ctx ), str( get_readable_ctx_date( ctx ) ) ) - return '%s:%s' % ( str( ctx.rev() ), str( ctx ) ) - -def get_rev_label_from_changeset_revision( repo, changeset_revision, include_date=True ): - """ - Given a changeset revision hash, return two strings, the changeset rev and the changeset revision hash - which includes the revision date if the receive include_date is True. - """ - ctx = get_changectx_for_changeset( repo, changeset_revision ) - if ctx: - rev = '%04d' % ctx.rev() - label = get_revision_label_from_ctx( ctx, include_date=include_date ) - else: - rev = '-1' - label = "-1:%s" % changeset_revision - return rev, label - def get_shed_tool_conf_dict( app, shed_tool_conf ): """Return the in-memory version of the shed_tool_conf file, which is stored in the config_elems entry in the shed_tool_conf_dict associated with the file.""" for index, shed_tool_conf_dict in enumerate( app.toolbox.shed_tool_confs ): @@ -1434,7 +1375,7 @@ """ repository = get_repository_by_name_and_owner( trans.app, name, owner ) repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) # 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. @@ -1487,7 +1428,7 @@ that was included in the change set. """ repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) sharable_link = generate_sharable_link_for_repository_in_tool_shed( trans, repository, changeset_revision=None ) smtp_server = trans.app.config.smtp_server if smtp_server and ( new_repo_alert or repository.email_alerts ): @@ -1510,7 +1451,7 @@ template = new_repo_email_alert_template else: template = email_alert_template - display_date = get_readable_ctx_date( ctx ) + display_date = hg_util.get_readable_ctx_date( ctx ) admin_body = string.Template( template ).safe_substitute( host=trans.request.host, sharable_link=sharable_link, repository_name=repository.name, @@ -1859,7 +1800,7 @@ # I = ignored # It would be nice if we could use mercurial's purge extension to remove untracked files. The problem is that # purging is not supported by the mercurial API. - commands.update( get_configured_ui(), repo, rev=ctx_rev ) + commands.update( hg_util.get_configured_ui(), repo, rev=ctx_rev ) def update_tool_shed_repository_status( app, tool_shed_repository, status, error_message=None ): """Update the status of a tool shed repository in the process of being installed into Galaxy.""" diff -r 452af6869205b773d42f6e49197fbbe413947eca -r e20408b06d65f4902017bdca1cbc08bc1ec0fdd1 lib/tool_shed/util/tool_util.py --- a/lib/tool_shed/util/tool_util.py +++ b/lib/tool_shed/util/tool_util.py @@ -15,6 +15,7 @@ from galaxy.web.form_builder import SelectField from galaxy.tools.actions.upload import UploadToolAction from tool_shed.util import common_util +from tool_shed.util import hg_util from tool_shed.util import xml_util import tool_shed.util.shed_util_common as suc from xml.etree import ElementTree as XmlET @@ -538,7 +539,7 @@ """ repository = suc.get_repository_by_id( trans, repository_id ) repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) # Initialize the tool lineage version_lineage = [ guid ] # Get all ancestor guids of the received guid. @@ -637,7 +638,7 @@ def handle_sample_files_and_load_tool_from_tmp_config( trans, repo, repository_id, changeset_revision, tool_config_filename, work_dir ): tool = None message = '' - ctx = suc.get_changectx_for_changeset( repo, changeset_revision ) + ctx = hg_util.get_changectx_for_changeset( repo, changeset_revision ) # We're not currently doing anything with the returned list of deleted_sample_files here. It is intended to help handle sample files that are in # the manifest, but have been deleted from disk. sample_files, deleted_sample_files = get_list_of_copied_sample_files( repo, ctx, dir=work_dir ) @@ -866,7 +867,7 @@ original_tool_data_path = trans.app.config.tool_data_path repository = suc.get_repository_in_tool_shed( trans, repository_id ) repo_files_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_files_dir ) + repo = hg.repository( hg_util.get_configured_ui(), repo_files_dir ) message = '' tool = None can_use_disk_file = False diff -r 452af6869205b773d42f6e49197fbbe413947eca -r e20408b06d65f4902017bdca1cbc08bc1ec0fdd1 templates/webapps/tool_shed/common/common.mako --- a/templates/webapps/tool_shed/common/common.mako +++ b/templates/webapps/tool_shed/common/common.mako @@ -107,7 +107,7 @@ <%def name="render_multiple_heads_message( heads )"><div class="warningmessage"><% - from tool_shed.util.shed_util_common import get_revision_label_from_ctx + from tool_shed.util.hg_util import get_revision_label_from_ctx heads_str = '' for ctx in heads: heads_str += '%s<br/>' % get_revision_label_from_ctx( ctx, include_date=True ) diff -r 452af6869205b773d42f6e49197fbbe413947eca -r e20408b06d65f4902017bdca1cbc08bc1ec0fdd1 templates/webapps/tool_shed/repository/view_changeset.mako --- a/templates/webapps/tool_shed/repository/view_changeset.mako +++ b/templates/webapps/tool_shed/repository/view_changeset.mako @@ -49,7 +49,7 @@ %endif <div class="toolForm"><% - from tool_shed.util.shed_util_common import get_readable_ctx_date + from tool_shed.util.hg_util import get_readable_ctx_date changeset_revision_date = get_readable_ctx_date( ctx ) if can_download: title_str = 'Changeset <b>%s:%s</b><i>(%s)</i>' % ( ctx.rev(), ctx, changeset_revision_date ) diff -r 452af6869205b773d42f6e49197fbbe413947eca -r e20408b06d65f4902017bdca1cbc08bc1ec0fdd1 test/tool_shed/base/twilltestcase.py --- a/test/tool_shed/base/twilltestcase.py +++ b/test/tool_shed/base/twilltestcase.py @@ -1418,10 +1418,10 @@ def verify_repository_reviews( self, repository, reviewer=None, strings_displayed=[], strings_not_displayed=[] ): changeset_revision = self.get_repository_tip( repository ) # Verify that the currently logged in user has a repository review for the specified repository, reviewer, and changeset revision. - strings_displayed=[ repository.name, reviewer.username, changeset_revision ] + strings_displayed=[ repository.name, reviewer.username ] self.display_reviewed_repositories_owned_by_user( strings_displayed=strings_displayed ) # Verify that the reviewer has reviewed the specified repository's changeset revision. - strings_displayed=[ repository.name, repository.description, changeset_revision ] + strings_displayed=[ repository.name, repository.description ] self.display_repository_reviews_by_user( reviewer, strings_displayed=strings_displayed ) # Load the review and check for the components passed in strings_displayed. review = test_db_util.get_repository_review_by_user_id_changeset_revision( reviewer.id, repository.id, changeset_revision ) diff -r 452af6869205b773d42f6e49197fbbe413947eca -r e20408b06d65f4902017bdca1cbc08bc1ec0fdd1 test/tool_shed/functional/test_0420_citable_urls_for_repositories.py --- a/test/tool_shed/functional/test_0420_citable_urls_for_repositories.py +++ b/test/tool_shed/functional/test_0420_citable_urls_for_repositories.py @@ -104,7 +104,6 @@ strings_displayed = [ '/repository/browse_repositories', encoded_user_id, 'operation=repositories_by_user' ] strings_displayed.append( encoded_user_id ) strings_displayed_in_iframe = [ 'user1', 'filtering_0420', 'Galaxy filtering tool for test 0420' ] - strings_displayed_in_iframe.append( self.get_repository_tip( repository ) ) self.load_citable_url( username='user1', repository_name=None, changeset_revision=None, @@ -208,7 +207,6 @@ strings_displayed.extend( [ 'list+of+repositories+owned', 'does+not+include+one+named', '%21%21invalid%21%21', 'status=error' ] ) strings_displayed_in_iframe = [ 'user1', 'filtering_0420' ] strings_displayed_in_iframe.append( 'Repositories Owned by user1' ) - strings_displayed_in_iframe.append( tip_revision ) self.load_citable_url( username='user1', repository_name='!!invalid!!', changeset_revision=None, 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.