
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/9a6e51c4efeb/ changeset: 9a6e51c4efeb user: greg date: 2011-10-27 21:08:07 summary: Create a new ToolShedRepository record only if necessary - if one already exists for the installed repository but is marked deleted, mark the exisint record undeleted. affected #: 2 files diff -r 786a5d6c56c77b592598df8e32b227cb6e5cb63f -r 9a6e51c4efeb1b901cb4cc5b2c494577b5f11ad8 lib/galaxy/web/base/controller.py --- a/lib/galaxy/web/base/controller.py +++ b/lib/galaxy/web/base/controller.py @@ -2443,6 +2443,13 @@ id = trans.security.decode_id( id ) quota = trans.sa_session.query( trans.model.Quota ).get( id ) return quota +def get_tool_shed_repository( trans, tool_shed, name, owner, changeset_revision ): + return trans.sa_session.query( trans.model.ToolShedRepository ) \ + .filter( and_( trans.model.ToolShedRepository.table.c.tool_shed == tool_shed, + trans.model.ToolShedRepository.table.c.name == name, + trans.model.ToolShedRepository.table.c.owner == owner, + trans.model.ToolShedRepository.table.c.changeset_revision == changeset_revision ) ) \ + .first() def handle_sample_tool_data_table_conf_file( trans, filename ): """ Parse the incoming filename and add new entries to the in-memory diff -r 786a5d6c56c77b592598df8e32b227cb6e5cb63f -r 9a6e51c4efeb1b901cb4cc5b2c494577b5f11ad8 lib/galaxy/web/controllers/admin.py --- a/lib/galaxy/web/controllers/admin.py +++ b/lib/galaxy/web/controllers/admin.py @@ -766,12 +766,9 @@ os.chdir( current_working_dir ) tmp_stderr.close() if returncode == 0: - # Add a new record to the tool_shed_repository table. - tool_shed_repository = self.__create_tool_shed_repository( trans, - name, - description, - changeset_revision, - repository_clone_url ) + # Add a new record to the tool_shed_repository table if one doesn't + # already exist. If one exists but is marked deleted, undelete it. + self.__create_or_undelete_tool_shed_repository( trans, name, description, changeset_revision, repository_clone_url ) # Update the cloned repository to changeset_revision. repo_files_dir = os.path.join( clone_dir, name ) log.debug( 'Updating cloned repository to revision "%s"...' % changeset_revision ) @@ -1055,17 +1052,26 @@ # We have an invalid .xml file, so not a tool config. log.debug( "Ignoring invalid tool config (%s). Error: %s" % ( str( relative_path ), str( e ) ) ) return sample_files, repository_tools_tups - def __create_tool_shed_repository( self, trans, name, description, changeset_revision, repository_clone_url ): + def __create_or_undelete_tool_shed_repository( self, trans, name, description, changeset_revision, repository_clone_url ): tmp_url = self.__clean_repository_clone_url( repository_clone_url ) tool_shed = tmp_url.split( 'repos' )[ 0 ].rstrip( '/' ) owner = self.__get_repository_owner( tmp_url ) - tool_shed_repository = trans.model.ToolShedRepository( tool_shed=tool_shed, - name=name, - description=description, - owner=owner, - changeset_revision=changeset_revision ) - trans.sa_session.add( tool_shed_repository ) - trans.sa_session.flush() + flush_needed = False + tool_shed_repository = get_tool_shed_repository( trans, tool_shed, name, owner, changeset_revision ) + if tool_shed_repository: + if tool_shed_repository.deleted: + tool_shed_repository.deleted = False + flush_needed = True + else: + tool_shed_repository = trans.model.ToolShedRepository( tool_shed=tool_shed, + name=name, + description=description, + owner=owner, + changeset_revision=changeset_revision ) + flush_needed = True + if flush_needed: + trans.sa_session.add( tool_shed_repository ) + trans.sa_session.flush() def __add_shed_tool_conf_entry( self, trans, shed_tool_conf, new_tool_section ): # Add an entry in the shed_tool_conf file. An entry looks something like: # <section name="Filter and Sort" id="filter"> 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.