diff --git a/docs/changelog.rst b/docs/changelog.rst --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -27,7 +27,7 @@ fixes - fixed file browser bug, when switching into given form revision the url was not changing - fixed propagation to error controller on simplehg and simplegit middlewares - +- fixed error when trying to make a download on empty repository 1.1.2 (**2011-01-12**) diff --git a/rhodecode/controllers/files.py b/rhodecode/controllers/files.py --- a/rhodecode/controllers/files.py +++ b/rhodecode/controllers/files.py @@ -154,16 +154,16 @@ class FilesController(BaseController): '.tar.gz': ('application/x-tar', 'tgz'), '.zip': ('application/zip', 'zip'), } - + fileformat = None revision = None - + for ext in archive_specs.keys(): archive_spec = fname.split(ext) if len(archive_spec) == 2: fileformat = archive_spec[1] or ext revision = archive_spec[0] - + if not archive_specs.has_key(fileformat): return _('Unknown archive type') @@ -173,6 +173,8 @@ class FilesController(BaseController): repo.get_changeset(revision) except ChangesetDoesNotExistError: return _('Unknown revision %s') % revision + except EmptyRepositoryError: + return _('Empty repository') archive = tempfile.TemporaryFile() localrepo = repo.repo diff --git a/rhodecode/templates/summary/summary.html b/rhodecode/templates/summary/summary.html --- a/rhodecode/templates/summary/summary.html +++ b/rhodecode/templates/summary/summary.html @@ -128,17 +128,20 @@
- - ${h.select('download_options',c.repo_info.get_changeset().raw_id,c.download_options)} - %for cnt,archive in enumerate(c.repo_info._get_archives()): - %if cnt >=1: - | - %endif - ${h.link_to(archive['type'], - h.url('files_archive_home',repo_name=c.repo_info.name, - fname='tip'+archive['extension']),class_="archive_icon")} - %endfor + %if len(c.repo_info.revisions) == 0: + ${_('There are no downloads yet')} + %else: + ${h.select('download_options',c.repo_info.get_changeset().raw_id,c.download_options)} + %for cnt,archive in enumerate(c.repo_info._get_archives()): + %if cnt >=1: + | + %endif + ${h.link_to(archive['type'], + h.url('files_archive_home',repo_name=c.repo_info.name, + fname='tip'+archive['extension']),class_="archive_icon")} + %endfor + %endif
@@ -268,12 +271,11 @@
- %if c.no_data:
${c.no_data_msg} %if h.HasPermissionAll('hg.admin')('enable stats on from summary'): [${h.link_to(_('enable'),h.url('edit_repo',repo_name=c.repo_name))}] - %endif + %endif
%endif: