##// END OF EJS Templates
merge with beta
marcink -
r2270:c9dc3cd9 merge default
parent child Browse files
Show More
@@ -15,7 +15,7 b' RhodeCode is similar in some respects to'
15 however RhodeCode can be run as standalone hosted application on your own server.
15 however RhodeCode can be run as standalone hosted application on your own server.
16 It is open source and donation ware and focuses more on providing a customized,
16 It is open source and donation ware and focuses more on providing a customized,
17 self administered interface for Mercurial_ and GIT_ repositories.
17 self administered interface for Mercurial_ and GIT_ repositories.
18 RhodeCode works on *nix systems and Windows it is powered by a vcs_ library
18 RhodeCode works on \*nix systems and Windows it is powered by a vcs_ library
19 that Lukasz Balcerzak and Marcin Kuzminski created to handle multiple
19 that Lukasz Balcerzak and Marcin Kuzminski created to handle multiple
20 different version control systems.
20 different version control systems.
21
21
@@ -26,6 +26,7 b''
26 import os
26 import os
27 import logging
27 import logging
28 import traceback
28 import traceback
29 import tempfile
29
30
30 from pylons import request, response, tmpl_context as c, url
31 from pylons import request, response, tmpl_context as c, url
31 from pylons.i18n.translation import _
32 from pylons.i18n.translation import _
@@ -359,25 +360,22 b' class FilesController(BaseRepoController'
359 except (ImproperArchiveTypeError, KeyError):
360 except (ImproperArchiveTypeError, KeyError):
360 return _('Unknown archive type')
361 return _('Unknown archive type')
361
362
363 archive = tempfile.NamedTemporaryFile(mode='w+r+b')
364 cs.fill_archive(stream=archive, kind=fileformat, subrepos=subrepos)
365
362 response.content_type = content_type
366 response.content_type = content_type
363 response.content_disposition = 'attachment; filename=%s-%s%s' \
367 response.content_disposition = 'attachment; filename=%s-%s%s' \
364 % (repo_name, revision, ext)
368 % (repo_name, revision[:12], ext)
365
369 response.content_length = str(os.path.getsize(archive.name))
366 import tempfile
367 archive = tempfile.mkstemp()[1]
368 t = open(archive, 'wb')
369 cs.fill_archive(stream=t, kind=fileformat, subrepos=subrepos)
370
370
371 def get_chunked_archive(archive):
371 def get_chunked_archive(tmpfile):
372 stream = open(archive, 'rb')
373 while True:
372 while True:
374 data = stream.read(4096)
373 data = tmpfile.read(16 * 1024)
375 if not data:
374 if not data:
376 os.remove(archive)
375 tmpfile.close()
377 break
376 break
378 yield data
377 yield data
379
378 return get_chunked_archive(tmpfile=archive)
380 return get_chunked_archive(archive)
381
379
382 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
380 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
383 'repository.admin')
381 'repository.admin')
@@ -263,8 +263,6 b' class MercurialChangeset(BaseChangeset):'
263 archival.archive(self.repository._repo, stream, self.raw_id,
263 archival.archive(self.repository._repo, stream, self.raw_id,
264 kind, prefix=prefix, subrepos=subrepos)
264 kind, prefix=prefix, subrepos=subrepos)
265
265
266 #stream.close()
267
268 if stream.closed and hasattr(stream, 'name'):
266 if stream.closed and hasattr(stream, 'name'):
269 stream = open(stream.name, 'rb')
267 stream = open(stream.name, 'rb')
270 elif hasattr(stream, 'mode') and 'r' not in stream.mode:
268 elif hasattr(stream, 'mode') and 'r' not in stream.mode:
General Comments 0
You need to be logged in to leave comments. Login now