Show More
@@ -25,7 +25,7 b'' | |||
|
25 | 25 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
26 | 26 | import platform |
|
27 | 27 | |
|
28 |
VERSION = (1, 2, |
|
|
28 | VERSION = (1, 2, 4) | |
|
29 | 29 | __version__ = '.'.join((str(each) for each in VERSION[:4])) |
|
30 | 30 | __dbversion__ = 3 #defines current db version for migrations |
|
31 | 31 | __platform__ = platform.system() |
@@ -115,9 +115,11 b' class SummaryController(BaseRepoControll' | |||
|
115 | 115 | ts_max_y = mktime(td.timetuple()) |
|
116 | 116 | |
|
117 | 117 | if dbrepo.enable_statistics: |
|
118 | c.show_stats = True | |
|
118 | 119 | c.no_data_msg = _('No data loaded yet') |
|
119 | 120 | run_task(get_commits_stats, c.dbrepo.repo_name, ts_min_y, ts_max_y) |
|
120 | 121 | else: |
|
122 | c.show_stats = False | |
|
121 | 123 | c.no_data_msg = _('Statistics are disabled for this repository') |
|
122 | 124 | c.ts_min = ts_min_m |
|
123 | 125 | c.ts_max = ts_max_y |
@@ -143,8 +145,8 b' class SummaryController(BaseRepoControll' | |||
|
143 | 145 | key=lambda k: k[1])[:10] |
|
144 | 146 | ) |
|
145 | 147 | ) |
|
146 | last_rev = stats.stat_on_revision | |
|
147 |
c.repo_last_rev = c.rhodecode_repo.count() |
|
|
148 | last_rev = stats.stat_on_revision + 1 | |
|
149 | c.repo_last_rev = c.rhodecode_repo.count()\ | |
|
148 | 150 | if c.rhodecode_repo.revisions else 0 |
|
149 | 151 | if last_rev == 0 or c.repo_last_rev == 0: |
|
150 | 152 | pass |
@@ -100,6 +100,7 b' def get_commits_stats(repo_name, ts_min_' | |||
|
100 | 100 | |
|
101 | 101 | log.info('running task with lockkey %s', lockkey) |
|
102 | 102 | try: |
|
103 | sa = get_session() | |
|
103 | 104 | lock = l = DaemonLock(file_=jn(lockkey_path, lockkey)) |
|
104 | 105 | |
|
105 | 106 | # for js data compatibilty cleans the key for person from ' |
@@ -109,7 +110,7 b' def get_commits_stats(repo_name, ts_min_' | |||
|
109 | 110 | commits_by_day_aggregate = {} |
|
110 | 111 | repos_path = get_repos_path() |
|
111 | 112 | repo = get_repo(safe_str(os.path.join(repos_path, repo_name))) |
|
112 |
repo_size = |
|
|
113 | repo_size = repo.count() | |
|
113 | 114 | #return if repo have no revisions |
|
114 | 115 | if repo_size < 1: |
|
115 | 116 | lock.release() |
@@ -117,12 +118,10 b' def get_commits_stats(repo_name, ts_min_' | |||
|
117 | 118 | |
|
118 | 119 | skip_date_limit = True |
|
119 | 120 | parse_limit = int(config['app_conf'].get('commit_parse_limit')) |
|
120 |
last_rev = |
|
|
121 | last_rev = None | |
|
121 | 122 | last_cs = None |
|
122 | 123 | timegetter = itemgetter('time') |
|
123 | 124 | |
|
124 | sa = get_session() | |
|
125 | ||
|
126 | 125 | dbrepo = sa.query(Repository)\ |
|
127 | 126 | .filter(Repository.repo_name == repo_name).scalar() |
|
128 | 127 | cur_stats = sa.query(Statistics)\ |
@@ -146,8 +145,10 b' def get_commits_stats(repo_name, ts_min_' | |||
|
146 | 145 | log.debug('starting parsing %s', parse_limit) |
|
147 | 146 | lmktime = mktime |
|
148 | 147 | |
|
149 |
last_rev = last_rev + 1 if last_rev > 0 else |
|
|
150 | ||
|
148 | last_rev = last_rev + 1 if last_rev >= 0 else 0 | |
|
149 | log.debug('Getting revisions from %s to %s' % ( | |
|
150 | last_rev, last_rev + parse_limit) | |
|
151 | ) | |
|
151 | 152 | for cs in repo[last_rev:last_rev + parse_limit]: |
|
152 | 153 | last_cs = cs # remember last parsed changeset |
|
153 | 154 | k = lmktime([cs.date.timetuple()[0], cs.date.timetuple()[1], |
@@ -2,6 +2,7 b' from rhodecode.tests import *' | |||
|
2 | 2 | from rhodecode.model.db import Repository |
|
3 | 3 | from rhodecode.lib.utils import invalidate_cache |
|
4 | 4 | |
|
5 | ||
|
5 | 6 | class TestSummaryController(TestController): |
|
6 | 7 | |
|
7 | 8 | def test_index(self): |
@@ -22,23 +23,22 b' class TestSummaryController(TestControll' | |||
|
22 | 23 | #codes stats |
|
23 | 24 | self._enable_stats() |
|
24 | 25 | |
|
25 | ||
|
26 | 26 | invalidate_cache('get_repo_cached_%s' % HG_REPO) |
|
27 | 27 | response = self.app.get(url(controller='summary', action='index', |
|
28 | 28 | repo_name=HG_REPO)) |
|
29 | 29 | |
|
30 | self.assertTrue("""var data = {"py": {"count": 42, "desc": """ | |
|
30 | response.mustcontain( | |
|
31 | """var data = {"py": {"count": 42, "desc": """ | |
|
31 | 32 |
|
|
32 | 33 |
|
|
33 | 34 |
|
|
34 | 35 |
|
|
35 | 36 |
|
|
36 | 37 |
|
|
37 | in response.body) | |
|
38 | ) | |
|
38 | 39 | |
|
39 | 40 | # clone url... |
|
40 |
se |
|
|
41 | ||
|
41 | response.mustcontain("""<input type="text" id="clone_url" readonly="readonly" value="hg clone http://test_admin@localhost:80/%s" size="70"/>""" % HG_REPO) | |
|
42 | 42 | |
|
43 | 43 | def _enable_stats(self): |
|
44 | 44 | r = Repository.get_by_repo_name(HG_REPO) |
General Comments 0
You need to be logged in to leave comments.
Login now