changeset 5808:8a9d93838882 stable

vcs: fix repo size calculation tip.walk already 'dives into' the dirs - don't do that twice.
author domruf <dominikruf@gmail.com>
date Tue, 19 Apr 2016 19:53:16 +0200
parents 43d23fa871d8
children 93b512845dab
files kallithea/lib/vcs/backends/base.py kallithea/tests/vcs/test_git.py kallithea/tests/vcs/test_hg.py
diffstat 3 files changed, 2 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/vcs/backends/base.py	Sun Apr 24 19:29:20 2016 +0200
+++ b/kallithea/lib/vcs/backends/base.py	Tue Apr 19 19:53:16 2016 +0200
@@ -123,9 +123,6 @@
             for topnode, dirs, files in tip.walk('/'):
                 for f in files:
                     size += tip.get_file_size(f.path)
-                for dir in dirs:
-                    for f in files:
-                        size += tip.get_file_size(f.path)
 
         except RepositoryError as e:
             pass
--- a/kallithea/tests/vcs/test_git.py	Sun Apr 24 19:29:20 2016 +0200
+++ b/kallithea/tests/vcs/test_git.py	Tue Apr 19 19:53:16 2016 +0200
@@ -390,7 +390,7 @@
             self._test_dir_size(revision, path, size)
 
     def test_repo_size(self):
-        self.assertEqual(self.repo.size, 1022026) # FIXME
+        self.assertEqual(self.repo.size, 674076)
 
     def test_file_history(self):
         # we can only check if those revisions are present in the history
--- a/kallithea/tests/vcs/test_hg.py	Sun Apr 24 19:29:20 2016 +0200
+++ b/kallithea/tests/vcs/test_hg.py	Tue Apr 19 19:53:16 2016 +0200
@@ -354,7 +354,7 @@
             self._test_dir_size(revision, path, size)
 
     def test_repo_size(self):
-        self.assertEqual(self.repo.size, 1042958) # FIXME
+        self.assertEqual(self.repo.size, 682421)
 
     def test_file_history(self):
         # we can only check if those revisions are present in the history