1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/f2e183a522d8/ Changeset: f2e183a522d8 User: greg Date: 2013-05-16 02:06:44 Summary: Fixes for determing if a new repository_metadata record is required for a tool shed repository. Affected #: 2 files diff -r 590f27390d0dca446fe804a99ba819663653207e -r f2e183a522d8b1d08ff293f23cce254cc4597721 lib/tool_shed/util/metadata_util.py --- a/lib/tool_shed/util/metadata_util.py +++ b/lib/tool_shed/util/metadata_util.py @@ -300,18 +300,17 @@ skip_tool_test = suc.get_skip_tool_test_by_changeset_revision( trans, changeset_hash ) if skip_tool_test: # We found a skip_tool_test record associated with the changeset_revision, so see if it has a valid repository_revision. - try: - repository_revision = skip_tool_test.repository_revision + repository_revision = suc.get_repository_metadata_by_id( trans, trans.security.encode_id( repository_metadata.id ) ) + if repository_revision: # The skip_tool_test record is associated with a valid repository_metadata record, so proceed. continue - except: - # We found a skip_tool_test record that is associated with an invalid repository_metadata record, so update it to point to - # the newly created repository_metadata record. In some special cases there may be multiple skip_tool_test records that - # require updating, so we won't break here, we'll continue to inspect the rest of the changelog up to the received - # changeset_revision. - skip_tool_test.repository_revision = repository_metadata - trans.sa_session.add( skip_tool_test ) - trans.sa_session.flush() + # We found a skip_tool_test record that is associated with an invalid repository_metadata record, so update it to point to + # the newly created repository_metadata record. In some special cases there may be multiple skip_tool_test records that + # require updating, so we won't break here, we'll continue to inspect the rest of the changelog up to the received + # changeset_revision. + skip_tool_test.repository_metadata_id = repository_metadata.id + trans.sa_session.add( skip_tool_test ) + trans.sa_session.flush() if changeset_hash == changeset_revision: # Proceed no further than the received changeset_revision. break @@ -1285,16 +1284,19 @@ if new_repository_dependencies_metadata: new_repository_dependencies = metadata_dict[ 'repository_dependencies' ][ 'repository_dependencies' ] # The saved metadata must be a subset of the new metadata. - for new_repository_dependency_metadata in new_repository_dependencies: - if new_repository_dependency_metadata not in saved_repository_dependencies: + for new_repository_dependency in new_repository_dependencies: + if new_repository_dependency not in saved_repository_dependencies: return True for saved_repository_dependency_metadata in saved_repository_dependencies: if saved_repository_dependency_metadata not in new_repository_dependencies: return True + return False else: # The repository_dependencies.xml file must have been deleted, so create a new repository_metadata record so we always have # access to the deleted file. return True + else: + return False else: if 'repository_dependencies' in metadata_dict: # There is no saved repository metadata, so we need to create a new repository_metadata record. @@ -1316,16 +1318,19 @@ new_tool_dependencies = metadata_dict.get( 'tool_dependencies', None ) if new_tool_dependencies: # The saved metadata must be a subset of the new metadata. - for new_repository_dependency_metadata in new_tool_dependencies: - if new_repository_dependency_metadata not in saved_tool_dependencies: + for new_tool_dependency in new_tool_dependencies: + if new_tool_dependency not in saved_tool_dependencies: return True - for saved_repository_dependency_metadata in saved_tool_dependencies: - if saved_repository_dependency_metadata not in new_tool_dependencies: + for saved_tool_dependency in saved_tool_dependencies: + if saved_tool_dependency not in new_tool_dependencies: return True + return False else: # The tool_dependencies.xml file must have been deleted, so create a new repository_metadata record so we always have # access to the deleted file. return True + else: + return False else: # We have repository metadata that does not include metadata for any tool dependencies in the repository, so we can update # the existing repository metadata. @@ -1367,6 +1372,7 @@ for new_tool_metadata_dict in metadata_dict[ 'tools' ]: if new_tool_metadata_dict[ 'id' ] not in saved_tool_ids: return True + return False else: # The new metadata includes tools, but the stored metadata does not, so we can update the stored metadata. return False diff -r 590f27390d0dca446fe804a99ba819663653207e -r f2e183a522d8b1d08ff293f23cce254cc4597721 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,6 +724,9 @@ return all_metadata_records[ 0 ] return None +def get_repository_metadata_by_id( trans, id ): + return trans.sa_session.query( trans.model.RepositoryMetadata ).get( trans.security.decode_id( id ) ) + def get_repository_owner( cleaned_repository_url ): """Gvien a "cleaned" repository clone URL, return the owner of the repository.""" items = cleaned_repository_url.split( '/repos/' ) 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.