commit/galaxy-central: greg: Make inclusion of the changeset revision date in the revision label an optional setting and do not include it on some pages.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/0f50bb21db37/ Changeset: 0f50bb21db37 User: greg Date: 2014-01-14 16:13:53 Summary: Make inclusion of the changeset revision date in the revision label an optional setting and do not include it on some pages. Affected #: 7 files diff -r 0d50efaac5d481b173f379a75b64a42b1b43b8a4 -r 0f50bb21db37bac8444262d9ee561f4e7f7101b0 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 @@ -1137,7 +1137,7 @@ else: containers_dict = None export_repository_dependencies_check_box = None - revision_label = suc.get_revision_label( trans, repository, changeset_revision ) + revision_label = suc.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, @@ -2198,7 +2198,7 @@ selected_value=changeset_revision, add_id_to_name=False, downloadable=False ) - revision_label = suc.get_revision_label( trans, repository, repository.tip( trans.app ) ) + revision_label = suc.get_revision_label( trans, repository, repository.tip( trans.app ), include_date=False ) repository_metadata = None metadata = None is_malicious = False @@ -2207,16 +2207,18 @@ 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 ) + revision_label = suc.get_revision_label( trans, repository, changeset_revision, include_date=False ) metadata = repository_metadata.metadata is_malicious = repository_metadata.malicious else: - # There is no repository_metadata defined for the changeset_revision, so see if it was defined in a previous changeset in the changelog. - previous_changeset_revision = suc.get_previous_metadata_changeset_revision( repository, repo, changeset_revision, downloadable=False ) + # There is no repository_metadata defined for the changeset_revision, so see if it was defined in a previous + # changeset in the changelog. + previous_changeset_revision = \ + suc.get_previous_metadata_changeset_revision( repository, repo, changeset_revision, downloadable=False ) 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 ) + revision_label = suc.get_revision_label( trans, repository, previous_changeset_revision, include_date=False ) metadata = repository_metadata.metadata is_malicious = repository_metadata.malicious if repository_metadata: @@ -2383,7 +2385,7 @@ repository_metadata_id = None metadata = None repository_dependencies = None - revision_label = suc.get_revision_label( trans, repository, changeset_revision ) + revision_label = suc.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, @@ -2457,7 +2459,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 ) + revision_label = suc.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, @@ -3019,7 +3021,7 @@ selected_value=changeset_revision, add_id_to_name=False, downloadable=False ) - revision_label = suc.get_revision_label( trans, repository, changeset_revision ) + revision_label = suc.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 @@ -3081,7 +3083,7 @@ tool = None guid = None original_tool_data_path = trans.app.config.tool_data_path - revision_label = suc.get_revision_label( trans, repository, changeset_revision ) + revision_label = suc.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 0d50efaac5d481b173f379a75b64a42b1b43b8a4 -r 0f50bb21db37bac8444262d9ee561f4e7f7101b0 lib/tool_shed/grids/admin_grids.py --- a/lib/tool_shed/grids/admin_grids.py +++ b/lib/tool_shed/grids/admin_grids.py @@ -422,7 +422,7 @@ 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 ) + return suc.get_revision_label( trans, repository, repository_metadata.changeset_revision, include_date=True ) class ToolsColumn( grids.TextColumn ): diff -r 0d50efaac5d481b173f379a75b64a42b1b43b8a4 -r 0f50bb21db37bac8444262d9ee561f4e7f7101b0 lib/tool_shed/grids/repository_grids.py --- a/lib/tool_shed/grids/repository_grids.py +++ b/lib/tool_shed/grids/repository_grids.py @@ -105,7 +105,7 @@ else: heads_str = '' for ctx in heads: - heads_str += '%s<br/>' % suc.get_revision_label_from_ctx( ctx ) + heads_str += '%s<br/>' % suc.get_revision_label_from_ctx( ctx, include_date=True ) heads_str.rstrip( '<br/>' ) if multiple_heads: heads_str += '</font>' @@ -1160,7 +1160,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 ) + changeset_revision_label = suc.get_revision_label( trans, repository, changeset_revision, include_date=True ) return changeset_revision_label diff -r 0d50efaac5d481b173f379a75b64a42b1b43b8a4 -r 0f50bb21db37bac8444262d9ee561f4e7f7101b0 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 @@ -307,7 +307,8 @@ rval += 'edit_review' else: rval +='browse_review' - rval += '?id=%s">%s</a>' % ( encoded_review_id, suc.get_revision_label( trans, review.repository, review.changeset_revision ) ) + revision_label = suc.get_revision_label( trans, review.repository, review.changeset_revision, include_date=True ) + rval += '?id=%s">%s</a>' % ( encoded_review_id, revision_label ) return rval diff -r 0d50efaac5d481b173f379a75b64a42b1b43b8a4 -r 0f50bb21db37bac8444262d9ee561f4e7f7101b0 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 @@ -1213,25 +1213,33 @@ reversed_changelog.insert( 0, changeset ) return reversed_changelog -def get_revision_label( trans, repository, changeset_revision ): - """Return a string consisting of the human read-able changeset rev and the changeset revision string.""" +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 ) + return get_revision_label_from_ctx( ctx, include_date=include_date ) else: return "-1:%s" % changeset_revision -def get_revision_label_from_ctx( ctx ): - return '%s:%s <i><font color="#666666">(%s)</font></i>' % \ - ( str( ctx.rev() ), str( ctx ), str( get_readable_ctx_date( ctx ) ) ) +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 ): - """Given a changeset revision hash, return two strings, the changeset rev and the changeset revision hash.""" +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 ) + label = get_revision_label_from_ctx( ctx, include_date=include_date ) else: rev = '-1' label = "-1:%s" % changeset_revision diff -r 0d50efaac5d481b173f379a75b64a42b1b43b8a4 -r 0f50bb21db37bac8444262d9ee561f4e7f7101b0 templates/webapps/tool_shed/repository/manage_repository.mako --- a/templates/webapps/tool_shed/repository/manage_repository.mako +++ b/templates/webapps/tool_shed/repository/manage_repository.mako @@ -125,7 +125,7 @@ from tool_shed.util.shed_util_common import get_revision_label_from_ctx heads_str = '' for ctx in heads: - heads_str += '%s<br/>' % get_revision_label_from_ctx( ctx ) + heads_str += '%s<br/>' % get_revision_label_from_ctx( ctx, include_date=True ) %> Contact the administrator of this Tool Shed as soon as possible and let them know that this repository has the following multiple heads which must be merged.<br/> diff -r 0d50efaac5d481b173f379a75b64a42b1b43b8a4 -r 0f50bb21db37bac8444262d9ee561f4e7f7101b0 templates/webapps/tool_shed/repository/view_repository.mako --- a/templates/webapps/tool_shed/repository/view_repository.mako +++ b/templates/webapps/tool_shed/repository/view_repository.mako @@ -72,7 +72,7 @@ from tool_shed.util.shed_util_common import get_revision_label_from_ctx heads_str = '' for ctx in heads: - heads_str += '%s<br/>' % get_revision_label_from_ctx( ctx ) + heads_str += '%s<br/>' % get_revision_label_from_ctx( ctx, include_date=True ) %> Contact the administrator of this Tool Shed as soon as possible and let them know that this repository has the following multiple heads which must be merged.<br/> 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)
-
commits-noreply@bitbucket.org