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