Changeset - 65386911df2a
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 14 years ago 2011-11-11 17:16:14
marcin@python-works.com
fixes issue with mercurial 2.0 and archival of subrepos.
- Disable hooks when doing archive commandsvovercome mercurial problem of hook propagation to subrepos
1 file changed with 5 insertions and 0 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/files.py
Show inline comments
 
@@ -358,24 +358,29 @@ class FilesController(BaseRepoController
 
        for a_type, ext_data in settings.ARCHIVE_SPECS.items():
 
            archive_spec = fname.split(ext_data[1])
 
            if len(archive_spec) == 2 and archive_spec[1] == '':
 
                fileformat = a_type or ext_data[1]
 
                revision = archive_spec[0]
 
                ext = ext_data[1]
 

	
 
        try:
 
            dbrepo = RepoModel().get_by_repo_name(repo_name)
 
            if dbrepo.enable_downloads is False:
 
                return _('downloads disabled')
 

	
 
            # patch and reset hooks section of UI config to not run any 
 
            # hooks on fetching archives with subrepos
 
            for k, v in c.rhodecode_repo._repo.ui.configitems('hooks'):
 
                c.rhodecode_repo._repo.ui.setconfig('hooks', k, None)
 

	
 
            cs = c.rhodecode_repo.get_changeset(revision)
 
            content_type = settings.ARCHIVE_SPECS[fileformat][0]
 
        except ChangesetDoesNotExistError:
 
            return _('Unknown revision %s') % revision
 
        except EmptyRepositoryError:
 
            return _('Empty repository')
 
        except (ImproperArchiveTypeError, KeyError):
 
            return _('Unknown archive type')
 

	
 
        response.content_type = content_type
 
        response.content_disposition = 'attachment; filename=%s-%s%s' \
 
            % (repo_name, revision, ext)
0 comments (0 inline, 0 general)