Show More
@@ -33,6 +33,33 b' from rhodecode.lib.utils import action_l' | |||
|
33 | 33 | from inspect import isfunction |
|
34 | 34 | |
|
35 | 35 | |
|
36 | def _get_scm_size(alias, root_path): | |
|
37 | ||
|
38 | if not alias.startswith('.'): | |
|
39 | alias += '.' | |
|
40 | ||
|
41 | size_scm, size_root = 0, 0 | |
|
42 | for path, dirs, files in os.walk(root_path): | |
|
43 | if path.find(alias) != -1: | |
|
44 | for f in files: | |
|
45 | try: | |
|
46 | size_scm += os.path.getsize(os.path.join(path, f)) | |
|
47 | except OSError: | |
|
48 | pass | |
|
49 | else: | |
|
50 | for f in files: | |
|
51 | try: | |
|
52 | size_root += os.path.getsize(os.path.join(path, f)) | |
|
53 | except OSError: | |
|
54 | pass | |
|
55 | ||
|
56 | size_scm_f = h.format_byte_size(size_scm) | |
|
57 | size_root_f = h.format_byte_size(size_root) | |
|
58 | size_total_f = h.format_byte_size(size_root + size_scm) | |
|
59 | ||
|
60 | return size_scm_f, size_root_f, size_total_f | |
|
61 | ||
|
62 | ||
|
36 | 63 | def repo_size(ui, repo, hooktype=None, **kwargs): |
|
37 | 64 | """ |
|
38 | 65 | Presents size of repository after push |
@@ -42,24 +69,7 b' def repo_size(ui, repo, hooktype=None, *' | |||
|
42 | 69 | :param hooktype: |
|
43 | 70 | """ |
|
44 | 71 | |
|
45 | size_hg, size_root = 0, 0 | |
|
46 | for path, dirs, files in os.walk(repo.root): | |
|
47 | if path.find('.hg') != -1: | |
|
48 | for f in files: | |
|
49 | try: | |
|
50 | size_hg += os.path.getsize(os.path.join(path, f)) | |
|
51 | except OSError: | |
|
52 | pass | |
|
53 | else: | |
|
54 | for f in files: | |
|
55 | try: | |
|
56 | size_root += os.path.getsize(os.path.join(path, f)) | |
|
57 | except OSError: | |
|
58 | pass | |
|
59 | ||
|
60 | size_hg_f = h.format_byte_size(size_hg) | |
|
61 | size_root_f = h.format_byte_size(size_root) | |
|
62 | size_total_f = h.format_byte_size(size_root + size_hg) | |
|
72 | size_hg_f, size_root_f, size_total_f = _get_scm_size('.hg', repo.root) | |
|
63 | 73 | |
|
64 | 74 | last_cs = repo[len(repo) - 1] |
|
65 | 75 |
General Comments 0
You need to be logged in to leave comments.
Login now