Mercurial > kallithea
annotate kallithea/controllers/summary.py @ 4196:06e49be38d78 kallithea-2.2.5-rebrand
Rename rhodecode_repo to db_repo_scm_instance
author | Bradley M. Kuhn <bkuhn@sfconservancy.org> |
---|---|
date | Wed, 02 Jul 2014 19:05:00 -0400 |
parents | 9581233e9275 |
children | d208416c84c6 |
rev | line source |
---|---|
763
0dad296d2a57
extended trending languages to more entries, implemented new faster and "fancy"
Marcin Kuzminski <marcin@python-works.com>
parents:
734
diff
changeset
|
1 # -*- coding: utf-8 -*- |
1206
a671db5bdd58
fixed license issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
2 # This program is free software: you can redistribute it and/or modify |
a671db5bdd58
fixed license issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
3 # it under the terms of the GNU General Public License as published by |
a671db5bdd58
fixed license issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
4 # the Free Software Foundation, either version 3 of the License, or |
a671db5bdd58
fixed license issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
5 # (at your option) any later version. |
1203
6832ef664673
source code cleanup: remove trailing white space, normalize file endings
Marcin Kuzminski <marcin@python-works.com>
parents:
1181
diff
changeset
|
6 # |
252
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
7 # This program is distributed in the hope that it will be useful, |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
10 # GNU General Public License for more details. |
1203
6832ef664673
source code cleanup: remove trailing white space, normalize file endings
Marcin Kuzminski <marcin@python-works.com>
parents:
1181
diff
changeset
|
11 # |
252
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
12 # You should have received a copy of the GNU General Public License |
1206
a671db5bdd58
fixed license issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
13 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
14 """ |
4186
7e5f8c12a3fc
First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4116
diff
changeset
|
15 kallithea.controllers.summary |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
17 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
18 Summary controller for Rhodecode |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
19 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
20 :created_on: Apr 18, 2010 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
21 :author: marcink |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
22 :copyright: (c) 2013 RhodeCode GmbH. |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
23 :license: GPLv3, see LICENSE for more details. |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
24 """ |
763
0dad296d2a57
extended trending languages to more entries, implemented new faster and "fancy"
Marcin Kuzminski <marcin@python-works.com>
parents:
734
diff
changeset
|
25 |
1605
df59c0503636
implements #215 Repository view uses a README (text/markdown + rst)
Marcin Kuzminski <marcin@python-works.com>
parents:
1514
diff
changeset
|
26 import traceback |
810
bd57d1cb9dc3
fixes #62, added option to disable statistics for each repository
Marcin Kuzminski <marcin@python-works.com>
parents:
800
diff
changeset
|
27 import calendar |
bd57d1cb9dc3
fixes #62, added option to disable statistics for each repository
Marcin Kuzminski <marcin@python-works.com>
parents:
800
diff
changeset
|
28 import logging |
2099
e829e8446902
fixes issue #385 clone by ID url was loosing proxy prefix in URL
Marcin Kuzminski <marcin@python-works.com>
parents:
2068
diff
changeset
|
29 import urllib |
810
bd57d1cb9dc3
fixes #62, added option to disable statistics for each repository
Marcin Kuzminski <marcin@python-works.com>
parents:
800
diff
changeset
|
30 from time import mktime |
1605
df59c0503636
implements #215 Repository view uses a README (text/markdown + rst)
Marcin Kuzminski <marcin@python-works.com>
parents:
1514
diff
changeset
|
31 from datetime import timedelta, date |
1652
8384eaabeb19
configurable clone url
Marcin Kuzminski <marcin@python-works.com>
parents:
1607
diff
changeset
|
32 from urlparse import urlparse |
810
bd57d1cb9dc3
fixes #62, added option to disable statistics for each repository
Marcin Kuzminski <marcin@python-works.com>
parents:
800
diff
changeset
|
33 |
1652
8384eaabeb19
configurable clone url
Marcin Kuzminski <marcin@python-works.com>
parents:
1607
diff
changeset
|
34 from pylons import tmpl_context as c, request, url, config |
810
bd57d1cb9dc3
fixes #62, added option to disable statistics for each repository
Marcin Kuzminski <marcin@python-works.com>
parents:
800
diff
changeset
|
35 from pylons.i18n.translation import _ |
3246
b9ba0d4d3abf
implemented #83 show repo size on summary page
Marcin Kuzminski <marcin@python-works.com>
parents:
3048
diff
changeset
|
36 from webob.exc import HTTPBadRequest |
810
bd57d1cb9dc3
fixes #62, added option to disable statistics for each repository
Marcin Kuzminski <marcin@python-works.com>
parents:
800
diff
changeset
|
37 |
1607
e886f91fcb71
Cached readme generation
Marcin Kuzminski <marcin@python-works.com>
parents:
1605
diff
changeset
|
38 from beaker.cache import cache_region, region_invalidate |
e886f91fcb71
Cached readme generation
Marcin Kuzminski <marcin@python-works.com>
parents:
1605
diff
changeset
|
39 |
4186
7e5f8c12a3fc
First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4116
diff
changeset
|
40 from kallithea.lib.compat import product |
7e5f8c12a3fc
First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4116
diff
changeset
|
41 from kallithea.lib.vcs.exceptions import ChangesetError, EmptyRepositoryError, \ |
3246
b9ba0d4d3abf
implemented #83 show repo size on summary page
Marcin Kuzminski <marcin@python-works.com>
parents:
3048
diff
changeset
|
42 NodeDoesNotExistError |
4186
7e5f8c12a3fc
First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4116
diff
changeset
|
43 from kallithea.config.conf import ALL_READMES, ALL_EXTS, LANGUAGES_EXTENSIONS_MAP |
7e5f8c12a3fc
First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4116
diff
changeset
|
44 from kallithea.model.db import Statistics, CacheInvalidation, User |
7e5f8c12a3fc
First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4116
diff
changeset
|
45 from kallithea.lib.utils import jsonify |
7e5f8c12a3fc
First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4116
diff
changeset
|
46 from kallithea.lib.utils2 import safe_unicode, safe_str |
7e5f8c12a3fc
First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4116
diff
changeset
|
47 from kallithea.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator,\ |
3246
b9ba0d4d3abf
implemented #83 show repo size on summary page
Marcin Kuzminski <marcin@python-works.com>
parents:
3048
diff
changeset
|
48 NotAnonymous |
4186
7e5f8c12a3fc
First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4116
diff
changeset
|
49 from kallithea.lib.base import BaseRepoController, render |
7e5f8c12a3fc
First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4116
diff
changeset
|
50 from kallithea.lib.vcs.backends.base import EmptyChangeset |
7e5f8c12a3fc
First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4116
diff
changeset
|
51 from kallithea.lib.markup_renderer import MarkupRenderer |
7e5f8c12a3fc
First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4116
diff
changeset
|
52 from kallithea.lib.celerylib import run_task |
7e5f8c12a3fc
First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4116
diff
changeset
|
53 from kallithea.lib.celerylib.tasks import get_commits_stats |
7e5f8c12a3fc
First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4116
diff
changeset
|
54 from kallithea.lib.compat import json |
7e5f8c12a3fc
First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4116
diff
changeset
|
55 from kallithea.lib.vcs.nodes import FileNode |
7e5f8c12a3fc
First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4116
diff
changeset
|
56 from kallithea.controllers.changelog import _load_changelog_summary |
810
bd57d1cb9dc3
fixes #62, added option to disable statistics for each repository
Marcin Kuzminski <marcin@python-works.com>
parents:
800
diff
changeset
|
57 |
82
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
58 log = logging.getLogger(__name__) |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
59 |
1607
e886f91fcb71
Cached readme generation
Marcin Kuzminski <marcin@python-works.com>
parents:
1605
diff
changeset
|
60 README_FILES = [''.join([x[0][0], x[1][0]]) for x in |
1605
df59c0503636
implements #215 Repository view uses a README (text/markdown + rst)
Marcin Kuzminski <marcin@python-works.com>
parents:
1514
diff
changeset
|
61 sorted(list(product(ALL_READMES, ALL_EXTS)), |
df59c0503636
implements #215 Repository view uses a README (text/markdown + rst)
Marcin Kuzminski <marcin@python-works.com>
parents:
1514
diff
changeset
|
62 key=lambda y:y[0][1] + y[1][1])] |
1212 | 63 |
1807
1635a21485d6
- fixed issue with missing commits on some repos commands
Marcin Kuzminski <marcin@python-works.com>
parents:
1736
diff
changeset
|
64 |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1038
diff
changeset
|
65 class SummaryController(BaseRepoController): |
637
b04d5214fd3c
removed shortlog from main menu, as duplicated functionality of changelog,
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
66 |
3749
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
67 def __before__(self): |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
68 super(SummaryController, self).__before__() |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
69 |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
70 def _get_download_links(self, repo): |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
71 |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
72 download_l = [] |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
73 |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
74 branches_group = ([], _("Branches")) |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
75 tags_group = ([], _("Tags")) |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
76 |
4196
06e49be38d78
Rename rhodecode_repo to db_repo_scm_instance
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4195
diff
changeset
|
77 for name, chs in c.db_repo_scm_instance.branches.items(): |
3749
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
78 #chs = chs.split(':')[-1] |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
79 branches_group[0].append((chs, name),) |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
80 download_l.append(branches_group) |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
81 |
4196
06e49be38d78
Rename rhodecode_repo to db_repo_scm_instance
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4195
diff
changeset
|
82 for name, chs in c.db_repo_scm_instance.tags.items(): |
3749
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
83 #chs = chs.split(':')[-1] |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
84 tags_group[0].append((chs, name),) |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
85 download_l.append(tags_group) |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
86 |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
87 return download_l |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
88 |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
89 def __get_readme_data(self, db_repo): |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
90 repo_name = db_repo.repo_name |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
91 log.debug('Looking for README file') |
3749
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
92 |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
93 @cache_region('long_term') |
3773
8e2cd46f765b
invalidate: encapsulate how key is generated from repo_name and kind
Mads Kiilerich <madski@unity3d.com>
parents:
3772
diff
changeset
|
94 def _get_readme_from_cache(key, kind): |
3749
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
95 readme_data = None |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
96 readme_file = None |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
97 try: |
4089
a5888ca796b5
Fixed spelling of get's to gets
Marcin Kuzminski <marcin@python-works.com>
parents:
3960
diff
changeset
|
98 # gets the landing revision! or tip if fails |
3749
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
99 cs = db_repo.get_landing_changeset() |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
100 if isinstance(cs, EmptyChangeset): |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
101 raise EmptyRepositoryError() |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
102 renderer = MarkupRenderer() |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
103 for f in README_FILES: |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
104 try: |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
105 readme = cs.get_node(f) |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
106 if not isinstance(readme, FileNode): |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
107 continue |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
108 readme_file = f |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
109 log.debug('Found README file `%s` rendering...' % |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
110 readme_file) |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
111 readme_data = renderer.render(readme.content, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
112 filename=f) |
3749
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
113 break |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
114 except NodeDoesNotExistError: |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
115 continue |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
116 except ChangesetError: |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
117 log.error(traceback.format_exc()) |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
118 pass |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
119 except EmptyRepositoryError: |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
120 pass |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
121 except Exception: |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
122 log.error(traceback.format_exc()) |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
123 |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
124 return readme_data, readme_file |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
125 |
3773
8e2cd46f765b
invalidate: encapsulate how key is generated from repo_name and kind
Mads Kiilerich <madski@unity3d.com>
parents:
3772
diff
changeset
|
126 kind = 'README' |
8e2cd46f765b
invalidate: encapsulate how key is generated from repo_name and kind
Mads Kiilerich <madski@unity3d.com>
parents:
3772
diff
changeset
|
127 valid = CacheInvalidation.test_and_set_valid(repo_name, kind) |
3774
60335b702a00
invalidation: don't create CacheInvalidation records on startup
Mads Kiilerich <madski@unity3d.com>
parents:
3773
diff
changeset
|
128 if not valid: |
3773
8e2cd46f765b
invalidate: encapsulate how key is generated from repo_name and kind
Mads Kiilerich <madski@unity3d.com>
parents:
3772
diff
changeset
|
129 region_invalidate(_get_readme_from_cache, None, repo_name, kind) |
8e2cd46f765b
invalidate: encapsulate how key is generated from repo_name and kind
Mads Kiilerich <madski@unity3d.com>
parents:
3772
diff
changeset
|
130 return _get_readme_from_cache(repo_name, kind) |
3749
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
3635
diff
changeset
|
131 |
191
b68b2246e5a6
Authenticated controller with LoginRequired decorator, and cleaned __before__ (used in baseController now). fixed User for clone url with logged in session user.
Marcin Kuzminski <marcin@python-works.com>
parents:
127
diff
changeset
|
132 @LoginRequired() |
318
fdf9f6ee5217
Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
282
diff
changeset
|
133 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', |
637
b04d5214fd3c
removed shortlog from main menu, as duplicated functionality of changelog,
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
134 'repository.admin') |
1171
2ab211e0aecd
changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
1121
diff
changeset
|
135 def index(self, repo_name): |
3764
c7970889c5c0
Removed shortlog aka lightweight changelog.
Marcin Kuzminski <marcin@python-works.com>
parents:
3762
diff
changeset
|
136 _load_changelog_summary() |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
137 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
138 username = '' |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
139 if self.rhodecode_user.username != User.DEFAULT_USER: |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
140 username = safe_str(self.rhodecode_user.username) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
141 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
142 _def_clone_uri = _def_clone_uri_by_id = c.clone_uri_tmpl |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
143 if '{repo}' in _def_clone_uri: |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
144 _def_clone_uri_by_id = _def_clone_uri.replace('{repo}', '_{repoid}') |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
145 elif '{repoid}' in _def_clone_uri: |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
146 _def_clone_uri_by_id = _def_clone_uri.replace('_{repoid}', '{repo}') |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
147 |
4195
9581233e9275
Rename rhodecode_db_repo to db_repo - it stores db repo abstractions
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4187
diff
changeset
|
148 c.clone_repo_url = c.db_repo.clone_url(user=username, |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
149 uri_tmpl=_def_clone_uri) |
4195
9581233e9275
Rename rhodecode_db_repo to db_repo - it stores db repo abstractions
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4187
diff
changeset
|
150 c.clone_repo_url_id = c.db_repo.clone_url(user=username, |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
151 uri_tmpl=_def_clone_uri_by_id) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
152 |
4195
9581233e9275
Rename rhodecode_db_repo to db_repo - it stores db repo abstractions
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4187
diff
changeset
|
153 if c.db_repo.enable_statistics: |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
154 c.show_stats = True |
674
99875a8f2ad1
#49 Enabled anonymous access push and pull commands
Marcin Kuzminski <marcin@python-works.com>
parents:
643
diff
changeset
|
155 else: |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
156 c.show_stats = False |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
157 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
158 stats = self.sa.query(Statistics)\ |
4195
9581233e9275
Rename rhodecode_db_repo to db_repo - it stores db repo abstractions
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4187
diff
changeset
|
159 .filter(Statistics.repository == c.db_repo)\ |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
160 .scalar() |
674
99875a8f2ad1
#49 Enabled anonymous access push and pull commands
Marcin Kuzminski <marcin@python-works.com>
parents:
643
diff
changeset
|
161 |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
162 c.stats_percentage = 0 |
1719
4a28aff31a15
optimized summary page for disabled stats
Marcin Kuzminski <marcin@python-works.com>
parents:
1652
diff
changeset
|
163 |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
164 if stats and stats.languages: |
4195
9581233e9275
Rename rhodecode_db_repo to db_repo - it stores db repo abstractions
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4187
diff
changeset
|
165 c.no_data = False is c.db_repo.enable_statistics |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
166 lang_stats_d = json.loads(stats.languages) |
1719
4a28aff31a15
optimized summary page for disabled stats
Marcin Kuzminski <marcin@python-works.com>
parents:
1652
diff
changeset
|
167 |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
168 lang_stats = ((x, {"count": y, |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
169 "desc": LANGUAGES_EXTENSIONS_MAP.get(x)}) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
170 for x, y in lang_stats_d.items()) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
171 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
172 c.trending_languages = json.dumps( |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
173 sorted(lang_stats, reverse=True, key=lambda k: k[1])[:10] |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
174 ) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
175 else: |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
176 c.no_data = True |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
177 c.trending_languages = json.dumps({}) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
178 |
4195
9581233e9275
Rename rhodecode_db_repo to db_repo - it stores db repo abstractions
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4187
diff
changeset
|
179 c.enable_downloads = c.db_repo.enable_downloads |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
180 c.readme_data, c.readme_file = \ |
4195
9581233e9275
Rename rhodecode_db_repo to db_repo - it stores db repo abstractions
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4187
diff
changeset
|
181 self.__get_readme_data(c.db_repo) |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
182 return render('summary/summary.html') |
2099
e829e8446902
fixes issue #385 clone by ID url was loosing proxy prefix in URL
Marcin Kuzminski <marcin@python-works.com>
parents:
2068
diff
changeset
|
183 |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
184 @LoginRequired() |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
185 @NotAnonymous() |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
186 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
187 'repository.admin') |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
188 @jsonify |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
189 def repo_size(self, repo_name): |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
190 if request.is_xhr: |
4195
9581233e9275
Rename rhodecode_db_repo to db_repo - it stores db repo abstractions
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4187
diff
changeset
|
191 return c.db_repo._repo_size() |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
192 else: |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
193 raise HTTPBadRequest() |
1719
4a28aff31a15
optimized summary page for disabled stats
Marcin Kuzminski <marcin@python-works.com>
parents:
1652
diff
changeset
|
194 |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
195 @LoginRequired() |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
196 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
197 'repository.admin') |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
198 def statistics(self, repo_name): |
4195
9581233e9275
Rename rhodecode_db_repo to db_repo - it stores db repo abstractions
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4187
diff
changeset
|
199 if c.db_repo.enable_statistics: |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
200 c.show_stats = True |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
201 c.no_data_msg = _('No data loaded yet') |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
202 else: |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
203 c.show_stats = False |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
204 c.no_data_msg = _('Statistics are disabled for this repository') |
637
b04d5214fd3c
removed shortlog from main menu, as duplicated functionality of changelog,
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
205 |
937 | 206 td = date.today() + timedelta(days=1) |
207 td_1m = td - timedelta(days=calendar.mdays[td.month]) | |
208 td_1y = td - timedelta(days=365) | |
637
b04d5214fd3c
removed shortlog from main menu, as duplicated functionality of changelog,
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
209 |
937 | 210 ts_min_m = mktime(td_1m.timetuple()) |
211 ts_min_y = mktime(td_1y.timetuple()) | |
212 ts_max_y = mktime(td.timetuple()) | |
493
2256c78afe53
implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents:
486
diff
changeset
|
213 c.ts_min = ts_min_m |
2256c78afe53
implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents:
486
diff
changeset
|
214 c.ts_max = ts_max_y |
637
b04d5214fd3c
removed shortlog from main menu, as duplicated functionality of changelog,
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
215 |
493
2256c78afe53
implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents:
486
diff
changeset
|
216 stats = self.sa.query(Statistics)\ |
4195
9581233e9275
Rename rhodecode_db_repo to db_repo - it stores db repo abstractions
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4187
diff
changeset
|
217 .filter(Statistics.repository == c.db_repo)\ |
493
2256c78afe53
implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents:
486
diff
changeset
|
218 .scalar() |
506
d5efb83590ef
fixed lock decorator bug which didn't release the lock after func execution and rewrote the pidlock a little with Ask Solem suggestions!
Marcin Kuzminski <marcin@python-works.com>
parents:
493
diff
changeset
|
219 if stats and stats.languages: |
4195
9581233e9275
Rename rhodecode_db_repo to db_repo - it stores db repo abstractions
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4187
diff
changeset
|
220 c.no_data = False is c.db_repo.enable_statistics |
1281
0d3706ccf129
small fixes for git support
Marcin Kuzminski <marcin@python-works.com>
parents:
1251
diff
changeset
|
221 lang_stats_d = json.loads(stats.languages) |
493
2256c78afe53
implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents:
486
diff
changeset
|
222 c.commit_data = stats.commit_activity |
2256c78afe53
implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents:
486
diff
changeset
|
223 c.overview_data = stats.commit_activity_combined |
1514
87ec80c280bb
fixed issues with python2.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1499
diff
changeset
|
224 |
1499
182f5bd3b49d
changed list comprehesion into generator
Marcin Kuzminski <marcin@python-works.com>
parents:
1373
diff
changeset
|
225 lang_stats = ((x, {"count": y, |
1249
13b507b73190
fixes issue #166, made clone-uri use the pylons build in url generators, that way it's more safe.
Marcin Kuzminski <marcin@python-works.com>
parents:
1244
diff
changeset
|
226 "desc": LANGUAGES_EXTENSIONS_MAP.get(x)}) |
1499
182f5bd3b49d
changed list comprehesion into generator
Marcin Kuzminski <marcin@python-works.com>
parents:
1373
diff
changeset
|
227 for x, y in lang_stats_d.items()) |
1244
0eceb478c720
fixed issue #165 trending source files are now stored in cache as ext only, and translated to description only when displaying, so future changes of mappings will take affect right away.
Marcin Kuzminski <marcin@python-works.com>
parents:
1212
diff
changeset
|
228 |
1890
a3efaaa6ed4f
fixes issue #271
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
229 c.trending_languages = json.dumps( |
a3efaaa6ed4f
fixes issue #271
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
230 sorted(lang_stats, reverse=True, key=lambda k: k[1])[:10] |
a3efaaa6ed4f
fixes issue #271
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
231 ) |
1807
1635a21485d6
- fixed issue with missing commits on some repos commands
Marcin Kuzminski <marcin@python-works.com>
parents:
1736
diff
changeset
|
232 last_rev = stats.stat_on_revision + 1 |
4196
06e49be38d78
Rename rhodecode_repo to db_repo_scm_instance
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4195
diff
changeset
|
233 c.repo_last_rev = c.db_repo_scm_instance.count()\ |
06e49be38d78
Rename rhodecode_repo to db_repo_scm_instance
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4195
diff
changeset
|
234 if c.db_repo_scm_instance.revisions else 0 |
1181
36b12336cb7f
added percentage of progress of gathered commit activity statistics
Marcin Kuzminski <marcin@python-works.com>
parents:
1171
diff
changeset
|
235 if last_rev == 0 or c.repo_last_rev == 0: |
36b12336cb7f
added percentage of progress of gathered commit activity statistics
Marcin Kuzminski <marcin@python-works.com>
parents:
1171
diff
changeset
|
236 pass |
36b12336cb7f
added percentage of progress of gathered commit activity statistics
Marcin Kuzminski <marcin@python-works.com>
parents:
1171
diff
changeset
|
237 else: |
36b12336cb7f
added percentage of progress of gathered commit activity statistics
Marcin Kuzminski <marcin@python-works.com>
parents:
1171
diff
changeset
|
238 c.stats_percentage = '%.2f' % ((float((last_rev)) / |
36b12336cb7f
added percentage of progress of gathered commit activity statistics
Marcin Kuzminski <marcin@python-works.com>
parents:
1171
diff
changeset
|
239 c.repo_last_rev) * 100) |
493
2256c78afe53
implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents:
486
diff
changeset
|
240 else: |
2256c78afe53
implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents:
486
diff
changeset
|
241 c.commit_data = json.dumps({}) |
1212 | 242 c.overview_data = json.dumps([[ts_min_y, 0], [ts_max_y, 10]]) |
506
d5efb83590ef
fixed lock decorator bug which didn't release the lock after func execution and rewrote the pidlock a little with Ask Solem suggestions!
Marcin Kuzminski <marcin@python-works.com>
parents:
493
diff
changeset
|
243 c.trending_languages = json.dumps({}) |
800
e41aacb6aa18
small fixes for summary graph, added message about no data for the graph, when empty
Marcin Kuzminski <marcin@python-works.com>
parents:
763
diff
changeset
|
244 c.no_data = True |
1514
87ec80c280bb
fixed issues with python2.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1499
diff
changeset
|
245 |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
246 recurse_limit = 500 # don't recurse more than 500 times when parsing |
4195
9581233e9275
Rename rhodecode_db_repo to db_repo - it stores db repo abstractions
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4187
diff
changeset
|
247 run_task(get_commits_stats, c.db_repo.repo_name, ts_min_y, |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
248 ts_max_y, recurse_limit) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
249 return render('summary/statistics.html') |