##// END OF EJS Templates
implemented #91,...
marcink -
r872:b956e6f4 beta
parent child Browse files
Show More
@@ -3,7 +3,7 b''
3 Changelog
3 Changelog
4 =========
4 =========
5
5
6 1.1.0 (**2010-XX-XX**)
6 1.2.0 (**2010-12-18**)
7 ----------------------
7 ----------------------
8
8
9 :status: in-progress
9 :status: in-progress
@@ -12,6 +12,18 b' 1.1.0 (**2010-XX-XX**)'
12 news
12 news
13 ++++
13 ++++
14
14
15 - implemented #91 added nicer looking archive urls
16
17 fixes
18 ++++
19
20
21 1.1.0 (**2010-12-18**)
22 ----------------------
23
24 news
25 ++++
26
15 - rewrite of internals for vcs >=0.1.10
27 - rewrite of internals for vcs >=0.1.10
16 - uses mercurial 1.7 with dotencode disabled for maintaining compatibility
28 - uses mercurial 1.7 with dotencode disabled for maintaining compatibility
17 with older clients
29 with older clients
@@ -117,5 +129,4 b' 1.0.0rc2 (**2010-10-11**)'
117
129
118 - Disabled dirsize in file browser, it's causing nasty bug when dir renames
130 - Disabled dirsize in file browser, it's causing nasty bug when dir renames
119 occure. After vcs is fixed it'll be put back again.
131 occure. After vcs is fixed it'll be put back again.
120 - templating/css rewrites, optimized css.
132 - templating/css rewrites, optimized css. No newline at end of file
121
@@ -189,8 +189,8 b' def make_map(config):'
189 map.connect('files_annotate_home', '/{repo_name:.*}/annotate/{revision}/{f_path:.*}',
189 map.connect('files_annotate_home', '/{repo_name:.*}/annotate/{revision}/{f_path:.*}',
190 controller='files', action='annotate', revision='tip', f_path='',
190 controller='files', action='annotate', revision='tip', f_path='',
191 conditions=dict(function=check_repo))
191 conditions=dict(function=check_repo))
192 map.connect('files_archive_home', '/{repo_name:.*}/archive/{revision}/{fileformat}',
192 map.connect('files_archive_home', '/{repo_name:.*}/archive/{fname}',
193 controller='files', action='archivefile', revision='tip',
193 controller='files', action='archivefile',
194 conditions=dict(function=check_repo))
194 conditions=dict(function=check_repo))
195 map.connect('repo_settings_delete', '/{repo_name:.*}/settings',
195 map.connect('repo_settings_delete', '/{repo_name:.*}/settings',
196 controller='settings', action="delete",
196 controller='settings', action="delete",
@@ -39,7 +39,7 b' from rhodecode.lib.base import BaseContr'
39 from rhodecode.lib.utils import EmptyChangeset
39 from rhodecode.lib.utils import EmptyChangeset
40 from rhodecode.model.scm import ScmModel
40 from rhodecode.model.scm import ScmModel
41
41
42 from vcs.exceptions import RepositoryError, ChangesetError
42 from vcs.exceptions import RepositoryError, ChangesetError, ChangesetDoesNotExistError
43 from vcs.nodes import FileNode
43 from vcs.nodes import FileNode
44 from vcs.utils import diffs as differ
44 from vcs.utils import diffs as differ
45
45
@@ -133,14 +133,32 b' class FilesController(BaseController):'
133
133
134 return render('files/files_annotate.html')
134 return render('files/files_annotate.html')
135
135
136 def archivefile(self, repo_name, revision, fileformat):
136 def archivefile(self, repo_name, fname):
137 info = fname.split('.')
138 revision, fileformat = info[0], '.' + '.'.join(info[1:])
137 archive_specs = {
139 archive_specs = {
138 '.tar.bz2': ('application/x-tar', 'tbz2'),
140 '.tar.bz2': ('application/x-tar', 'tbz2'),
139 '.tar.gz': ('application/x-tar', 'tgz'),
141 '.tar.gz': ('application/x-tar', 'tgz'),
140 '.zip': ('application/zip', 'zip'),
142 '.zip': ('application/zip', 'zip'),
141 }
143 }
142 if not archive_specs.has_key(fileformat):
144 if not archive_specs.has_key(fileformat):
143 return 'Unknown archive type %s' % fileformat
145 return _('Unknown archive type %s') % fileformat
146
147 repo = ScmModel().get_repo(repo_name)
148
149 try:
150 repo.get_changeset(revision)
151 except ChangesetDoesNotExistError:
152 return _('Unknown revision %s') % revision
153
154 archive = tempfile.TemporaryFile()
155 localrepo = repo.repo
156 fname = '%s-%s%s' % (repo_name, revision, fileformat)
157 archival.archive(localrepo, archive, revision, archive_specs[fileformat][1],
158 prefix='%s-%s' % (repo_name, revision))
159 response.content_type = archive_specs[fileformat][0]
160 response.content_disposition = 'attachment; filename=%s' % fname
161 archive.seek(0)
144
162
145 def read_in_chunks(file_object, chunk_size=1024 * 40):
163 def read_in_chunks(file_object, chunk_size=1024 * 40):
146 """Lazy function (generator) to read a file piece by piece.
164 """Lazy function (generator) to read a file piece by piece.
@@ -151,14 +169,6 b' class FilesController(BaseController):'
151 break
169 break
152 yield data
170 yield data
153
171
154 archive = tempfile.TemporaryFile()
155 repo = ScmModel().get_repo(repo_name).repo
156 fname = '%s-%s%s' % (repo_name, revision, fileformat)
157 archival.archive(repo, archive, revision, archive_specs[fileformat][1],
158 prefix='%s-%s' % (repo_name, revision))
159 response.content_type = archive_specs[fileformat][0]
160 response.content_disposition = 'attachment; filename=%s' % fname
161 archive.seek(0)
162 return read_in_chunks(archive)
172 return read_in_chunks(archive)
163
173
164 def diff(self, repo_name, f_path):
174 def diff(self, repo_name, f_path):
@@ -223,7 +223,7 b''
223 %endif
223 %endif
224 ${h.link_to(c.repo_info.name+'.'+archive['type'],
224 ${h.link_to(c.repo_info.name+'.'+archive['type'],
225 h.url('files_archive_home',repo_name=c.repo_info.name,
225 h.url('files_archive_home',repo_name=c.repo_info.name,
226 revision='tip',fileformat=archive['extension']),class_="archive_icon")}
226 fname='tip'+archive['extension']),class_="archive_icon")}
227 %endfor
227 %endfor
228 </div>
228 </div>
229 </div>
229 </div>
@@ -5,13 +5,13 b' from rhodecode import get_version'
5
5
6 requirements = [
6 requirements = [
7 "Pylons==1.0.0",
7 "Pylons==1.0.0",
8 "SQLAlchemy==0.6.5",
8 "SQLAlchemy>=0.6.5",
9 "Mako==0.3.6",
9 "Mako==0.3.6",
10 "vcs==0.1.10",
10 "vcs=>0.1.10",
11 "pygments==1.3.1",
11 "pygments>=1.3.1",
12 "mercurial==1.7.2",
12 "mercurial>=1.7.2",
13 "whoosh==1.3.4",
13 "whoosh>=1.3.4",
14 "celery==2.1.4",
14 "celery>=2.1.4",
15 "py-bcrypt",
15 "py-bcrypt",
16 "babel",
16 "babel",
17 ]
17 ]
General Comments 0
You need to be logged in to leave comments. Login now