##// END OF EJS Templates
moved statistics parse_limit into .ini files...
marcink -
r1076:db71228a beta
parent child Browse files
Show More
@@ -1,217 +1,220 b''
1 ################################################################################
1 ################################################################################
2 ################################################################################
2 ################################################################################
3 # RhodeCode - Pylons environment configuration #
3 # RhodeCode - Pylons environment configuration #
4 # #
4 # #
5 # The %(here)s variable will be replaced with the parent directory of this file#
5 # The %(here)s variable will be replaced with the parent directory of this file#
6 ################################################################################
6 ################################################################################
7
7
8 [DEFAULT]
8 [DEFAULT]
9 debug = true
9 debug = true
10 ################################################################################
10 ################################################################################
11 ## Uncomment and replace with the address which should receive ##
11 ## Uncomment and replace with the address which should receive ##
12 ## any error reports after application crash ##
12 ## any error reports after application crash ##
13 ## Additionally those settings will be used by RhodeCode mailing system ##
13 ## Additionally those settings will be used by RhodeCode mailing system ##
14 ################################################################################
14 ################################################################################
15 #email_to = admin@localhost
15 #email_to = admin@localhost
16 #error_email_from = paste_error@localhost
16 #error_email_from = paste_error@localhost
17 #app_email_from = rhodecode-noreply@localhost
17 #app_email_from = rhodecode-noreply@localhost
18 #error_message =
18 #error_message =
19
19
20 #smtp_server = mail.server.com
20 #smtp_server = mail.server.com
21 #smtp_username =
21 #smtp_username =
22 #smtp_password =
22 #smtp_password =
23 #smtp_port =
23 #smtp_port =
24 #smtp_use_tls = false
24 #smtp_use_tls = false
25 #smtp_use_ssl = true
25 #smtp_use_ssl = true
26
26
27 [server:main]
27 [server:main]
28 ##nr of threads to spawn
28 ##nr of threads to spawn
29 threadpool_workers = 5
29 threadpool_workers = 5
30
30
31 ##max request before thread respawn
31 ##max request before thread respawn
32 threadpool_max_requests = 6
32 threadpool_max_requests = 6
33
33
34 ##option to use threads of process
34 ##option to use threads of process
35 use_threadpool = false
35 use_threadpool = false
36
36
37 use = egg:Paste#http
37 use = egg:Paste#http
38 host = 0.0.0.0
38 host = 0.0.0.0
39 port = 5000
39 port = 5000
40
40
41 [app:main]
41 [app:main]
42 use = egg:rhodecode
42 use = egg:rhodecode
43 full_stack = true
43 full_stack = true
44 static_files = true
44 static_files = true
45 lang=en
45 lang=en
46 cache_dir = %(here)s/data
46 cache_dir = %(here)s/data
47 index_dir = %(here)s/data/index
47 index_dir = %(here)s/data/index
48 app_instance_uuid = develop
48 cut_off_limit = 256000
49 cut_off_limit = 256000
49 force_https = false
50 force_https = false
51 commit_parse_limit = 25
50
52
51 ####################################
53 ####################################
52 ### CELERY CONFIG ####
54 ### CELERY CONFIG ####
53 ####################################
55 ####################################
54 use_celery = false
56 use_celery = false
55 broker.host = localhost
57 broker.host = localhost
56 broker.vhost = rabbitmqhost
58 broker.vhost = rabbitmqhost
57 broker.port = 5672
59 broker.port = 5672
58 broker.user = rabbitmq
60 broker.user = rabbitmq
59 broker.password = qweqwe
61 broker.password = qweqwe
60
62
61 celery.imports = rhodecode.lib.celerylib.tasks
63 celery.imports = rhodecode.lib.celerylib.tasks
62
64
63 celery.result.backend = amqp
65 celery.result.backend = amqp
64 celery.result.dburi = amqp://
66 celery.result.dburi = amqp://
65 celery.result.serialier = json
67 celery.result.serialier = json
66
68
67 #celery.send.task.error.emails = true
69 #celery.send.task.error.emails = true
68 #celery.amqp.task.result.expires = 18000
70 #celery.amqp.task.result.expires = 18000
69
71
70 celeryd.concurrency = 2
72 celeryd.concurrency = 2
71 #celeryd.log.file = celeryd.log
73 #celeryd.log.file = celeryd.log
72 celeryd.log.level = debug
74 celeryd.log.level = debug
73 celeryd.max.tasks.per.child = 3
75 celeryd.max.tasks.per.child = 1
74
76
75 #tasks will never be sent to the queue, but executed locally instead.
77 #tasks will never be sent to the queue, but executed locally instead.
76 celery.always.eager = false
78 celery.always.eager = false
77
79
78 ####################################
80 ####################################
79 ### BEAKER CACHE ####
81 ### BEAKER CACHE ####
80 ####################################
82 ####################################
81 beaker.cache.data_dir=/%(here)s/data/cache/data
83 beaker.cache.data_dir=%(here)s/data/cache/data
82 beaker.cache.lock_dir=/%(here)s/data/cache/lock
84 beaker.cache.lock_dir=%(here)s/data/cache/lock
85
83 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
86 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
84
87
85 beaker.cache.super_short_term.type=memory
88 beaker.cache.super_short_term.type=memory
86 beaker.cache.super_short_term.expire=10
89 beaker.cache.super_short_term.expire=10
87
90
88 beaker.cache.short_term.type=memory
91 beaker.cache.short_term.type=memory
89 beaker.cache.short_term.expire=60
92 beaker.cache.short_term.expire=60
90
93
91 beaker.cache.long_term.type=memory
94 beaker.cache.long_term.type=memory
92 beaker.cache.long_term.expire=36000
95 beaker.cache.long_term.expire=36000
93
96
94 beaker.cache.sql_cache_short.type=memory
97 beaker.cache.sql_cache_short.type=memory
95 beaker.cache.sql_cache_short.expire=10
98 beaker.cache.sql_cache_short.expire=10
96
99
97 beaker.cache.sql_cache_med.type=memory
100 beaker.cache.sql_cache_med.type=memory
98 beaker.cache.sql_cache_med.expire=360
101 beaker.cache.sql_cache_med.expire=360
99
102
100 beaker.cache.sql_cache_long.type=file
103 beaker.cache.sql_cache_long.type=file
101 beaker.cache.sql_cache_long.expire=3600
104 beaker.cache.sql_cache_long.expire=3600
102
105
103 ####################################
106 ####################################
104 ### BEAKER SESSION ####
107 ### BEAKER SESSION ####
105 ####################################
108 ####################################
106 ## Type of storage used for the session, current types are
109 ## Type of storage used for the session, current types are
107 ## dbm, file, memcached, database, and memory.
110 ## dbm, file, memcached, database, and memory.
108 ## The storage uses the Container API
111 ## The storage uses the Container API
109 ##that is also used by the cache system.
112 ##that is also used by the cache system.
110 beaker.session.type = file
113 beaker.session.type = file
111
114
112 beaker.session.key = rhodecode
115 beaker.session.key = rhodecode
113 beaker.session.secret = g654dcno0-9873jhgfreyu
116 beaker.session.secret = g654dcno0-9873jhgfreyu
114 beaker.session.timeout = 36000
117 beaker.session.timeout = 36000
115
118
116 ##auto save the session to not to use .save()
119 ##auto save the session to not to use .save()
117 beaker.session.auto = False
120 beaker.session.auto = False
118
121
119 ##true exire at browser close
122 ##true exire at browser close
120 #beaker.session.cookie_expires = 3600
123 #beaker.session.cookie_expires = 3600
121
124
122
125
123 ################################################################################
126 ################################################################################
124 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
127 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
125 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
128 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
126 ## execute malicious code after an exception is raised. ##
129 ## execute malicious code after an exception is raised. ##
127 ################################################################################
130 ################################################################################
128 #set debug = false
131 #set debug = false
129
132
130 ##################################
133 ##################################
131 ### LOGVIEW CONFIG ###
134 ### LOGVIEW CONFIG ###
132 ##################################
135 ##################################
133 logview.sqlalchemy = #faa
136 logview.sqlalchemy = #faa
134 logview.pylons.templating = #bfb
137 logview.pylons.templating = #bfb
135 logview.pylons.util = #eee
138 logview.pylons.util = #eee
136
139
137 #########################################################
140 #########################################################
138 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
141 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
139 #########################################################
142 #########################################################
140 #sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
143 #sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
141 sqlalchemy.db1.url = postgresql://postgres:qwe@localhost/rhodecode
144 sqlalchemy.db1.url = postgresql://postgres:qwe@localhost/rhodecode
142 #sqlalchemy.db1.echo = False
145 #sqlalchemy.db1.echo = False
143 #sqlalchemy.db1.pool_recycle = 3600
146 #sqlalchemy.db1.pool_recycle = 3600
144 sqlalchemy.convert_unicode = true
147 sqlalchemy.convert_unicode = true
145
148
146 ################################
149 ################################
147 ### LOGGING CONFIGURATION ####
150 ### LOGGING CONFIGURATION ####
148 ################################
151 ################################
149 [loggers]
152 [loggers]
150 keys = root, routes, rhodecode, sqlalchemy,beaker,templates
153 keys = root, routes, rhodecode, sqlalchemy,beaker,templates
151
154
152 [handlers]
155 [handlers]
153 keys = console
156 keys = console
154
157
155 [formatters]
158 [formatters]
156 keys = generic,color_formatter
159 keys = generic,color_formatter
157
160
158 #############
161 #############
159 ## LOGGERS ##
162 ## LOGGERS ##
160 #############
163 #############
161 [logger_root]
164 [logger_root]
162 level = NOTSET
165 level = NOTSET
163 handlers = console
166 handlers = console
164
167
165 [logger_routes]
168 [logger_routes]
166 level = DEBUG
169 level = DEBUG
167 handlers = console
170 handlers = console
168 qualname = routes.middleware
171 qualname = routes.middleware
169 # "level = DEBUG" logs the route matched and routing variables.
172 # "level = DEBUG" logs the route matched and routing variables.
170 propagate = 0
173 propagate = 0
171
174
172 [logger_beaker]
175 [logger_beaker]
173 level = ERROR
176 level = ERROR
174 handlers = console
177 handlers = console
175 qualname = beaker.container
178 qualname = beaker.container
176 propagate = 0
179 propagate = 0
177
180
178 [logger_templates]
181 [logger_templates]
179 level = INFO
182 level = INFO
180 handlers = console
183 handlers = console
181 qualname = pylons.templating
184 qualname = pylons.templating
182 propagate = 0
185 propagate = 0
183
186
184 [logger_rhodecode]
187 [logger_rhodecode]
185 level = DEBUG
188 level = DEBUG
186 handlers = console
189 handlers = console
187 qualname = rhodecode
190 qualname = rhodecode
188 propagate = 0
191 propagate = 0
189
192
190 [logger_sqlalchemy]
193 [logger_sqlalchemy]
191 level = ERROR
194 level = ERROR
192 handlers = console
195 handlers = console
193 qualname = sqlalchemy.engine
196 qualname = sqlalchemy.engine
194 propagate = 0
197 propagate = 0
195
198
196 ##############
199 ##############
197 ## HANDLERS ##
200 ## HANDLERS ##
198 ##############
201 ##############
199
202
200 [handler_console]
203 [handler_console]
201 class = StreamHandler
204 class = StreamHandler
202 args = (sys.stderr,)
205 args = (sys.stderr,)
203 level = NOTSET
206 level = NOTSET
204 formatter = color_formatter
207 formatter = color_formatter
205
208
206 ################
209 ################
207 ## FORMATTERS ##
210 ## FORMATTERS ##
208 ################
211 ################
209
212
210 [formatter_generic]
213 [formatter_generic]
211 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
214 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
212 datefmt = %Y-%m-%d %H:%M:%S
215 datefmt = %Y-%m-%d %H:%M:%S
213
216
214 [formatter_color_formatter]
217 [formatter_color_formatter]
215 class=rhodecode.lib.colored_formatter.ColorFormatter
218 class=rhodecode.lib.colored_formatter.ColorFormatter
216 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
219 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
217 datefmt = %Y-%m-%d %H:%M:%S No newline at end of file
220 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,218 +1,219 b''
1 ################################################################################
1 ################################################################################
2 ################################################################################
2 ################################################################################
3 # RhodeCode - Pylons environment configuration #
3 # RhodeCode - Pylons environment configuration #
4 # #
4 # #
5 # The %(here)s variable will be replaced with the parent directory of this file#
5 # The %(here)s variable will be replaced with the parent directory of this file#
6 ################################################################################
6 ################################################################################
7
7
8 [DEFAULT]
8 [DEFAULT]
9 debug = true
9 debug = true
10 ################################################################################
10 ################################################################################
11 ## Uncomment and replace with the address which should receive ##
11 ## Uncomment and replace with the address which should receive ##
12 ## any error reports after application crash ##
12 ## any error reports after application crash ##
13 ## Additionally those settings will be used by RhodeCode mailing system ##
13 ## Additionally those settings will be used by RhodeCode mailing system ##
14 ################################################################################
14 ################################################################################
15 #email_to = admin@localhost
15 #email_to = admin@localhost
16 #error_email_from = paste_error@localhost
16 #error_email_from = paste_error@localhost
17 #app_email_from = rhodecode-noreply@localhost
17 #app_email_from = rhodecode-noreply@localhost
18 #error_message =
18 #error_message =
19
19
20 #smtp_server = mail.server.com
20 #smtp_server = mail.server.com
21 #smtp_username =
21 #smtp_username =
22 #smtp_password =
22 #smtp_password =
23 #smtp_port =
23 #smtp_port =
24 #smtp_use_tls = false
24 #smtp_use_tls = false
25 #smtp_use_ssl = true
25 #smtp_use_ssl = true
26
26
27 [server:main]
27 [server:main]
28 ##nr of threads to spawn
28 ##nr of threads to spawn
29 threadpool_workers = 5
29 threadpool_workers = 5
30
30
31 ##max request before thread respawn
31 ##max request before thread respawn
32 threadpool_max_requests = 2
32 threadpool_max_requests = 2
33
33
34 ##option to use threads of process
34 ##option to use threads of process
35 use_threadpool = true
35 use_threadpool = true
36
36
37 use = egg:Paste#http
37 use = egg:Paste#http
38 host = 127.0.0.1
38 host = 127.0.0.1
39 port = 8001
39 port = 8001
40
40
41 [app:main]
41 [app:main]
42 use = egg:rhodecode
42 use = egg:rhodecode
43 full_stack = true
43 full_stack = true
44 static_files = false
44 static_files = false
45 lang=en
45 lang=en
46 cache_dir = %(here)s/data
46 cache_dir = %(here)s/data
47 index_dir = %(here)s/data/index
47 index_dir = %(here)s/data/index
48 cut_off_limit = 256000
48 cut_off_limit = 256000
49 force_https = false
49 force_https = false
50 commit_parse_limit = 250
50
51
51 ####################################
52 ####################################
52 ### CELERY CONFIG ####
53 ### CELERY CONFIG ####
53 ####################################
54 ####################################
54 use_celery = false
55 use_celery = false
55 broker.host = localhost
56 broker.host = localhost
56 broker.vhost = rabbitmqhost
57 broker.vhost = rabbitmqhost
57 broker.port = 5672
58 broker.port = 5672
58 broker.user = rabbitmq
59 broker.user = rabbitmq
59 broker.password = qweqwe
60 broker.password = qweqwe
60
61
61 celery.imports = rhodecode.lib.celerylib.tasks
62 celery.imports = rhodecode.lib.celerylib.tasks
62
63
63 celery.result.backend = amqp
64 celery.result.backend = amqp
64 celery.result.dburi = amqp://
65 celery.result.dburi = amqp://
65 celery.result.serialier = json
66 celery.result.serialier = json
66
67
67 #celery.send.task.error.emails = true
68 #celery.send.task.error.emails = true
68 #celery.amqp.task.result.expires = 18000
69 #celery.amqp.task.result.expires = 18000
69
70
70 celeryd.concurrency = 2
71 celeryd.concurrency = 2
71 #celeryd.log.file = celeryd.log
72 #celeryd.log.file = celeryd.log
72 celeryd.log.level = debug
73 celeryd.log.level = debug
73 celeryd.max.tasks.per.child = 3
74 celeryd.max.tasks.per.child = 1
74
75
75 #tasks will never be sent to the queue, but executed locally instead.
76 #tasks will never be sent to the queue, but executed locally instead.
76 celery.always.eager = false
77 celery.always.eager = false
77
78
78 ####################################
79 ####################################
79 ### BEAKER CACHE ####
80 ### BEAKER CACHE ####
80 ####################################
81 ####################################
81 beaker.cache.data_dir=%(here)s/data/cache/data
82 beaker.cache.data_dir=%(here)s/data/cache/data
82 beaker.cache.lock_dir=%(here)s/data/cache/lock
83 beaker.cache.lock_dir=%(here)s/data/cache/lock
83
84
84 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
85 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
85
86
86 beaker.cache.super_short_term.type=memory
87 beaker.cache.super_short_term.type=memory
87 beaker.cache.super_short_term.expire=10
88 beaker.cache.super_short_term.expire=10
88
89
89 beaker.cache.short_term.type=memory
90 beaker.cache.short_term.type=memory
90 beaker.cache.short_term.expire=60
91 beaker.cache.short_term.expire=60
91
92
92 beaker.cache.long_term.type=memory
93 beaker.cache.long_term.type=memory
93 beaker.cache.long_term.expire=36000
94 beaker.cache.long_term.expire=36000
94
95
95
96
96 beaker.cache.sql_cache_short.type=memory
97 beaker.cache.sql_cache_short.type=memory
97 beaker.cache.sql_cache_short.expire=10
98 beaker.cache.sql_cache_short.expire=10
98
99
99 beaker.cache.sql_cache_med.type=memory
100 beaker.cache.sql_cache_med.type=memory
100 beaker.cache.sql_cache_med.expire=360
101 beaker.cache.sql_cache_med.expire=360
101
102
102 beaker.cache.sql_cache_long.type=file
103 beaker.cache.sql_cache_long.type=file
103 beaker.cache.sql_cache_long.expire=3600
104 beaker.cache.sql_cache_long.expire=3600
104
105
105 ####################################
106 ####################################
106 ### BEAKER SESSION ####
107 ### BEAKER SESSION ####
107 ####################################
108 ####################################
108 ## Type of storage used for the session, current types are
109 ## Type of storage used for the session, current types are
109 ## dbm, file, memcached, database, and memory.
110 ## dbm, file, memcached, database, and memory.
110 ## The storage uses the Container API
111 ## The storage uses the Container API
111 ##that is also used by the cache system.
112 ##that is also used by the cache system.
112 beaker.session.type = file
113 beaker.session.type = file
113
114
114 beaker.session.key = rhodecode
115 beaker.session.key = rhodecode
115 beaker.session.secret = g654dcno0-9873jhgfreyu
116 beaker.session.secret = g654dcno0-9873jhgfreyu
116 beaker.session.timeout = 36000
117 beaker.session.timeout = 36000
117
118
118 ##auto save the session to not to use .save()
119 ##auto save the session to not to use .save()
119 beaker.session.auto = False
120 beaker.session.auto = False
120
121
121 ##true exire at browser close
122 ##true exire at browser close
122 #beaker.session.cookie_expires = 3600
123 #beaker.session.cookie_expires = 3600
123
124
124
125
125 ################################################################################
126 ################################################################################
126 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
127 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
127 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
128 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
128 ## execute malicious code after an exception is raised. ##
129 ## execute malicious code after an exception is raised. ##
129 ################################################################################
130 ################################################################################
130 set debug = false
131 set debug = false
131
132
132 ##################################
133 ##################################
133 ### LOGVIEW CONFIG ###
134 ### LOGVIEW CONFIG ###
134 ##################################
135 ##################################
135 logview.sqlalchemy = #faa
136 logview.sqlalchemy = #faa
136 logview.pylons.templating = #bfb
137 logview.pylons.templating = #bfb
137 logview.pylons.util = #eee
138 logview.pylons.util = #eee
138
139
139 #########################################################
140 #########################################################
140 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
141 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
141 #########################################################
142 #########################################################
142 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
143 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
143 #sqlalchemy.db1.echo = False
144 #sqlalchemy.db1.echo = False
144 #sqlalchemy.db1.pool_recycle = 3600
145 #sqlalchemy.db1.pool_recycle = 3600
145 sqlalchemy.convert_unicode = true
146 sqlalchemy.convert_unicode = true
146
147
147 ################################
148 ################################
148 ### LOGGING CONFIGURATION ####
149 ### LOGGING CONFIGURATION ####
149 ################################
150 ################################
150 [loggers]
151 [loggers]
151 keys = root, routes, rhodecode, sqlalchemy,beaker,templates
152 keys = root, routes, rhodecode, sqlalchemy,beaker,templates
152
153
153 [handlers]
154 [handlers]
154 keys = console
155 keys = console
155
156
156 [formatters]
157 [formatters]
157 keys = generic,color_formatter
158 keys = generic,color_formatter
158
159
159 #############
160 #############
160 ## LOGGERS ##
161 ## LOGGERS ##
161 #############
162 #############
162 [logger_root]
163 [logger_root]
163 level = INFO
164 level = INFO
164 handlers = console
165 handlers = console
165
166
166 [logger_routes]
167 [logger_routes]
167 level = INFO
168 level = INFO
168 handlers = console
169 handlers = console
169 qualname = routes.middleware
170 qualname = routes.middleware
170 # "level = DEBUG" logs the route matched and routing variables.
171 # "level = DEBUG" logs the route matched and routing variables.
171 propagate = 0
172 propagate = 0
172
173
173 [logger_beaker]
174 [logger_beaker]
174 level = ERROR
175 level = ERROR
175 handlers = console
176 handlers = console
176 qualname = beaker.container
177 qualname = beaker.container
177 propagate = 0
178 propagate = 0
178
179
179 [logger_templates]
180 [logger_templates]
180 level = INFO
181 level = INFO
181 handlers = console
182 handlers = console
182 qualname = pylons.templating
183 qualname = pylons.templating
183 propagate = 0
184 propagate = 0
184
185
185 [logger_rhodecode]
186 [logger_rhodecode]
186 level = DEBUG
187 level = DEBUG
187 handlers = console
188 handlers = console
188 qualname = rhodecode
189 qualname = rhodecode
189 propagate = 0
190 propagate = 0
190
191
191 [logger_sqlalchemy]
192 [logger_sqlalchemy]
192 level = ERROR
193 level = ERROR
193 handlers = console
194 handlers = console
194 qualname = sqlalchemy.engine
195 qualname = sqlalchemy.engine
195 propagate = 0
196 propagate = 0
196
197
197 ##############
198 ##############
198 ## HANDLERS ##
199 ## HANDLERS ##
199 ##############
200 ##############
200
201
201 [handler_console]
202 [handler_console]
202 class = StreamHandler
203 class = StreamHandler
203 args = (sys.stderr,)
204 args = (sys.stderr,)
204 level = NOTSET
205 level = NOTSET
205 formatter = color_formatter
206 formatter = color_formatter
206
207
207 ################
208 ################
208 ## FORMATTERS ##
209 ## FORMATTERS ##
209 ################
210 ################
210
211
211 [formatter_generic]
212 [formatter_generic]
212 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
213 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
213 datefmt = %Y-%m-%d %H:%M:%S
214 datefmt = %Y-%m-%d %H:%M:%S
214
215
215 [formatter_color_formatter]
216 [formatter_color_formatter]
216 class=rhodecode.lib.colored_formatter.ColorFormatter
217 class=rhodecode.lib.colored_formatter.ColorFormatter
217 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
218 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
218 datefmt = %Y-%m-%d %H:%M:%S No newline at end of file
219 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,218 +1,219 b''
1 ################################################################################
1 ################################################################################
2 ################################################################################
2 ################################################################################
3 # RhodeCode - Pylons environment configuration #
3 # RhodeCode - Pylons environment configuration #
4 # #
4 # #
5 # The %(here)s variable will be replaced with the parent directory of this file#
5 # The %(here)s variable will be replaced with the parent directory of this file#
6 ################################################################################
6 ################################################################################
7
7
8 [DEFAULT]
8 [DEFAULT]
9 debug = true
9 debug = true
10 ################################################################################
10 ################################################################################
11 ## Uncomment and replace with the address which should receive ##
11 ## Uncomment and replace with the address which should receive ##
12 ## any error reports after application crash ##
12 ## any error reports after application crash ##
13 ## Additionally those settings will be used by RhodeCode mailing system ##
13 ## Additionally those settings will be used by RhodeCode mailing system ##
14 ################################################################################
14 ################################################################################
15 #email_to = admin@localhost
15 #email_to = admin@localhost
16 #error_email_from = paste_error@localhost
16 #error_email_from = paste_error@localhost
17 #app_email_from = rhodecode-noreply@localhost
17 #app_email_from = rhodecode-noreply@localhost
18 #error_message =
18 #error_message =
19
19
20 #smtp_server = mail.server.com
20 #smtp_server = mail.server.com
21 #smtp_username =
21 #smtp_username =
22 #smtp_password =
22 #smtp_password =
23 #smtp_port =
23 #smtp_port =
24 #smtp_use_tls = false
24 #smtp_use_tls = false
25 #smtp_use_ssl = true
25 #smtp_use_ssl = true
26
26
27 [server:main]
27 [server:main]
28 ##nr of threads to spawn
28 ##nr of threads to spawn
29 threadpool_workers = 5
29 threadpool_workers = 5
30
30
31 ##max request before thread respawn
31 ##max request before thread respawn
32 threadpool_max_requests = 10
32 threadpool_max_requests = 10
33
33
34 ##option to use threads of process
34 ##option to use threads of process
35 use_threadpool = true
35 use_threadpool = true
36
36
37 use = egg:Paste#http
37 use = egg:Paste#http
38 host = 127.0.0.1
38 host = 127.0.0.1
39 port = 5000
39 port = 5000
40
40
41 [app:main]
41 [app:main]
42 use = egg:rhodecode
42 use = egg:rhodecode
43 full_stack = true
43 full_stack = true
44 static_files = true
44 static_files = true
45 lang=en
45 lang=en
46 cache_dir = %(here)s/data
46 cache_dir = %(here)s/data
47 index_dir = %(here)s/data/index
47 index_dir = %(here)s/data/index
48 app_instance_uuid = ${app_instance_uuid}
48 app_instance_uuid = ${app_instance_uuid}
49 cut_off_limit = 256000
49 cut_off_limit = 256000
50 force_https = false
50 force_https = false
51 commit_parse_limit = 50
51
52
52 ####################################
53 ####################################
53 ### CELERY CONFIG ####
54 ### CELERY CONFIG ####
54 ####################################
55 ####################################
55 use_celery = false
56 use_celery = false
56 broker.host = localhost
57 broker.host = localhost
57 broker.vhost = rabbitmqhost
58 broker.vhost = rabbitmqhost
58 broker.port = 5672
59 broker.port = 5672
59 broker.user = rabbitmq
60 broker.user = rabbitmq
60 broker.password = qweqwe
61 broker.password = qweqwe
61
62
62 celery.imports = rhodecode.lib.celerylib.tasks
63 celery.imports = rhodecode.lib.celerylib.tasks
63
64
64 celery.result.backend = amqp
65 celery.result.backend = amqp
65 celery.result.dburi = amqp://
66 celery.result.dburi = amqp://
66 celery.result.serialier = json
67 celery.result.serialier = json
67
68
68 #celery.send.task.error.emails = true
69 #celery.send.task.error.emails = true
69 #celery.amqp.task.result.expires = 18000
70 #celery.amqp.task.result.expires = 18000
70
71
71 celeryd.concurrency = 2
72 celeryd.concurrency = 2
72 #celeryd.log.file = celeryd.log
73 #celeryd.log.file = celeryd.log
73 celeryd.log.level = debug
74 celeryd.log.level = debug
74 celeryd.max.tasks.per.child = 3
75 celeryd.max.tasks.per.child = 1
75
76
76 #tasks will never be sent to the queue, but executed locally instead.
77 #tasks will never be sent to the queue, but executed locally instead.
77 celery.always.eager = false
78 celery.always.eager = false
78
79
79 ####################################
80 ####################################
80 ### BEAKER CACHE ####
81 ### BEAKER CACHE ####
81 ####################################
82 ####################################
82 beaker.cache.data_dir=%(here)s/data/cache/data
83 beaker.cache.data_dir=%(here)s/data/cache/data
83 beaker.cache.lock_dir=%(here)s/data/cache/lock
84 beaker.cache.lock_dir=%(here)s/data/cache/lock
84
85
85 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
86 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
86
87
87 beaker.cache.super_short_term.type=memory
88 beaker.cache.super_short_term.type=memory
88 beaker.cache.super_short_term.expire=10
89 beaker.cache.super_short_term.expire=10
89
90
90 beaker.cache.short_term.type=memory
91 beaker.cache.short_term.type=memory
91 beaker.cache.short_term.expire=60
92 beaker.cache.short_term.expire=60
92
93
93 beaker.cache.long_term.type=memory
94 beaker.cache.long_term.type=memory
94 beaker.cache.long_term.expire=36000
95 beaker.cache.long_term.expire=36000
95
96
96 beaker.cache.sql_cache_short.type=memory
97 beaker.cache.sql_cache_short.type=memory
97 beaker.cache.sql_cache_short.expire=10
98 beaker.cache.sql_cache_short.expire=10
98
99
99 beaker.cache.sql_cache_med.type=memory
100 beaker.cache.sql_cache_med.type=memory
100 beaker.cache.sql_cache_med.expire=360
101 beaker.cache.sql_cache_med.expire=360
101
102
102 beaker.cache.sql_cache_long.type=file
103 beaker.cache.sql_cache_long.type=file
103 beaker.cache.sql_cache_long.expire=3600
104 beaker.cache.sql_cache_long.expire=3600
104
105
105 ####################################
106 ####################################
106 ### BEAKER SESSION ####
107 ### BEAKER SESSION ####
107 ####################################
108 ####################################
108 ## Type of storage used for the session, current types are
109 ## Type of storage used for the session, current types are
109 ## dbm, file, memcached, database, and memory.
110 ## dbm, file, memcached, database, and memory.
110 ## The storage uses the Container API
111 ## The storage uses the Container API
111 ##that is also used by the cache system.
112 ##that is also used by the cache system.
112 beaker.session.type = file
113 beaker.session.type = file
113
114
114 beaker.session.key = rhodecode
115 beaker.session.key = rhodecode
115 beaker.session.secret = ${app_instance_secret}
116 beaker.session.secret = ${app_instance_secret}
116 beaker.session.timeout = 36000
117 beaker.session.timeout = 36000
117
118
118 ##auto save the session to not to use .save()
119 ##auto save the session to not to use .save()
119 beaker.session.auto = False
120 beaker.session.auto = False
120
121
121 ##true exire at browser close
122 ##true exire at browser close
122 #beaker.session.cookie_expires = 3600
123 #beaker.session.cookie_expires = 3600
123
124
124
125
125 ################################################################################
126 ################################################################################
126 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
127 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
127 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
128 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
128 ## execute malicious code after an exception is raised. ##
129 ## execute malicious code after an exception is raised. ##
129 ################################################################################
130 ################################################################################
130 set debug = false
131 set debug = false
131
132
132 ##################################
133 ##################################
133 ### LOGVIEW CONFIG ###
134 ### LOGVIEW CONFIG ###
134 ##################################
135 ##################################
135 logview.sqlalchemy = #faa
136 logview.sqlalchemy = #faa
136 logview.pylons.templating = #bfb
137 logview.pylons.templating = #bfb
137 logview.pylons.util = #eee
138 logview.pylons.util = #eee
138
139
139 #########################################################
140 #########################################################
140 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
141 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
141 #########################################################
142 #########################################################
142 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
143 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
143 #sqlalchemy.db1.echo = False
144 #sqlalchemy.db1.echo = False
144 #sqlalchemy.db1.pool_recycle = 3600
145 #sqlalchemy.db1.pool_recycle = 3600
145 sqlalchemy.convert_unicode = true
146 sqlalchemy.convert_unicode = true
146
147
147 ################################
148 ################################
148 ### LOGGING CONFIGURATION ####
149 ### LOGGING CONFIGURATION ####
149 ################################
150 ################################
150 [loggers]
151 [loggers]
151 keys = root, routes, rhodecode, sqlalchemy,beaker,templates
152 keys = root, routes, rhodecode, sqlalchemy,beaker,templates
152
153
153 [handlers]
154 [handlers]
154 keys = console
155 keys = console
155
156
156 [formatters]
157 [formatters]
157 keys = generic,color_formatter
158 keys = generic,color_formatter
158
159
159 #############
160 #############
160 ## LOGGERS ##
161 ## LOGGERS ##
161 #############
162 #############
162 [logger_root]
163 [logger_root]
163 level = INFO
164 level = INFO
164 handlers = console
165 handlers = console
165
166
166 [logger_routes]
167 [logger_routes]
167 level = INFO
168 level = INFO
168 handlers = console
169 handlers = console
169 qualname = routes.middleware
170 qualname = routes.middleware
170 # "level = DEBUG" logs the route matched and routing variables.
171 # "level = DEBUG" logs the route matched and routing variables.
171 propagate = 0
172 propagate = 0
172
173
173 [logger_beaker]
174 [logger_beaker]
174 level = ERROR
175 level = ERROR
175 handlers = console
176 handlers = console
176 qualname = beaker.container
177 qualname = beaker.container
177 propagate = 0
178 propagate = 0
178
179
179 [logger_templates]
180 [logger_templates]
180 level = INFO
181 level = INFO
181 handlers = console
182 handlers = console
182 qualname = pylons.templating
183 qualname = pylons.templating
183 propagate = 0
184 propagate = 0
184
185
185 [logger_rhodecode]
186 [logger_rhodecode]
186 level = DEBUG
187 level = DEBUG
187 handlers = console
188 handlers = console
188 qualname = rhodecode
189 qualname = rhodecode
189 propagate = 0
190 propagate = 0
190
191
191 [logger_sqlalchemy]
192 [logger_sqlalchemy]
192 level = ERROR
193 level = ERROR
193 handlers = console
194 handlers = console
194 qualname = sqlalchemy.engine
195 qualname = sqlalchemy.engine
195 propagate = 0
196 propagate = 0
196
197
197 ##############
198 ##############
198 ## HANDLERS ##
199 ## HANDLERS ##
199 ##############
200 ##############
200
201
201 [handler_console]
202 [handler_console]
202 class = StreamHandler
203 class = StreamHandler
203 args = (sys.stderr,)
204 args = (sys.stderr,)
204 level = NOTSET
205 level = NOTSET
205 formatter = color_formatter
206 formatter = color_formatter
206
207
207 ################
208 ################
208 ## FORMATTERS ##
209 ## FORMATTERS ##
209 ################
210 ################
210
211
211 [formatter_generic]
212 [formatter_generic]
212 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
213 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
213 datefmt = %Y-%m-%d %H:%M:%S
214 datefmt = %Y-%m-%d %H:%M:%S
214
215
215 [formatter_color_formatter]
216 [formatter_color_formatter]
216 class=rhodecode.lib.colored_formatter.ColorFormatter
217 class=rhodecode.lib.colored_formatter.ColorFormatter
217 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
218 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
218 datefmt = %Y-%m-%d %H:%M:%S No newline at end of file
219 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,405 +1,405 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """
2 """
3 rhodecode.lib.celerylib.tasks
3 rhodecode.lib.celerylib.tasks
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5
5
6 RhodeCode task modules, containing all task that suppose to be run
6 RhodeCode task modules, containing all task that suppose to be run
7 by celery daemon
7 by celery daemon
8
8
9 :created_on: Oct 6, 2010
9 :created_on: Oct 6, 2010
10 :author: marcink
10 :author: marcink
11 :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>
11 :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>
12 :license: GPLv3, see COPYING for more details.
12 :license: GPLv3, see COPYING for more details.
13 """
13 """
14 # This program is free software; you can redistribute it and/or
14 # This program is free software; you can redistribute it and/or
15 # modify it under the terms of the GNU General Public License
15 # modify it under the terms of the GNU General Public License
16 # as published by the Free Software Foundation; version 2
16 # as published by the Free Software Foundation; version 2
17 # of the License or (at your opinion) any later version of the license.
17 # of the License or (at your opinion) any later version of the license.
18 #
18 #
19 # This program is distributed in the hope that it will be useful,
19 # This program is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU General Public License for more details.
22 # GNU General Public License for more details.
23 #
23 #
24 # You should have received a copy of the GNU General Public License
24 # You should have received a copy of the GNU General Public License
25 # along with this program; if not, write to the Free Software
25 # along with this program; if not, write to the Free Software
26 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
26 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
27 # MA 02110-1301, USA.
27 # MA 02110-1301, USA.
28 from celery.decorators import task
28 from celery.decorators import task
29
29
30 import os
30 import os
31 import traceback
31 import traceback
32 import logging
32 import logging
33
33
34 from time import mktime
34 from time import mktime
35 from operator import itemgetter
35 from operator import itemgetter
36
36
37 from pylons import config
37 from pylons import config
38 from pylons.i18n.translation import _
38 from pylons.i18n.translation import _
39
39
40 from rhodecode.lib.celerylib import run_task, locked_task, str2bool
40 from rhodecode.lib.celerylib import run_task, locked_task, str2bool
41 from rhodecode.lib.helpers import person
41 from rhodecode.lib.helpers import person
42 from rhodecode.lib.smtp_mailer import SmtpMailer
42 from rhodecode.lib.smtp_mailer import SmtpMailer
43 from rhodecode.lib.utils import OrderedDict, add_cache
43 from rhodecode.lib.utils import OrderedDict, add_cache
44 from rhodecode.model import init_model
44 from rhodecode.model import init_model
45 from rhodecode.model import meta
45 from rhodecode.model import meta
46 from rhodecode.model.db import RhodeCodeUi
46 from rhodecode.model.db import RhodeCodeUi
47
47
48 from vcs.backends import get_repo
48 from vcs.backends import get_repo
49
49
50 from sqlalchemy import engine_from_config
50 from sqlalchemy import engine_from_config
51
51
52 add_cache(config)
52 add_cache(config)
53
53
54 try:
54 try:
55 import json
55 import json
56 except ImportError:
56 except ImportError:
57 #python 2.5 compatibility
57 #python 2.5 compatibility
58 import simplejson as json
58 import simplejson as json
59
59
60 __all__ = ['whoosh_index', 'get_commits_stats',
60 __all__ = ['whoosh_index', 'get_commits_stats',
61 'reset_user_password', 'send_email']
61 'reset_user_password', 'send_email']
62
62
63 CELERY_ON = str2bool(config['app_conf'].get('use_celery'))
63 CELERY_ON = str2bool(config['app_conf'].get('use_celery'))
64
64
65 def get_session():
65 def get_session():
66 if CELERY_ON:
66 if CELERY_ON:
67 engine = engine_from_config(config, 'sqlalchemy.db1.')
67 engine = engine_from_config(config, 'sqlalchemy.db1.')
68 init_model(engine)
68 init_model(engine)
69 sa = meta.Session()
69 sa = meta.Session()
70 return sa
70 return sa
71
71
72 def get_repos_path():
72 def get_repos_path():
73 sa = get_session()
73 sa = get_session()
74 q = sa.query(RhodeCodeUi).filter(RhodeCodeUi.ui_key == '/').one()
74 q = sa.query(RhodeCodeUi).filter(RhodeCodeUi.ui_key == '/').one()
75 return q.ui_value
75 return q.ui_value
76
76
77 @task(ignore_result=True)
77 @task(ignore_result=True)
78 @locked_task
78 @locked_task
79 def whoosh_index(repo_location, full_index):
79 def whoosh_index(repo_location, full_index):
80 #log = whoosh_index.get_logger()
80 #log = whoosh_index.get_logger()
81 from rhodecode.lib.indexers.daemon import WhooshIndexingDaemon
81 from rhodecode.lib.indexers.daemon import WhooshIndexingDaemon
82 index_location = config['index_dir']
82 index_location = config['index_dir']
83 WhooshIndexingDaemon(index_location=index_location,
83 WhooshIndexingDaemon(index_location=index_location,
84 repo_location=repo_location, sa=get_session())\
84 repo_location=repo_location, sa=get_session())\
85 .run(full_index=full_index)
85 .run(full_index=full_index)
86
86
87 @task(ignore_result=True)
87 @task(ignore_result=True)
88 @locked_task
88 @locked_task
89 def get_commits_stats(repo_name, ts_min_y, ts_max_y):
89 def get_commits_stats(repo_name, ts_min_y, ts_max_y):
90 try:
90 try:
91 log = get_commits_stats.get_logger()
91 log = get_commits_stats.get_logger()
92 except:
92 except:
93 log = logging.getLogger(__name__)
93 log = logging.getLogger(__name__)
94
94
95 from rhodecode.model.db import Statistics, Repository
95 from rhodecode.model.db import Statistics, Repository
96
96
97 #for js data compatibilty
97 #for js data compatibilty
98 author_key_cleaner = lambda k: person(k).replace('"', "")
98 author_key_cleaner = lambda k: person(k).replace('"', "")
99
99
100 commits_by_day_author_aggregate = {}
100 commits_by_day_author_aggregate = {}
101 commits_by_day_aggregate = {}
101 commits_by_day_aggregate = {}
102 repos_path = get_repos_path()
102 repos_path = get_repos_path()
103 p = os.path.join(repos_path, repo_name)
103 p = os.path.join(repos_path, repo_name)
104 repo = get_repo(p)
104 repo = get_repo(p)
105
105
106 skip_date_limit = True
106 skip_date_limit = True
107 parse_limit = 250 #limit for single task changeset parsing optimal for
107 parse_limit = int(config['app_conf'].get('commit_parse_limit'))
108 last_rev = 0
108 last_rev = 0
109 last_cs = None
109 last_cs = None
110 timegetter = itemgetter('time')
110 timegetter = itemgetter('time')
111
111
112 sa = get_session()
112 sa = get_session()
113
113
114 dbrepo = sa.query(Repository)\
114 dbrepo = sa.query(Repository)\
115 .filter(Repository.repo_name == repo_name).scalar()
115 .filter(Repository.repo_name == repo_name).scalar()
116 cur_stats = sa.query(Statistics)\
116 cur_stats = sa.query(Statistics)\
117 .filter(Statistics.repository == dbrepo).scalar()
117 .filter(Statistics.repository == dbrepo).scalar()
118 if cur_stats:
118 if cur_stats:
119 last_rev = cur_stats.stat_on_revision
119 last_rev = cur_stats.stat_on_revision
120 if not repo.revisions:
120 if not repo.revisions:
121 return True
121 return True
122
122
123 if last_rev == repo.revisions[-1] and len(repo.revisions) > 1:
123 if last_rev == repo.revisions[-1] and len(repo.revisions) > 1:
124 #pass silently without any work if we're not on first revision or
124 #pass silently without any work if we're not on first revision or
125 #current state of parsing revision(from db marker) is the last revision
125 #current state of parsing revision(from db marker) is the last revision
126 return True
126 return True
127
127
128 if cur_stats:
128 if cur_stats:
129 commits_by_day_aggregate = OrderedDict(
129 commits_by_day_aggregate = OrderedDict(
130 json.loads(
130 json.loads(
131 cur_stats.commit_activity_combined))
131 cur_stats.commit_activity_combined))
132 commits_by_day_author_aggregate = json.loads(cur_stats.commit_activity)
132 commits_by_day_author_aggregate = json.loads(cur_stats.commit_activity)
133
133
134 log.debug('starting parsing %s', parse_limit)
134 log.debug('starting parsing %s', parse_limit)
135 lmktime = mktime
135 lmktime = mktime
136
136
137 last_rev = last_rev + 1 if last_rev > 0 else last_rev
137 last_rev = last_rev + 1 if last_rev > 0 else last_rev
138 for rev in repo.revisions[last_rev:last_rev + parse_limit]:
138
139 last_cs = cs = repo.get_changeset(rev)
139 for cs in repo[last_rev:last_rev + parse_limit]:
140 last_cs = cs #remember last parsed changeset
140 k = lmktime([cs.date.timetuple()[0], cs.date.timetuple()[1],
141 k = lmktime([cs.date.timetuple()[0], cs.date.timetuple()[1],
141 cs.date.timetuple()[2], 0, 0, 0, 0, 0, 0])
142 cs.date.timetuple()[2], 0, 0, 0, 0, 0, 0])
142
143
143 if commits_by_day_author_aggregate.has_key(author_key_cleaner(cs.author)):
144 if commits_by_day_author_aggregate.has_key(author_key_cleaner(cs.author)):
144 try:
145 try:
145 l = [timegetter(x) for x in commits_by_day_author_aggregate\
146 l = [timegetter(x) for x in commits_by_day_author_aggregate\
146 [author_key_cleaner(cs.author)]['data']]
147 [author_key_cleaner(cs.author)]['data']]
147 time_pos = l.index(k)
148 time_pos = l.index(k)
148 except ValueError:
149 except ValueError:
149 time_pos = False
150 time_pos = False
150
151
151 if time_pos >= 0 and time_pos is not False:
152 if time_pos >= 0 and time_pos is not False:
152
153
153 datadict = commits_by_day_author_aggregate\
154 datadict = commits_by_day_author_aggregate\
154 [author_key_cleaner(cs.author)]['data'][time_pos]
155 [author_key_cleaner(cs.author)]['data'][time_pos]
155
156
156 datadict["commits"] += 1
157 datadict["commits"] += 1
157 datadict["added"] += len(cs.added)
158 datadict["added"] += len(cs.added)
158 datadict["changed"] += len(cs.changed)
159 datadict["changed"] += len(cs.changed)
159 datadict["removed"] += len(cs.removed)
160 datadict["removed"] += len(cs.removed)
160
161
161 else:
162 else:
162 if k >= ts_min_y and k <= ts_max_y or skip_date_limit:
163 if k >= ts_min_y and k <= ts_max_y or skip_date_limit:
163
164
164 datadict = {"time":k,
165 datadict = {"time":k,
165 "commits":1,
166 "commits":1,
166 "added":len(cs.added),
167 "added":len(cs.added),
167 "changed":len(cs.changed),
168 "changed":len(cs.changed),
168 "removed":len(cs.removed),
169 "removed":len(cs.removed),
169 }
170 }
170 commits_by_day_author_aggregate\
171 commits_by_day_author_aggregate\
171 [author_key_cleaner(cs.author)]['data'].append(datadict)
172 [author_key_cleaner(cs.author)]['data'].append(datadict)
172
173
173 else:
174 else:
174 if k >= ts_min_y and k <= ts_max_y or skip_date_limit:
175 if k >= ts_min_y and k <= ts_max_y or skip_date_limit:
175 commits_by_day_author_aggregate[author_key_cleaner(cs.author)] = {
176 commits_by_day_author_aggregate[author_key_cleaner(cs.author)] = {
176 "label":author_key_cleaner(cs.author),
177 "label":author_key_cleaner(cs.author),
177 "data":[{"time":k,
178 "data":[{"time":k,
178 "commits":1,
179 "commits":1,
179 "added":len(cs.added),
180 "added":len(cs.added),
180 "changed":len(cs.changed),
181 "changed":len(cs.changed),
181 "removed":len(cs.removed),
182 "removed":len(cs.removed),
182 }],
183 }],
183 "schema":["commits"],
184 "schema":["commits"],
184 }
185 }
185
186
186 #gather all data by day
187 #gather all data by day
187 if commits_by_day_aggregate.has_key(k):
188 if commits_by_day_aggregate.has_key(k):
188 commits_by_day_aggregate[k] += 1
189 commits_by_day_aggregate[k] += 1
189 else:
190 else:
190 commits_by_day_aggregate[k] = 1
191 commits_by_day_aggregate[k] = 1
191
192
192 overview_data = sorted(commits_by_day_aggregate.items(), key=itemgetter(0))
193 overview_data = sorted(commits_by_day_aggregate.items(), key=itemgetter(0))
193 if not commits_by_day_author_aggregate:
194 if not commits_by_day_author_aggregate:
194 commits_by_day_author_aggregate[author_key_cleaner(repo.contact)] = {
195 commits_by_day_author_aggregate[author_key_cleaner(repo.contact)] = {
195 "label":author_key_cleaner(repo.contact),
196 "label":author_key_cleaner(repo.contact),
196 "data":[0, 1],
197 "data":[0, 1],
197 "schema":["commits"],
198 "schema":["commits"],
198 }
199 }
199
200
200 stats = cur_stats if cur_stats else Statistics()
201 stats = cur_stats if cur_stats else Statistics()
201 stats.commit_activity = json.dumps(commits_by_day_author_aggregate)
202 stats.commit_activity = json.dumps(commits_by_day_author_aggregate)
202 stats.commit_activity_combined = json.dumps(overview_data)
203 stats.commit_activity_combined = json.dumps(overview_data)
203
204
204 log.debug('last revison %s', last_rev)
205 log.debug('last revison %s', last_rev)
205 leftovers = len(repo.revisions[last_rev:])
206 leftovers = len(repo.revisions[last_rev:])
206 log.debug('revisions to parse %s', leftovers)
207 log.debug('revisions to parse %s', leftovers)
207
208
208 if last_rev == 0 or leftovers < parse_limit:
209 if last_rev == 0 or leftovers < parse_limit:
209 log.debug('getting code trending stats')
210 log.debug('getting code trending stats')
210 stats.languages = json.dumps(__get_codes_stats(repo_name))
211 stats.languages = json.dumps(__get_codes_stats(repo_name))
211
212
212 stats.repository = dbrepo
213 stats.stat_on_revision = last_cs.revision
214
215 try:
213 try:
214 stats.repository = dbrepo
215 stats.stat_on_revision = last_cs.revision if last_cs else 0
216 sa.add(stats)
216 sa.add(stats)
217 sa.commit()
217 sa.commit()
218 except:
218 except:
219 log.error(traceback.format_exc())
219 log.error(traceback.format_exc())
220 sa.rollback()
220 sa.rollback()
221 return False
221 return False
222 if len(repo.revisions) > 1:
222 if len(repo.revisions) > 1:
223 run_task(get_commits_stats, repo_name, ts_min_y, ts_max_y)
223 run_task(get_commits_stats, repo_name, ts_min_y, ts_max_y)
224
224
225 return True
225 return True
226
226
227 @task(ignore_result=True)
227 @task(ignore_result=True)
228 def reset_user_password(user_email):
228 def reset_user_password(user_email):
229 try:
229 try:
230 log = reset_user_password.get_logger()
230 log = reset_user_password.get_logger()
231 except:
231 except:
232 log = logging.getLogger(__name__)
232 log = logging.getLogger(__name__)
233
233
234 from rhodecode.lib import auth
234 from rhodecode.lib import auth
235 from rhodecode.model.db import User
235 from rhodecode.model.db import User
236
236
237 try:
237 try:
238 try:
238 try:
239 sa = get_session()
239 sa = get_session()
240 user = sa.query(User).filter(User.email == user_email).scalar()
240 user = sa.query(User).filter(User.email == user_email).scalar()
241 new_passwd = auth.PasswordGenerator().gen_password(8,
241 new_passwd = auth.PasswordGenerator().gen_password(8,
242 auth.PasswordGenerator.ALPHABETS_BIG_SMALL)
242 auth.PasswordGenerator.ALPHABETS_BIG_SMALL)
243 if user:
243 if user:
244 user.password = auth.get_crypt_password(new_passwd)
244 user.password = auth.get_crypt_password(new_passwd)
245 sa.add(user)
245 sa.add(user)
246 sa.commit()
246 sa.commit()
247 log.info('change password for %s', user_email)
247 log.info('change password for %s', user_email)
248 if new_passwd is None:
248 if new_passwd is None:
249 raise Exception('unable to generate new password')
249 raise Exception('unable to generate new password')
250
250
251 except:
251 except:
252 log.error(traceback.format_exc())
252 log.error(traceback.format_exc())
253 sa.rollback()
253 sa.rollback()
254
254
255 run_task(send_email, user_email,
255 run_task(send_email, user_email,
256 "Your new rhodecode password",
256 "Your new rhodecode password",
257 'Your new rhodecode password:%s' % (new_passwd))
257 'Your new rhodecode password:%s' % (new_passwd))
258 log.info('send new password mail to %s', user_email)
258 log.info('send new password mail to %s', user_email)
259
259
260
260
261 except:
261 except:
262 log.error('Failed to update user password')
262 log.error('Failed to update user password')
263 log.error(traceback.format_exc())
263 log.error(traceback.format_exc())
264
264
265 return True
265 return True
266
266
267 @task(ignore_result=True)
267 @task(ignore_result=True)
268 def send_email(recipients, subject, body):
268 def send_email(recipients, subject, body):
269 """
269 """
270 Sends an email with defined parameters from the .ini files.
270 Sends an email with defined parameters from the .ini files.
271
271
272
272
273 :param recipients: list of recipients, it this is empty the defined email
273 :param recipients: list of recipients, it this is empty the defined email
274 address from field 'email_to' is used instead
274 address from field 'email_to' is used instead
275 :param subject: subject of the mail
275 :param subject: subject of the mail
276 :param body: body of the mail
276 :param body: body of the mail
277 """
277 """
278 try:
278 try:
279 log = send_email.get_logger()
279 log = send_email.get_logger()
280 except:
280 except:
281 log = logging.getLogger(__name__)
281 log = logging.getLogger(__name__)
282
282
283 email_config = config
283 email_config = config
284
284
285 if not recipients:
285 if not recipients:
286 recipients = [email_config.get('email_to')]
286 recipients = [email_config.get('email_to')]
287
287
288 mail_from = email_config.get('app_email_from')
288 mail_from = email_config.get('app_email_from')
289 user = email_config.get('smtp_username')
289 user = email_config.get('smtp_username')
290 passwd = email_config.get('smtp_password')
290 passwd = email_config.get('smtp_password')
291 mail_server = email_config.get('smtp_server')
291 mail_server = email_config.get('smtp_server')
292 mail_port = email_config.get('smtp_port')
292 mail_port = email_config.get('smtp_port')
293 tls = str2bool(email_config.get('smtp_use_tls'))
293 tls = str2bool(email_config.get('smtp_use_tls'))
294 ssl = str2bool(email_config.get('smtp_use_ssl'))
294 ssl = str2bool(email_config.get('smtp_use_ssl'))
295
295
296 try:
296 try:
297 m = SmtpMailer(mail_from, user, passwd, mail_server,
297 m = SmtpMailer(mail_from, user, passwd, mail_server,
298 mail_port, ssl, tls)
298 mail_port, ssl, tls)
299 m.send(recipients, subject, body)
299 m.send(recipients, subject, body)
300 except:
300 except:
301 log.error('Mail sending failed')
301 log.error('Mail sending failed')
302 log.error(traceback.format_exc())
302 log.error(traceback.format_exc())
303 return False
303 return False
304 return True
304 return True
305
305
306 @task(ignore_result=True)
306 @task(ignore_result=True)
307 def create_repo_fork(form_data, cur_user):
307 def create_repo_fork(form_data, cur_user):
308 try:
308 try:
309 log = create_repo_fork.get_logger()
309 log = create_repo_fork.get_logger()
310 except:
310 except:
311 log = logging.getLogger(__name__)
311 log = logging.getLogger(__name__)
312
312
313 from rhodecode.model.repo import RepoModel
313 from rhodecode.model.repo import RepoModel
314 from vcs import get_backend
314 from vcs import get_backend
315
315
316 repo_model = RepoModel(get_session())
316 repo_model = RepoModel(get_session())
317 repo_model.create(form_data, cur_user, just_db=True, fork=True)
317 repo_model.create(form_data, cur_user, just_db=True, fork=True)
318 repo_name = form_data['repo_name']
318 repo_name = form_data['repo_name']
319 repos_path = get_repos_path()
319 repos_path = get_repos_path()
320 repo_path = os.path.join(repos_path, repo_name)
320 repo_path = os.path.join(repos_path, repo_name)
321 repo_fork_path = os.path.join(repos_path, form_data['fork_name'])
321 repo_fork_path = os.path.join(repos_path, form_data['fork_name'])
322 alias = form_data['repo_type']
322 alias = form_data['repo_type']
323
323
324 log.info('creating repo fork %s as %s', repo_name, repo_path)
324 log.info('creating repo fork %s as %s', repo_name, repo_path)
325 backend = get_backend(alias)
325 backend = get_backend(alias)
326 backend(str(repo_fork_path), create=True, src_url=str(repo_path))
326 backend(str(repo_fork_path), create=True, src_url=str(repo_path))
327
327
328 def __get_codes_stats(repo_name):
328 def __get_codes_stats(repo_name):
329 LANGUAGES_EXTENSIONS_MAP = {'scm': 'Scheme', 'asmx': 'VbNetAspx', 'Rout':
329 LANGUAGES_EXTENSIONS_MAP = {'scm': 'Scheme', 'asmx': 'VbNetAspx', 'Rout':
330 'RConsole', 'rest': 'Rst', 'abap': 'ABAP', 'go': 'Go', 'phtml': 'HtmlPhp',
330 'RConsole', 'rest': 'Rst', 'abap': 'ABAP', 'go': 'Go', 'phtml': 'HtmlPhp',
331 'ns2': 'Newspeak', 'xml': 'EvoqueXml', 'sh-session': 'BashSession', 'ads':
331 'ns2': 'Newspeak', 'xml': 'EvoqueXml', 'sh-session': 'BashSession', 'ads':
332 'Ada', 'clj': 'Clojure', 'll': 'Llvm', 'ebuild': 'Bash', 'adb': 'Ada',
332 'Ada', 'clj': 'Clojure', 'll': 'Llvm', 'ebuild': 'Bash', 'adb': 'Ada',
333 'ada': 'Ada', 'c++-objdump': 'CppObjdump', 'aspx':
333 'ada': 'Ada', 'c++-objdump': 'CppObjdump', 'aspx':
334 'VbNetAspx', 'ksh': 'Bash', 'coffee': 'CoffeeScript', 'vert': 'GLShader',
334 'VbNetAspx', 'ksh': 'Bash', 'coffee': 'CoffeeScript', 'vert': 'GLShader',
335 'Makefile.*': 'Makefile', 'di': 'D', 'dpatch': 'DarcsPatch', 'rake':
335 'Makefile.*': 'Makefile', 'di': 'D', 'dpatch': 'DarcsPatch', 'rake':
336 'Ruby', 'moo': 'MOOCode', 'erl-sh': 'ErlangShell', 'geo': 'GLShader',
336 'Ruby', 'moo': 'MOOCode', 'erl-sh': 'ErlangShell', 'geo': 'GLShader',
337 'pov': 'Povray', 'bas': 'VbNet', 'bat': 'Batch', 'd': 'D', 'lisp':
337 'pov': 'Povray', 'bas': 'VbNet', 'bat': 'Batch', 'd': 'D', 'lisp':
338 'CommonLisp', 'h': 'C', 'rbx': 'Ruby', 'tcl': 'Tcl', 'c++': 'Cpp', 'md':
338 'CommonLisp', 'h': 'C', 'rbx': 'Ruby', 'tcl': 'Tcl', 'c++': 'Cpp', 'md':
339 'MiniD', '.vimrc': 'Vim', 'xsd': 'Xml', 'ml': 'Ocaml', 'el': 'CommonLisp',
339 'MiniD', '.vimrc': 'Vim', 'xsd': 'Xml', 'ml': 'Ocaml', 'el': 'CommonLisp',
340 'befunge': 'Befunge', 'xsl': 'Xslt', 'pyx': 'Cython', 'cfm':
340 'befunge': 'Befunge', 'xsl': 'Xslt', 'pyx': 'Cython', 'cfm':
341 'ColdfusionHtml', 'evoque': 'Evoque', 'cfg': 'Ini', 'htm': 'Html',
341 'ColdfusionHtml', 'evoque': 'Evoque', 'cfg': 'Ini', 'htm': 'Html',
342 'Makefile': 'Makefile', 'cfc': 'ColdfusionHtml', 'tex': 'Tex', 'cs':
342 'Makefile': 'Makefile', 'cfc': 'ColdfusionHtml', 'tex': 'Tex', 'cs':
343 'CSharp', 'mxml': 'Mxml', 'patch': 'Diff', 'apache.conf': 'ApacheConf',
343 'CSharp', 'mxml': 'Mxml', 'patch': 'Diff', 'apache.conf': 'ApacheConf',
344 'scala': 'Scala', 'applescript': 'AppleScript', 'GNUmakefile': 'Makefile',
344 'scala': 'Scala', 'applescript': 'AppleScript', 'GNUmakefile': 'Makefile',
345 'c-objdump': 'CObjdump', 'lua': 'Lua', 'apache2.conf': 'ApacheConf', 'rb':
345 'c-objdump': 'CObjdump', 'lua': 'Lua', 'apache2.conf': 'ApacheConf', 'rb':
346 'Ruby', 'gemspec': 'Ruby', 'rl': 'RagelObjectiveC', 'vala': 'Vala', 'tmpl':
346 'Ruby', 'gemspec': 'Ruby', 'rl': 'RagelObjectiveC', 'vala': 'Vala', 'tmpl':
347 'Cheetah', 'bf': 'Brainfuck', 'plt': 'Gnuplot', 'G': 'AntlrRuby', 'xslt':
347 'Cheetah', 'bf': 'Brainfuck', 'plt': 'Gnuplot', 'G': 'AntlrRuby', 'xslt':
348 'Xslt', 'flxh': 'Felix', 'asax': 'VbNetAspx', 'Rakefile': 'Ruby', 'S': 'S',
348 'Xslt', 'flxh': 'Felix', 'asax': 'VbNetAspx', 'Rakefile': 'Ruby', 'S': 'S',
349 'wsdl': 'Xml', 'js': 'Javascript', 'autodelegate': 'Myghty', 'properties':
349 'wsdl': 'Xml', 'js': 'Javascript', 'autodelegate': 'Myghty', 'properties':
350 'Ini', 'bash': 'Bash', 'c': 'C', 'g': 'AntlrRuby', 'r3': 'Rebol', 's':
350 'Ini', 'bash': 'Bash', 'c': 'C', 'g': 'AntlrRuby', 'r3': 'Rebol', 's':
351 'Gas', 'ashx': 'VbNetAspx', 'cxx': 'Cpp', 'boo': 'Boo', 'prolog': 'Prolog',
351 'Gas', 'ashx': 'VbNetAspx', 'cxx': 'Cpp', 'boo': 'Boo', 'prolog': 'Prolog',
352 'sqlite3-console': 'SqliteConsole', 'cl': 'CommonLisp', 'cc': 'Cpp', 'pot':
352 'sqlite3-console': 'SqliteConsole', 'cl': 'CommonLisp', 'cc': 'Cpp', 'pot':
353 'Gettext', 'vim': 'Vim', 'pxi': 'Cython', 'yaml': 'Yaml', 'SConstruct':
353 'Gettext', 'vim': 'Vim', 'pxi': 'Cython', 'yaml': 'Yaml', 'SConstruct':
354 'Python', 'diff': 'Diff', 'txt': 'Text', 'cw': 'Redcode', 'pxd': 'Cython',
354 'Python', 'diff': 'Diff', 'txt': 'Text', 'cw': 'Redcode', 'pxd': 'Cython',
355 'plot': 'Gnuplot', 'java': 'Java', 'hrl': 'Erlang', 'py': 'Python',
355 'plot': 'Gnuplot', 'java': 'Java', 'hrl': 'Erlang', 'py': 'Python',
356 'makefile': 'Makefile', 'squid.conf': 'SquidConf', 'asm': 'Nasm', 'toc':
356 'makefile': 'Makefile', 'squid.conf': 'SquidConf', 'asm': 'Nasm', 'toc':
357 'Tex', 'kid': 'Genshi', 'rhtml': 'Rhtml', 'po': 'Gettext', 'pl': 'Prolog',
357 'Tex', 'kid': 'Genshi', 'rhtml': 'Rhtml', 'po': 'Gettext', 'pl': 'Prolog',
358 'pm': 'Perl', 'hx': 'Haxe', 'ascx': 'VbNetAspx', 'ooc': 'Ooc', 'asy':
358 'pm': 'Perl', 'hx': 'Haxe', 'ascx': 'VbNetAspx', 'ooc': 'Ooc', 'asy':
359 'Asymptote', 'hs': 'Haskell', 'SConscript': 'Python', 'pytb':
359 'Asymptote', 'hs': 'Haskell', 'SConscript': 'Python', 'pytb':
360 'PythonTraceback', 'myt': 'Myghty', 'hh': 'Cpp', 'R': 'S', 'aux': 'Tex',
360 'PythonTraceback', 'myt': 'Myghty', 'hh': 'Cpp', 'R': 'S', 'aux': 'Tex',
361 'rst': 'Rst', 'cpp-objdump': 'CppObjdump', 'lgt': 'Logtalk', 'rss': 'Xml',
361 'rst': 'Rst', 'cpp-objdump': 'CppObjdump', 'lgt': 'Logtalk', 'rss': 'Xml',
362 'flx': 'Felix', 'b': 'Brainfuck', 'f': 'Fortran', 'rbw': 'Ruby',
362 'flx': 'Felix', 'b': 'Brainfuck', 'f': 'Fortran', 'rbw': 'Ruby',
363 '.htaccess': 'ApacheConf', 'cxx-objdump': 'CppObjdump', 'j': 'ObjectiveJ',
363 '.htaccess': 'ApacheConf', 'cxx-objdump': 'CppObjdump', 'j': 'ObjectiveJ',
364 'mll': 'Ocaml', 'yml': 'Yaml', 'mu': 'MuPAD', 'r': 'Rebol', 'ASM': 'Nasm',
364 'mll': 'Ocaml', 'yml': 'Yaml', 'mu': 'MuPAD', 'r': 'Rebol', 'ASM': 'Nasm',
365 'erl': 'Erlang', 'mly': 'Ocaml', 'mo': 'Modelica', 'def': 'Modula2', 'ini':
365 'erl': 'Erlang', 'mly': 'Ocaml', 'mo': 'Modelica', 'def': 'Modula2', 'ini':
366 'Ini', 'control': 'DebianControl', 'vb': 'VbNet', 'vapi': 'Vala', 'pro':
366 'Ini', 'control': 'DebianControl', 'vb': 'VbNet', 'vapi': 'Vala', 'pro':
367 'Prolog', 'spt': 'Cheetah', 'mli': 'Ocaml', 'as': 'ActionScript3', 'cmd':
367 'Prolog', 'spt': 'Cheetah', 'mli': 'Ocaml', 'as': 'ActionScript3', 'cmd':
368 'Batch', 'cpp': 'Cpp', 'io': 'Io', 'tac': 'Python', 'haml': 'Haml', 'rkt':
368 'Batch', 'cpp': 'Cpp', 'io': 'Io', 'tac': 'Python', 'haml': 'Haml', 'rkt':
369 'Racket', 'st':'Smalltalk', 'inc': 'Povray', 'pas': 'Delphi', 'cmake':
369 'Racket', 'st':'Smalltalk', 'inc': 'Povray', 'pas': 'Delphi', 'cmake':
370 'CMake', 'csh':'Tcsh', 'hpp': 'Cpp', 'feature': 'Gherkin', 'html': 'Html',
370 'CMake', 'csh':'Tcsh', 'hpp': 'Cpp', 'feature': 'Gherkin', 'html': 'Html',
371 'php':'Php', 'php3':'Php', 'php4':'Php', 'php5':'Php', 'xhtml': 'Html',
371 'php':'Php', 'php3':'Php', 'php4':'Php', 'php5':'Php', 'xhtml': 'Html',
372 'hxx': 'Cpp', 'eclass': 'Bash', 'css': 'Css',
372 'hxx': 'Cpp', 'eclass': 'Bash', 'css': 'Css',
373 'frag': 'GLShader', 'd-objdump': 'DObjdump', 'weechatlog': 'IrcLogs',
373 'frag': 'GLShader', 'd-objdump': 'DObjdump', 'weechatlog': 'IrcLogs',
374 'tcsh': 'Tcsh', 'objdump': 'Objdump', 'pyw': 'Python', 'h++': 'Cpp',
374 'tcsh': 'Tcsh', 'objdump': 'Objdump', 'pyw': 'Python', 'h++': 'Cpp',
375 'py3tb': 'Python3Traceback', 'jsp': 'Jsp', 'sql': 'Sql', 'mak': 'Makefile',
375 'py3tb': 'Python3Traceback', 'jsp': 'Jsp', 'sql': 'Sql', 'mak': 'Makefile',
376 'php': 'Php', 'mao': 'Mako', 'man': 'Groff', 'dylan': 'Dylan', 'sass':
376 'php': 'Php', 'mao': 'Mako', 'man': 'Groff', 'dylan': 'Dylan', 'sass':
377 'Sass', 'cfml': 'ColdfusionHtml', 'darcspatch': 'DarcsPatch', 'tpl':
377 'Sass', 'cfml': 'ColdfusionHtml', 'darcspatch': 'DarcsPatch', 'tpl':
378 'Smarty', 'm': 'ObjectiveC', 'f90': 'Fortran', 'mod': 'Modula2', 'sh':
378 'Smarty', 'm': 'ObjectiveC', 'f90': 'Fortran', 'mod': 'Modula2', 'sh':
379 'Bash', 'lhs': 'LiterateHaskell', 'sources.list': 'SourcesList', 'axd':
379 'Bash', 'lhs': 'LiterateHaskell', 'sources.list': 'SourcesList', 'axd':
380 'VbNetAspx', 'sc': 'Python'}
380 'VbNetAspx', 'sc': 'Python'}
381
381
382 repos_path = get_repos_path()
382 repos_path = get_repos_path()
383 p = os.path.join(repos_path, repo_name)
383 p = os.path.join(repos_path, repo_name)
384 repo = get_repo(p)
384 repo = get_repo(p)
385 tip = repo.get_changeset()
385 tip = repo.get_changeset()
386 code_stats = {}
386 code_stats = {}
387
387
388 def aggregate(cs):
388 def aggregate(cs):
389 for f in cs[2]:
389 for f in cs[2]:
390 ext = f.extension
390 ext = f.extension
391 key = LANGUAGES_EXTENSIONS_MAP.get(ext, ext)
391 key = LANGUAGES_EXTENSIONS_MAP.get(ext, ext)
392 key = key or ext
392 key = key or ext
393 if ext in LANGUAGES_EXTENSIONS_MAP.keys() and not f.is_binary:
393 if ext in LANGUAGES_EXTENSIONS_MAP.keys() and not f.is_binary:
394 if code_stats.has_key(key):
394 if code_stats.has_key(key):
395 code_stats[key] += 1
395 code_stats[key] += 1
396 else:
396 else:
397 code_stats[key] = 1
397 code_stats[key] = 1
398
398
399 map(aggregate, tip.walk('/'))
399 map(aggregate, tip.walk('/'))
400
400
401 return code_stats or {}
401 return code_stats or {}
402
402
403
403
404
404
405
405
General Comments 0
You need to be logged in to leave comments. Login now