##// 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 15 however RhodeCode can be run as standalone hosted application on your own server.
16 16 It is open source and donation ware and focuses more on providing a customized,
17 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 19 that Lukasz Balcerzak and Marcin Kuzminski created to handle multiple
20 20 different version control systems.
21 21
@@ -26,6 +26,7 b''
26 26 import os
27 27 import logging
28 28 import traceback
29 import tempfile
29 30
30 31 from pylons import request, response, tmpl_context as c, url
31 32 from pylons.i18n.translation import _
@@ -359,25 +360,22 b' class FilesController(BaseRepoController'
359 360 except (ImproperArchiveTypeError, KeyError):
360 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 366 response.content_type = content_type
363 367 response.content_disposition = 'attachment; filename=%s-%s%s' \
364 % (repo_name, revision, ext)
365
366 import tempfile
367 archive = tempfile.mkstemp()[1]
368 t = open(archive, 'wb')
369 cs.fill_archive(stream=t, kind=fileformat, subrepos=subrepos)
368 % (repo_name, revision[:12], ext)
369 response.content_length = str(os.path.getsize(archive.name))
370 370
371 def get_chunked_archive(archive):
372 stream = open(archive, 'rb')
371 def get_chunked_archive(tmpfile):
373 372 while True:
374 data = stream.read(4096)
373 data = tmpfile.read(16 * 1024)
375 374 if not data:
376 os.remove(archive)
375 tmpfile.close()
377 376 break
378 377 yield data
379
380 return get_chunked_archive(archive)
378 return get_chunked_archive(tmpfile=archive)
381 379
382 380 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
383 381 'repository.admin')
@@ -263,8 +263,6 b' class MercurialChangeset(BaseChangeset):'
263 263 archival.archive(self.repository._repo, stream, self.raw_id,
264 264 kind, prefix=prefix, subrepos=subrepos)
265 265
266 #stream.close()
267
268 266 if stream.closed and hasattr(stream, 'name'):
269 267 stream = open(stream.name, 'rb')
270 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