##// END OF EJS Templates
some small fixes
marcink -
r630:a9e72f71 beta
parent child Browse files
Show More
@@ -28,7 +28,7 b' debug = true'
28 28 threadpool_workers = 5
29 29
30 30 ##max request before thread respawn
31 threadpool_max_requests = 2
31 threadpool_max_requests = 10
32 32
33 33 ##option to use threads of process
34 34 use_threadpool = true
@@ -99,7 +99,7 b' def get_commits_stats(repo_name, ts_min_'
99 99 repo = MercurialRepository(repos_path + repo_name)
100 100
101 101 skip_date_limit = True
102 parse_limit = 350 #limit for single task changeset parsing optimal for
102 parse_limit = 250 #limit for single task changeset parsing optimal for
103 103 last_rev = 0
104 104 last_cs = None
105 105 timegetter = itemgetter('time')
@@ -127,13 +127,15 b' def get_commits_stats(repo_name, ts_min_'
127 127 commits_by_day_author_aggregate = json.loads(cur_stats.commit_activity)
128 128
129 129 log.debug('starting parsing %s', parse_limit)
130 lmktime = mktime
131
130 132 for cnt, rev in enumerate(repo.revisions[last_rev:]):
131 133 last_cs = cs = repo.get_changeset(rev)
132 134 k = '%s-%s-%s' % (cs.date.timetuple()[0], cs.date.timetuple()[1],
133 135 cs.date.timetuple()[2])
134 136 timetupple = [int(x) for x in k.split('-')]
135 137 timetupple.extend([0 for _ in xrange(6)])
136 k = mktime(timetupple)
138 k = lmktime(timetupple)
137 139 if commits_by_day_author_aggregate.has_key(author_key_cleaner(cs.author)):
138 140 try:
139 141 l = [timegetter(x) for x in commits_by_day_author_aggregate\
@@ -186,12 +188,10 b' def get_commits_stats(repo_name, ts_min_'
186 188 if cnt >= parse_limit:
187 189 #don't fetch to much data since we can freeze application
188 190 break
189
190 191 overview_data = []
191 192 for k, v in commits_by_day_aggregate.items():
192 193 overview_data.append([k, v])
193 194 overview_data = sorted(overview_data, key=itemgetter(0))
194
195 195 if not commits_by_day_author_aggregate:
196 196 commits_by_day_author_aggregate[author_key_cleaner(repo.contact)] = {
197 197 "label":author_key_cleaner(repo.contact),
@@ -286,10 +286,9 b' def send_email(recipients, subject, body'
286 286 def create_repo_fork(form_data, cur_user):
287 287 import os
288 288 from rhodecode.model.repo import RepoModel
289 sa = get_session()
290 rm = RepoModel(sa)
291 289
292 rm.create(form_data, cur_user, just_db=True, fork=True)
290 repo_model = RepoModel(get_session())
291 repo_model.create(form_data, cur_user, just_db=True, fork=True)
293 292
294 293 repos_path = get_hg_ui_settings()['paths_root_path'].replace('*', '')
295 294 repo_path = os.path.join(repos_path, form_data['repo_name'])
@@ -299,20 +298,21 b' def create_repo_fork(form_data, cur_user'
299 298
300 299
301 300 def __get_codes_stats(repo_name):
302 LANGUAGES_EXTENSIONS = ['action', 'adp', 'ashx', 'asmx', 'aspx', 'asx', 'axd', 'c',
303 'cfg', 'cfm', 'cpp', 'cs', 'diff', 'do', 'el', 'erl',
304 'h', 'java', 'js', 'jsp', 'jspx', 'lisp',
305 'lua', 'm', 'mako', 'ml', 'pas', 'patch', 'php', 'php3',
306 'php4', 'phtml', 'pm', 'py', 'rb', 'rst', 's', 'sh',
307 'tpl', 'txt', 'vim', 'wss', 'xhtml', 'xml', 'xsl', 'xslt',
308 'yaws']
301 LANGUAGES_EXTENSIONS = ['action', 'adp', 'ashx', 'asmx',
302 'aspx', 'asx', 'axd', 'c', 'cfg', 'cfm', 'cpp', 'cs', 'diff', 'do', 'el',
303 'erl', 'h', 'java', 'js', 'jsp', 'jspx', 'lisp', 'lua', 'm', 'mako', 'ml',
304 'pas', 'patch', 'php', 'php3', 'php4', 'phtml', 'pm', 'py', 'rb', 'rst',
305 's', 'sh', 'tpl', 'txt', 'vim', 'wss', 'xhtml', 'xml', 'xsl', 'xslt', 'yaws']
306
307
309 308 repos_path = get_hg_ui_settings()['paths_root_path'].replace('*', '')
310 309 repo = MercurialRepository(repos_path + repo_name)
311 310 tip = repo.get_changeset()
312 311
313 312 code_stats = {}
314 for topnode, dirs, files in tip.walk('/'):
315 for f in files:
313
314 def aggregate(cs):
315 for f in cs[2]:
316 316 k = f.mimetype
317 317 if f.extension in LANGUAGES_EXTENSIONS:
318 318 if code_stats.has_key(k):
@@ -320,9 +320,10 b' def __get_codes_stats(repo_name):'
320 320 else:
321 321 code_stats[k] = 1
322 322
323 map(aggregate, tip.walk('/'))
324
323 325 return code_stats or {}
324 326
325 327
326 328
327 329
328
General Comments 0
You need to be logged in to leave comments. Login now