# HG changeset patch # User domruf # Date 2016-04-19 19:53:16 # Node ID 8a9d938388829c676ca2378780533b8280630ded # Parent 43d23fa871d8e1bef3467e5991c6726a5a1cf549 vcs: fix repo size calculation tip.walk already 'dives into' the dirs - don't do that twice. diff --git a/kallithea/lib/vcs/backends/base.py b/kallithea/lib/vcs/backends/base.py --- a/kallithea/lib/vcs/backends/base.py +++ b/kallithea/lib/vcs/backends/base.py @@ -123,9 +123,6 @@ class BaseRepository(object): 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 diff --git a/kallithea/tests/vcs/test_git.py b/kallithea/tests/vcs/test_git.py --- a/kallithea/tests/vcs/test_git.py +++ b/kallithea/tests/vcs/test_git.py @@ -390,7 +390,7 @@ class GitChangesetTest(unittest.TestCase 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 diff --git a/kallithea/tests/vcs/test_hg.py b/kallithea/tests/vcs/test_hg.py --- a/kallithea/tests/vcs/test_hg.py +++ b/kallithea/tests/vcs/test_hg.py @@ -354,7 +354,7 @@ class MercurialChangesetTest(unittest.Te 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