changeset 2279:b8d5a5c9f66d

merge with beta
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 16 May 2012 01:25:00 +0200
parents 058fc80b052e (current diff) 24095abde696 (diff)
children 533a126dc9ab
files rhodecode/controllers/files.py rhodecode/lib/auth.py rhodecode/model/user.py
diffstat 7 files changed, 13 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- 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')
--- 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'''
--- 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()
 
--- 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):
--- 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()
 
--- 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
--- 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):