commit/galaxy-central: greg: Add exception handling for mercurial commands that break in the test / production tool shed environment, but not elsewhere.
1 new changeset in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/86bdb4a9db48/ changeset: 86bdb4a9db48 user: greg date: 2011-07-21 18:46:27 summary: Add exception handling for mercurial commands that break in the test / production tool shed environment, but not elsewhere. affected #: 2 files (1.1 KB) --- a/lib/galaxy/webapps/community/controllers/repository.py Thu Jul 21 10:43:16 2011 -0400 +++ b/lib/galaxy/webapps/community/controllers/repository.py Thu Jul 21 12:46:27 2011 -0400 @@ -450,8 +450,15 @@ # Get the current repository tip. tip = repository.tip for selected_file in selected_files_to_delete: - repo_file = os.path.abspath( selected_file ) - commands.remove( repo.ui, repo, repo_file, force=True ) + try: + commands.remove( repo.ui, repo, repo_file, force=True ) + except Exception, e: + # I never have a problem with commands.remove on a Mac, but in the test/production + # tool shed environment, it throws an exception whenever I delete all files from a + # repository. If this happens, we'll try the following. + relative_selected_file = selected_file.split( 'repo_%d' % repository.id )[1].lstrip( '/' ) + repo.dirstate.remove( relative_selected_file ) + repo.dirstate.write() # Commit the change set. if not commit_message: commit_message = 'Deleted selected files' --- a/lib/galaxy/webapps/community/controllers/upload.py Thu Jul 21 10:43:16 2011 -0400 +++ b/lib/galaxy/webapps/community/controllers/upload.py Thu Jul 21 12:46:27 2011 -0400 @@ -182,7 +182,15 @@ for repo_file in files_to_remove: # Remove files in the repository (relative to the upload point) # that are not in the uploaded archive. - commands.remove( repo.ui, repo, repo_file, force=True ) + try: + commands.remove( repo.ui, repo, repo_file, force=True ) + except Exception, e: + # I never have a problem with commands.remove on a Mac, but in the test/production + # tool shed environment, it throws an exception whenever I delete all files from a + # repository. If this happens, we'll try the following. + relative_selected_file = selected_file.split( 'repo_%d' % repository.id )[1].lstrip( '/' ) + repo.dirstate.remove( relative_selected_file ) + repo.dirstate.write() for filename_in_archive in filenames_in_archive: commands.add( repo.ui, repo, filename_in_archive ) if filename_in_archive.endswith( '.loc.sample' ): 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)
-
Bitbucket