commit/galaxy-central: greg: Fixes in the tool shed api for mapping the repository user_id and for handling repository_dependency changeset_revision values that have been updated.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/11bdc0f5c964/ Changeset: 11bdc0f5c964 User: greg Date: 2014-01-16 20:07:28 Summary: Fixes in the tool shed api for mapping the repository user_id and for handling repository_dependency changeset_revision values that have been updated. Affected #: 3 files diff -r 1ffcb550e2f9464bf71a5f5154dff71ba0dd6379 -r 11bdc0f5c964a18e5a810abc283f7f1ec5e9f5ff 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 @@ -129,7 +129,7 @@ repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, encoded_repository_id, changeset_revision ) - if not repository_metadata: + if repository_metadata is None: # 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 ) @@ -139,7 +139,7 @@ encoded_repository_id, new_changeset_revision ) changeset_revision = new_changeset_revision - if repository_metadata: + if repository_metadata is not None: encoded_repository_metadata_id = trans.security.encode_id( repository_metadata.id ) repository_metadata_dict = repository_metadata.to_dict( view='collection', value_mapper=self.__get_value_mapper( trans ) ) @@ -168,7 +168,8 @@ def __get_value_mapper( self, trans ): value_mapper = { 'id' : trans.security.encode_id, - 'repository_id' : trans.security.encode_id } + 'repository_id' : trans.security.encode_id, + 'user_id' : trans.security.encode_id } return value_mapper @web.expose_api diff -r 1ffcb550e2f9464bf71a5f5154dff71ba0dd6379 -r 11bdc0f5c964a18e5a810abc283f7f1ec5e9f5ff 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 @@ -68,7 +68,8 @@ def __get_value_mapper( self, trans ): value_mapper = { 'id' : trans.security.encode_id, - 'repository_id' : trans.security.encode_id } + 'repository_id' : trans.security.encode_id, + 'user_id' : trans.security.encode_id } return value_mapper @web.expose_api_anonymous @@ -159,15 +160,33 @@ repository_dependency_repository_metadata = \ suc.get_repository_metadata_by_changeset_revision( trans, repository_dependency_id, changeset_revision ) if repository_dependency_repository_metadata is None: - log.debug( 'Cannot locate repository_metadata with id %s for repository dependency %s owned by %s.' % \ - ( str( repository_dependency_id ), str( name ), str( owner ) ) ) - continue + # 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 ) + new_changeset_revision = suc.get_next_downloadable_changeset_revision( repository_dependency, + repo, + changeset_revision ) + repository_dependency_repository_metadata = \ + suc.get_repository_metadata_by_changeset_revision( trans, + repository_dependency_id, + new_changeset_revision ) + if repository_dependency_repository_metadata is None: + decoded_repository_dependency_id = trans.security.decode_id( repository_dependency_id ) + debug_msg = 'Cannot locate repository_metadata with id %d for repository dependency %s owned by %s ' % \ + ( decoded_repository_dependency_id, str( name ), str( owner ) ) + debug_msg += 'using either of these changeset_revisions: %s, %s.' % \ + ( str( changeset_revision ), str( new_changeset_revision ) ) + log.debug( debug_msg ) + continue + else: + changeset_revision = new_changeset_revision repository_dependency_repository_metadata_id = trans.security.encode_id( repository_dependency_repository_metadata.id ) repository_dependency_dict = repository_dependency.to_dict( view='element', value_mapper=self.__get_value_mapper( trans ) ) # We have to add the changeset_revision of of the repository dependency. repository_dependency_dict[ 'changeset_revision' ] = changeset_revision - repository_dependency_dict[ 'url' ] = web.url_for( controller='repositories', + repository_dependency_dict[ 'url' ] = web.url_for( controller='repository_revisions', action='show', id=repository_dependency_repository_metadata_id ) repository_dependencies_dicts.append( repository_dependency_dict ) diff -r 1ffcb550e2f9464bf71a5f5154dff71ba0dd6379 -r 11bdc0f5c964a18e5a810abc283f7f1ec5e9f5ff 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 @@ -724,8 +724,8 @@ def get_next_downloadable_changeset_revision( repository, repo, after_changeset_revision ): """ - Return the installable changeset_revision in the repository changelog after the changeset to which after_changeset_revision refers. If there - isn't one, return None. + Return the installable changeset_revision in the repository changelog after the changeset to which + after_changeset_revision refers. If there isn't one, return None. """ changeset_revisions = get_ordered_metadata_changeset_revisions( repository, repo, downloadable=True ) if len( changeset_revisions ) == 1: 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