# HG changeset patch # User Marcin Kuzminski # Date 1337124300 -7200 # Node ID b8d5a5c9f66d03f8253b2cc7e55a40804b386b6e # Parent 058fc80b052efc9c2b8f19886f718d579c81262d# Parent 24095abde696dc150ac9bbc5bc55845ca093810e merge with beta diff -r 058fc80b052e -r b8d5a5c9f66d rhodecode/controllers/files.py --- a/rhodecode/controllers/files.py Wed May 16 00:06:43 2012 +0200 +++ b/rhodecode/controllers/files.py Wed May 16 01:25:00 2012 +0200 @@ -360,9 +360,9 @@ except (ImproperArchiveTypeError, KeyError): return _('Unknown archive type') - archive = tempfile.NamedTemporaryFile(mode='w+r+b') + archive = tempfile.NamedTemporaryFile(mode='w+r+b', delete=False) cs.fill_archive(stream=archive, kind=fileformat, subrepos=subrepos) - + archive.close() response.content_type = content_type response.content_disposition = 'attachment; filename=%s-%s%s' \ % (repo_name, revision[:12], ext) @@ -373,9 +373,10 @@ data = tmpfile.read(16 * 1024) if not data: tmpfile.close() + os.unlink(tmpfile.name) break yield data - return get_chunked_archive(tmpfile=archive) + return get_chunked_archive(tmpfile=open(archive.name,'rb')) @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', 'repository.admin') diff -r 058fc80b052e -r b8d5a5c9f66d rhodecode/lib/auth.py --- a/rhodecode/lib/auth.py Wed May 16 00:06:43 2012 +0200 +++ b/rhodecode/lib/auth.py Wed May 16 01:25:00 2012 +0200 @@ -64,7 +64,7 @@ passwd_gen = PasswordGenerator() #print 8-letter password containing only big and small letters of alphabet - print passwd_gen.gen_password(8, passwd_gen.ALPHABETS_BIG_SMALL) + passwd_gen.gen_password(8, passwd_gen.ALPHABETS_BIG_SMALL) """ ALPHABETS_NUM = r'''1234567890''' ALPHABETS_SMALL = r'''qwertyuiopasdfghjklzxcvbnm''' diff -r 058fc80b052e -r b8d5a5c9f66d rhodecode/lib/utils2.py --- a/rhodecode/lib/utils2.py Wed May 16 00:06:43 2012 +0200 +++ b/rhodecode/lib/utils2.py Wed May 16 01:25:00 2012 +0200 @@ -215,7 +215,6 @@ try: import chardet encoding = chardet.detect(unicode_)['encoding'] - print encoding if encoding is None: raise UnicodeEncodeError() diff -r 058fc80b052e -r b8d5a5c9f66d rhodecode/lib/vcs/backends/git/changeset.py --- a/rhodecode/lib/vcs/backends/git/changeset.py Wed May 16 00:06:43 2012 +0200 +++ b/rhodecode/lib/vcs/backends/git/changeset.py Wed May 16 01:25:00 2012 +0200 @@ -240,11 +240,11 @@ which is generally not good. Should be replaced with algorithm iterating commits. """ - cmd = 'log --pretty="format: --%%H--" --name-status -p %s -- "%s"' % ( + cmd = 'log --pretty="format: %%H" -s -p %s -- "%s"' % ( self.id, path ) so, se = self.repository.run_git_command(cmd) - ids = re.findall(r'(?:--)(\w{40})(?:--)', so) + ids = re.findall(r'[0-9a-fA-F]{40}', so) return [self.repository.get_changeset(id) for id in ids] def get_file_annotate(self, path): diff -r 058fc80b052e -r b8d5a5c9f66d rhodecode/lib/vcs/backends/hg/changeset.py diff -r 058fc80b052e -r b8d5a5c9f66d rhodecode/lib/vcs/utils/__init__.py --- a/rhodecode/lib/vcs/utils/__init__.py Wed May 16 00:06:43 2012 +0200 +++ b/rhodecode/lib/vcs/utils/__init__.py Wed May 16 01:25:00 2012 +0200 @@ -90,7 +90,6 @@ try: import chardet encoding = chardet.detect(unicode_)['encoding'] - print encoding if encoding is None: raise UnicodeEncodeError() diff -r 058fc80b052e -r b8d5a5c9f66d rhodecode/model/user.py --- a/rhodecode/model/user.py Wed May 16 00:06:43 2012 +0200 +++ b/rhodecode/model/user.py Wed May 16 01:25:00 2012 +0200 @@ -531,7 +531,6 @@ for perm in user_repo_group_perms_from_users_groups: g_k = perm.UsersGroupRepoGroupToPerm.group.group_name - print perm, g_k p = perm.Permission.permission_name cur_perm = user.permissions[GK][g_k] # overwrite permission only if it's greater than permission diff -r 058fc80b052e -r b8d5a5c9f66d rhodecode/tests/functional/test_files.py --- a/rhodecode/tests/functional/test_files.py Wed May 16 00:06:43 2012 +0200 +++ b/rhodecode/tests/functional/test_files.py Wed May 16 01:25:00 2012 +0200 @@ -190,10 +190,11 @@ self.log_user() for arch_ext, info in ARCHIVE_SPECS.items(): + short = '27cd5cce30c9%s' % arch_ext fname = '27cd5cce30c96924232dffcd24178a07ffeb5dfc%s' % arch_ext - filename = '%s-%s' % (HG_REPO, fname) - - response = self.app.get(url(controller='files', action='archivefile', + filename = '%s-%s' % (HG_REPO, short) + response = self.app.get(url(controller='files', + action='archivefile', repo_name=HG_REPO, fname=fname)) @@ -202,7 +203,8 @@ [('Pragma', 'no-cache'), ('Cache-Control', 'no-cache'), ('Content-Type', '%s; charset=utf-8' % info[0]), - ('Content-Disposition', 'attachment; filename=%s' % filename),] + ('Content-Disposition', 'attachment; filename=%s' % filename), + ] ) def test_archival_wrong_ext(self):