##// END OF EJS Templates
#469 added --update-only option to whoosh to re-index only given list...
marcink -
r2373:1828eb7f beta
parent child Browse files
Show More
@@ -1,685 +1,687 b''
1 .. _changelog:
1 .. _changelog:
2
2
3 =========
3 =========
4 Changelog
4 Changelog
5 =========
5 =========
6
6
7 1.4.0 (**2012-XX-XX**)
7 1.4.0 (**2012-XX-XX**)
8 ----------------------
8 ----------------------
9
9
10 :status: in-progress
10 :status: in-progress
11 :branch: beta
11 :branch: beta
12
12
13 news
13 news
14 ++++
14 ++++
15
15
16 - new codereview system
16 - new codereview system
17 - email map, allowing users to have multiple email addresses mapped into
17 - email map, allowing users to have multiple email addresses mapped into
18 their accounts
18 their accounts
19 - changed setup-app into setup-rhodecode and added default options to it.
19 - changed setup-app into setup-rhodecode and added default options to it.
20 - new git repos are created as bare now by default
20 - new git repos are created as bare now by default
21 - #464 added links to groups in permission box
21 - #464 added links to groups in permission box
22 - #465 mentions autocomplete inside comments boxes
22 - #465 mentions autocomplete inside comments boxes
23 - #469 added --update-only option to whoosh to re-index only given list
24 of repos in index
23
25
24 fixes
26 fixes
25 +++++
27 +++++
26
28
27 - improved translations
29 - improved translations
28 - fixes issue #455 Creating an archive generates an exception on Windows
30 - fixes issue #455 Creating an archive generates an exception on Windows
29 - fixes #448 Download ZIP archive keeps file in /tmp open and results
31 - fixes #448 Download ZIP archive keeps file in /tmp open and results
30 in out of disk space
32 in out of disk space
31 - fixes issue #454 Search results under Windows include proceeding
33 - fixes issue #454 Search results under Windows include proceeding
32 backslash
34 backslash
33 - fixed issue #450. Rhodecode no longer will crash when bad revision is
35 - fixed issue #450. Rhodecode no longer will crash when bad revision is
34 present in journal data.
36 present in journal data.
35 - fix for issue #417, git execution was broken on windows for certain
37 - fix for issue #417, git execution was broken on windows for certain
36 commands.
38 commands.
37 - fixed #413. Don't disable .git directory for bare repos on deleting
39 - fixed #413. Don't disable .git directory for bare repos on deleting
38 - fixed issue #459. Changed the way of obtaining logger in reindex task.
40 - fixed issue #459. Changed the way of obtaining logger in reindex task.
39
41
40 1.3.6 (**2012-05-17**)
42 1.3.6 (**2012-05-17**)
41 ----------------------
43 ----------------------
42
44
43 news
45 news
44 ++++
46 ++++
45
47
46 - chinese traditional translation
48 - chinese traditional translation
47 - changed setup-app into setup-rhodecode and added arguments for auto-setup
49 - changed setup-app into setup-rhodecode and added arguments for auto-setup
48 mode that doesn't need user interaction
50 mode that doesn't need user interaction
49
51
50 fixes
52 fixes
51 +++++
53 +++++
52
54
53 - fixed no scm found warning
55 - fixed no scm found warning
54 - fixed __future__ import error on rcextensions
56 - fixed __future__ import error on rcextensions
55 - made simplejson required lib for speedup on JSON encoding
57 - made simplejson required lib for speedup on JSON encoding
56 - fixes #449 bad regex could get more than revisions from parsing history
58 - fixes #449 bad regex could get more than revisions from parsing history
57 - don't clear DB session when CELERY_EAGER is turned ON
59 - don't clear DB session when CELERY_EAGER is turned ON
58
60
59 1.3.5 (**2012-05-10**)
61 1.3.5 (**2012-05-10**)
60 ----------------------
62 ----------------------
61
63
62 news
64 news
63 ++++
65 ++++
64
66
65 - use ext_json for json module
67 - use ext_json for json module
66 - unified annotation view with file source view
68 - unified annotation view with file source view
67 - notification improvements, better inbox + css
69 - notification improvements, better inbox + css
68 - #419 don't strip passwords for login forms, make rhodecode
70 - #419 don't strip passwords for login forms, make rhodecode
69 more compatible with LDAP servers
71 more compatible with LDAP servers
70 - Added HTTP_X_FORWARDED_FOR as another method of extracting
72 - Added HTTP_X_FORWARDED_FOR as another method of extracting
71 IP for pull/push logs. - moved all to base controller
73 IP for pull/push logs. - moved all to base controller
72 - #415: Adding comment to changeset causes reload.
74 - #415: Adding comment to changeset causes reload.
73 Comments are now added via ajax and doesn't reload the page
75 Comments are now added via ajax and doesn't reload the page
74 - #374 LDAP config is discarded when LDAP can't be activated
76 - #374 LDAP config is discarded when LDAP can't be activated
75 - limited push/pull operations are now logged for git in the journal
77 - limited push/pull operations are now logged for git in the journal
76 - bumped mercurial to 2.2.X series
78 - bumped mercurial to 2.2.X series
77 - added support for displaying submodules in file-browser
79 - added support for displaying submodules in file-browser
78 - #421 added bookmarks in changelog view
80 - #421 added bookmarks in changelog view
79
81
80 fixes
82 fixes
81 +++++
83 +++++
82
84
83 - fixed dev-version marker for stable when served from source codes
85 - fixed dev-version marker for stable when served from source codes
84 - fixed missing permission checks on show forks page
86 - fixed missing permission checks on show forks page
85 - #418 cast to unicode fixes in notification objects
87 - #418 cast to unicode fixes in notification objects
86 - #426 fixed mention extracting regex
88 - #426 fixed mention extracting regex
87 - fixed remote-pulling for git remotes remopositories
89 - fixed remote-pulling for git remotes remopositories
88 - fixed #434: Error when accessing files or changesets of a git repository
90 - fixed #434: Error when accessing files or changesets of a git repository
89 with submodules
91 with submodules
90 - fixed issue with empty APIKEYS for users after registration ref. #438
92 - fixed issue with empty APIKEYS for users after registration ref. #438
91 - fixed issue with getting README files from git repositories
93 - fixed issue with getting README files from git repositories
92
94
93 1.3.4 (**2012-03-28**)
95 1.3.4 (**2012-03-28**)
94 ----------------------
96 ----------------------
95
97
96 news
98 news
97 ++++
99 ++++
98
100
99 - Whoosh logging is now controlled by the .ini files logging setup
101 - Whoosh logging is now controlled by the .ini files logging setup
100 - added clone-url into edit form on /settings page
102 - added clone-url into edit form on /settings page
101 - added help text into repo add/edit forms
103 - added help text into repo add/edit forms
102 - created rcextensions module with additional mappings (ref #322) and
104 - created rcextensions module with additional mappings (ref #322) and
103 post push/pull/create repo hooks callbacks
105 post push/pull/create repo hooks callbacks
104 - implemented #377 Users view for his own permissions on account page
106 - implemented #377 Users view for his own permissions on account page
105 - #399 added inheritance of permissions for users group on repos groups
107 - #399 added inheritance of permissions for users group on repos groups
106 - #401 repository group is automatically pre-selected when adding repos
108 - #401 repository group is automatically pre-selected when adding repos
107 inside a repository group
109 inside a repository group
108 - added alternative HTTP 403 response when client failed to authenticate. Helps
110 - added alternative HTTP 403 response when client failed to authenticate. Helps
109 solving issues with Mercurial and LDAP
111 solving issues with Mercurial and LDAP
110 - #402 removed group prefix from repository name when listing repositories
112 - #402 removed group prefix from repository name when listing repositories
111 inside a group
113 inside a group
112 - added gravatars into permission view and permissions autocomplete
114 - added gravatars into permission view and permissions autocomplete
113 - #347 when running multiple RhodeCode instances, properly invalidates cache
115 - #347 when running multiple RhodeCode instances, properly invalidates cache
114 for all registered servers
116 for all registered servers
115
117
116 fixes
118 fixes
117 +++++
119 +++++
118
120
119 - fixed #390 cache invalidation problems on repos inside group
121 - fixed #390 cache invalidation problems on repos inside group
120 - fixed #385 clone by ID url was loosing proxy prefix in URL
122 - fixed #385 clone by ID url was loosing proxy prefix in URL
121 - fixed some unicode problems with waitress
123 - fixed some unicode problems with waitress
122 - fixed issue with escaping < and > in changeset commits
124 - fixed issue with escaping < and > in changeset commits
123 - fixed error occurring during recursive group creation in API
125 - fixed error occurring during recursive group creation in API
124 create_repo function
126 create_repo function
125 - fixed #393 py2.5 fixes for routes url generator
127 - fixed #393 py2.5 fixes for routes url generator
126 - fixed #397 Private repository groups shows up before login
128 - fixed #397 Private repository groups shows up before login
127 - fixed #396 fixed problems with revoking users in nested groups
129 - fixed #396 fixed problems with revoking users in nested groups
128 - fixed mysql unicode issues + specified InnoDB as default engine with
130 - fixed mysql unicode issues + specified InnoDB as default engine with
129 utf8 charset
131 utf8 charset
130 - #406 trim long branch/tag names in changelog to not break UI
132 - #406 trim long branch/tag names in changelog to not break UI
131
133
132 1.3.3 (**2012-03-02**)
134 1.3.3 (**2012-03-02**)
133 ----------------------
135 ----------------------
134
136
135 news
137 news
136 ++++
138 ++++
137
139
138
140
139 fixes
141 fixes
140 +++++
142 +++++
141
143
142 - fixed some python2.5 compatibility issues
144 - fixed some python2.5 compatibility issues
143 - fixed issues with removed repos was accidentally added as groups, after
145 - fixed issues with removed repos was accidentally added as groups, after
144 full rescan of paths
146 full rescan of paths
145 - fixes #376 Cannot edit user (using container auth)
147 - fixes #376 Cannot edit user (using container auth)
146 - fixes #378 Invalid image urls on changeset screen with proxy-prefix
148 - fixes #378 Invalid image urls on changeset screen with proxy-prefix
147 configuration
149 configuration
148 - fixed initial sorting of repos inside repo group
150 - fixed initial sorting of repos inside repo group
149 - fixes issue when user tried to resubmit same permission into user/user_groups
151 - fixes issue when user tried to resubmit same permission into user/user_groups
150 - bumped beaker version that fixes #375 leap error bug
152 - bumped beaker version that fixes #375 leap error bug
151 - fixed raw_changeset for git. It was generated with hg patch headers
153 - fixed raw_changeset for git. It was generated with hg patch headers
152 - fixed vcs issue with last_changeset for filenodes
154 - fixed vcs issue with last_changeset for filenodes
153 - fixed missing commit after hook delete
155 - fixed missing commit after hook delete
154 - fixed #372 issues with git operation detection that caused a security issue
156 - fixed #372 issues with git operation detection that caused a security issue
155 for git repos
157 for git repos
156
158
157 1.3.2 (**2012-02-28**)
159 1.3.2 (**2012-02-28**)
158 ----------------------
160 ----------------------
159
161
160 news
162 news
161 ++++
163 ++++
162
164
163
165
164 fixes
166 fixes
165 +++++
167 +++++
166
168
167 - fixed git protocol issues with repos-groups
169 - fixed git protocol issues with repos-groups
168 - fixed git remote repos validator that prevented from cloning remote git repos
170 - fixed git remote repos validator that prevented from cloning remote git repos
169 - fixes #370 ending slashes fixes for repo and groups
171 - fixes #370 ending slashes fixes for repo and groups
170 - fixes #368 improved git-protocol detection to handle other clients
172 - fixes #368 improved git-protocol detection to handle other clients
171 - fixes #366 When Setting Repository Group To Blank Repo Group Wont Be
173 - fixes #366 When Setting Repository Group To Blank Repo Group Wont Be
172 Moved To Root
174 Moved To Root
173 - fixes #371 fixed issues with beaker/sqlalchemy and non-ascii cache keys
175 - fixes #371 fixed issues with beaker/sqlalchemy and non-ascii cache keys
174 - fixed #373 missing cascade drop on user_group_to_perm table
176 - fixed #373 missing cascade drop on user_group_to_perm table
175
177
176 1.3.1 (**2012-02-27**)
178 1.3.1 (**2012-02-27**)
177 ----------------------
179 ----------------------
178
180
179 news
181 news
180 ++++
182 ++++
181
183
182
184
183 fixes
185 fixes
184 +++++
186 +++++
185
187
186 - redirection loop occurs when remember-me wasn't checked during login
188 - redirection loop occurs when remember-me wasn't checked during login
187 - fixes issues with git blob history generation
189 - fixes issues with git blob history generation
188 - don't fetch branch for git in file history dropdown. Causes unneeded slowness
190 - don't fetch branch for git in file history dropdown. Causes unneeded slowness
189
191
190 1.3.0 (**2012-02-26**)
192 1.3.0 (**2012-02-26**)
191 ----------------------
193 ----------------------
192
194
193 news
195 news
194 ++++
196 ++++
195
197
196 - code review, inspired by github code-comments
198 - code review, inspired by github code-comments
197 - #215 rst and markdown README files support
199 - #215 rst and markdown README files support
198 - #252 Container-based and proxy pass-through authentication support
200 - #252 Container-based and proxy pass-through authentication support
199 - #44 branch browser. Filtering of changelog by branches
201 - #44 branch browser. Filtering of changelog by branches
200 - mercurial bookmarks support
202 - mercurial bookmarks support
201 - new hover top menu, optimized to add maximum size for important views
203 - new hover top menu, optimized to add maximum size for important views
202 - configurable clone url template with possibility to specify protocol like
204 - configurable clone url template with possibility to specify protocol like
203 ssh:// or http:// and also manually alter other parts of clone_url.
205 ssh:// or http:// and also manually alter other parts of clone_url.
204 - enabled largefiles extension by default
206 - enabled largefiles extension by default
205 - optimized summary file pages and saved a lot of unused space in them
207 - optimized summary file pages and saved a lot of unused space in them
206 - #239 option to manually mark repository as fork
208 - #239 option to manually mark repository as fork
207 - #320 mapping of commit authors to RhodeCode users
209 - #320 mapping of commit authors to RhodeCode users
208 - #304 hashes are displayed using monospace font
210 - #304 hashes are displayed using monospace font
209 - diff configuration, toggle white lines and context lines
211 - diff configuration, toggle white lines and context lines
210 - #307 configurable diffs, whitespace toggle, increasing context lines
212 - #307 configurable diffs, whitespace toggle, increasing context lines
211 - sorting on branches, tags and bookmarks using YUI datatable
213 - sorting on branches, tags and bookmarks using YUI datatable
212 - improved file filter on files page
214 - improved file filter on files page
213 - implements #330 api method for listing nodes ar particular revision
215 - implements #330 api method for listing nodes ar particular revision
214 - #73 added linking issues in commit messages to chosen issue tracker url
216 - #73 added linking issues in commit messages to chosen issue tracker url
215 based on user defined regular expression
217 based on user defined regular expression
216 - added linking of changesets in commit messages
218 - added linking of changesets in commit messages
217 - new compact changelog with expandable commit messages
219 - new compact changelog with expandable commit messages
218 - firstname and lastname are optional in user creation
220 - firstname and lastname are optional in user creation
219 - #348 added post-create repository hook
221 - #348 added post-create repository hook
220 - #212 global encoding settings is now configurable from .ini files
222 - #212 global encoding settings is now configurable from .ini files
221 - #227 added repository groups permissions
223 - #227 added repository groups permissions
222 - markdown gets codehilite extensions
224 - markdown gets codehilite extensions
223 - new API methods, delete_repositories, grante/revoke permissions for groups
225 - new API methods, delete_repositories, grante/revoke permissions for groups
224 and repos
226 and repos
225
227
226
228
227 fixes
229 fixes
228 +++++
230 +++++
229
231
230 - rewrote dbsession management for atomic operations, and better error handling
232 - rewrote dbsession management for atomic operations, and better error handling
231 - fixed sorting of repo tables
233 - fixed sorting of repo tables
232 - #326 escape of special html entities in diffs
234 - #326 escape of special html entities in diffs
233 - normalized user_name => username in api attributes
235 - normalized user_name => username in api attributes
234 - fixes #298 ldap created users with mixed case emails created conflicts
236 - fixes #298 ldap created users with mixed case emails created conflicts
235 on saving a form
237 on saving a form
236 - fixes issue when owner of a repo couldn't revoke permissions for users
238 - fixes issue when owner of a repo couldn't revoke permissions for users
237 and groups
239 and groups
238 - fixes #271 rare JSON serialization problem with statistics
240 - fixes #271 rare JSON serialization problem with statistics
239 - fixes #337 missing validation check for conflicting names of a group with a
241 - fixes #337 missing validation check for conflicting names of a group with a
240 repositories group
242 repositories group
241 - #340 fixed session problem for mysql and celery tasks
243 - #340 fixed session problem for mysql and celery tasks
242 - fixed #331 RhodeCode mangles repository names if the a repository group
244 - fixed #331 RhodeCode mangles repository names if the a repository group
243 contains the "full path" to the repositories
245 contains the "full path" to the repositories
244 - #355 RhodeCode doesn't store encrypted LDAP passwords
246 - #355 RhodeCode doesn't store encrypted LDAP passwords
245
247
246 1.2.5 (**2012-01-28**)
248 1.2.5 (**2012-01-28**)
247 ----------------------
249 ----------------------
248
250
249 news
251 news
250 ++++
252 ++++
251
253
252 fixes
254 fixes
253 +++++
255 +++++
254
256
255 - #340 Celery complains about MySQL server gone away, added session cleanup
257 - #340 Celery complains about MySQL server gone away, added session cleanup
256 for celery tasks
258 for celery tasks
257 - #341 "scanning for repositories in None" log message during Rescan was missing
259 - #341 "scanning for repositories in None" log message during Rescan was missing
258 a parameter
260 a parameter
259 - fixed creating archives with subrepos. Some hooks were triggered during that
261 - fixed creating archives with subrepos. Some hooks were triggered during that
260 operation leading to crash.
262 operation leading to crash.
261 - fixed missing email in account page.
263 - fixed missing email in account page.
262 - Reverted Mercurial to 2.0.1 for windows due to bug in Mercurial that makes
264 - Reverted Mercurial to 2.0.1 for windows due to bug in Mercurial that makes
263 forking on windows impossible
265 forking on windows impossible
264
266
265 1.2.4 (**2012-01-19**)
267 1.2.4 (**2012-01-19**)
266 ----------------------
268 ----------------------
267
269
268 news
270 news
269 ++++
271 ++++
270
272
271 - RhodeCode is bundled with mercurial series 2.0.X by default, with
273 - RhodeCode is bundled with mercurial series 2.0.X by default, with
272 full support to largefiles extension. Enabled by default in new installations
274 full support to largefiles extension. Enabled by default in new installations
273 - #329 Ability to Add/Remove Groups to/from a Repository via AP
275 - #329 Ability to Add/Remove Groups to/from a Repository via AP
274 - added requires.txt file with requirements
276 - added requires.txt file with requirements
275
277
276 fixes
278 fixes
277 +++++
279 +++++
278
280
279 - fixes db session issues with celery when emailing admins
281 - fixes db session issues with celery when emailing admins
280 - #331 RhodeCode mangles repository names if the a repository group
282 - #331 RhodeCode mangles repository names if the a repository group
281 contains the "full path" to the repositories
283 contains the "full path" to the repositories
282 - #298 Conflicting e-mail addresses for LDAP and RhodeCode users
284 - #298 Conflicting e-mail addresses for LDAP and RhodeCode users
283 - DB session cleanup after hg protocol operations, fixes issues with
285 - DB session cleanup after hg protocol operations, fixes issues with
284 `mysql has gone away` errors
286 `mysql has gone away` errors
285 - #333 doc fixes for get_repo api function
287 - #333 doc fixes for get_repo api function
286 - #271 rare JSON serialization problem with statistics enabled
288 - #271 rare JSON serialization problem with statistics enabled
287 - #337 Fixes issues with validation of repository name conflicting with
289 - #337 Fixes issues with validation of repository name conflicting with
288 a group name. A proper message is now displayed.
290 a group name. A proper message is now displayed.
289 - #292 made ldap_dn in user edit readonly, to get rid of confusion that field
291 - #292 made ldap_dn in user edit readonly, to get rid of confusion that field
290 doesn't work
292 doesn't work
291 - #316 fixes issues with web description in hgrc files
293 - #316 fixes issues with web description in hgrc files
292
294
293 1.2.3 (**2011-11-02**)
295 1.2.3 (**2011-11-02**)
294 ----------------------
296 ----------------------
295
297
296 news
298 news
297 ++++
299 ++++
298
300
299 - added option to manage repos group for non admin users
301 - added option to manage repos group for non admin users
300 - added following API methods for get_users, create_user, get_users_groups,
302 - added following API methods for get_users, create_user, get_users_groups,
301 get_users_group, create_users_group, add_user_to_users_groups, get_repos,
303 get_users_group, create_users_group, add_user_to_users_groups, get_repos,
302 get_repo, create_repo, add_user_to_repo
304 get_repo, create_repo, add_user_to_repo
303 - implements #237 added password confirmation for my account
305 - implements #237 added password confirmation for my account
304 and admin edit user.
306 and admin edit user.
305 - implements #291 email notification for global events are now sent to all
307 - implements #291 email notification for global events are now sent to all
306 administrator users, and global config email.
308 administrator users, and global config email.
307
309
308 fixes
310 fixes
309 +++++
311 +++++
310
312
311 - added option for passing auth method for smtp mailer
313 - added option for passing auth method for smtp mailer
312 - #276 issue with adding a single user with id>10 to usergroups
314 - #276 issue with adding a single user with id>10 to usergroups
313 - #277 fixes windows LDAP settings in which missing values breaks the ldap auth
315 - #277 fixes windows LDAP settings in which missing values breaks the ldap auth
314 - #288 fixes managing of repos in a group for non admin user
316 - #288 fixes managing of repos in a group for non admin user
315
317
316 1.2.2 (**2011-10-17**)
318 1.2.2 (**2011-10-17**)
317 ----------------------
319 ----------------------
318
320
319 news
321 news
320 ++++
322 ++++
321
323
322 - #226 repo groups are available by path instead of numerical id
324 - #226 repo groups are available by path instead of numerical id
323
325
324 fixes
326 fixes
325 +++++
327 +++++
326
328
327 - #259 Groups with the same name but with different parent group
329 - #259 Groups with the same name but with different parent group
328 - #260 Put repo in group, then move group to another group -> repo becomes unavailable
330 - #260 Put repo in group, then move group to another group -> repo becomes unavailable
329 - #258 RhodeCode 1.2 assumes egg folder is writable (lockfiles problems)
331 - #258 RhodeCode 1.2 assumes egg folder is writable (lockfiles problems)
330 - #265 ldap save fails sometimes on converting attributes to booleans,
332 - #265 ldap save fails sometimes on converting attributes to booleans,
331 added getter and setter into model that will prevent from this on db model level
333 added getter and setter into model that will prevent from this on db model level
332 - fixed problems with timestamps issues #251 and #213
334 - fixed problems with timestamps issues #251 and #213
333 - fixes #266 RhodeCode allows to create repo with the same name and in
335 - fixes #266 RhodeCode allows to create repo with the same name and in
334 the same parent as group
336 the same parent as group
335 - fixes #245 Rescan of the repositories on Windows
337 - fixes #245 Rescan of the repositories on Windows
336 - fixes #248 cannot edit repos inside a group on windows
338 - fixes #248 cannot edit repos inside a group on windows
337 - fixes #219 forking problems on windows
339 - fixes #219 forking problems on windows
338
340
339 1.2.1 (**2011-10-08**)
341 1.2.1 (**2011-10-08**)
340 ----------------------
342 ----------------------
341
343
342 news
344 news
343 ++++
345 ++++
344
346
345
347
346 fixes
348 fixes
347 +++++
349 +++++
348
350
349 - fixed problems with basic auth and push problems
351 - fixed problems with basic auth and push problems
350 - gui fixes
352 - gui fixes
351 - fixed logger
353 - fixed logger
352
354
353 1.2.0 (**2011-10-07**)
355 1.2.0 (**2011-10-07**)
354 ----------------------
356 ----------------------
355
357
356 news
358 news
357 ++++
359 ++++
358
360
359 - implemented #47 repository groups
361 - implemented #47 repository groups
360 - implemented #89 Can setup google analytics code from settings menu
362 - implemented #89 Can setup google analytics code from settings menu
361 - implemented #91 added nicer looking archive urls with more download options
363 - implemented #91 added nicer looking archive urls with more download options
362 like tags, branches
364 like tags, branches
363 - implemented #44 into file browsing, and added follow branch option
365 - implemented #44 into file browsing, and added follow branch option
364 - implemented #84 downloads can be enabled/disabled for each repository
366 - implemented #84 downloads can be enabled/disabled for each repository
365 - anonymous repository can be cloned without having to pass default:default
367 - anonymous repository can be cloned without having to pass default:default
366 into clone url
368 into clone url
367 - fixed #90 whoosh indexer can index chooses repositories passed in command
369 - fixed #90 whoosh indexer can index chooses repositories passed in command
368 line
370 line
369 - extended journal with day aggregates and paging
371 - extended journal with day aggregates and paging
370 - implemented #107 source code lines highlight ranges
372 - implemented #107 source code lines highlight ranges
371 - implemented #93 customizable changelog on combined revision ranges -
373 - implemented #93 customizable changelog on combined revision ranges -
372 equivalent of githubs compare view
374 equivalent of githubs compare view
373 - implemented #108 extended and more powerful LDAP configuration
375 - implemented #108 extended and more powerful LDAP configuration
374 - implemented #56 users groups
376 - implemented #56 users groups
375 - major code rewrites optimized codes for speed and memory usage
377 - major code rewrites optimized codes for speed and memory usage
376 - raw and diff downloads are now in git format
378 - raw and diff downloads are now in git format
377 - setup command checks for write access to given path
379 - setup command checks for write access to given path
378 - fixed many issues with international characters and unicode. It uses utf8
380 - fixed many issues with international characters and unicode. It uses utf8
379 decode with replace to provide less errors even with non utf8 encoded strings
381 decode with replace to provide less errors even with non utf8 encoded strings
380 - #125 added API KEY access to feeds
382 - #125 added API KEY access to feeds
381 - #109 Repository can be created from external Mercurial link (aka. remote
383 - #109 Repository can be created from external Mercurial link (aka. remote
382 repository, and manually updated (via pull) from admin panel
384 repository, and manually updated (via pull) from admin panel
383 - beta git support - push/pull server + basic view for git repos
385 - beta git support - push/pull server + basic view for git repos
384 - added followers page and forks page
386 - added followers page and forks page
385 - server side file creation (with binary file upload interface)
387 - server side file creation (with binary file upload interface)
386 and edition with commits powered by codemirror
388 and edition with commits powered by codemirror
387 - #111 file browser file finder, quick lookup files on whole file tree
389 - #111 file browser file finder, quick lookup files on whole file tree
388 - added quick login sliding menu into main page
390 - added quick login sliding menu into main page
389 - changelog uses lazy loading of affected files details, in some scenarios
391 - changelog uses lazy loading of affected files details, in some scenarios
390 this can improve speed of changelog page dramatically especially for
392 this can improve speed of changelog page dramatically especially for
391 larger repositories.
393 larger repositories.
392 - implements #214 added support for downloading subrepos in download menu.
394 - implements #214 added support for downloading subrepos in download menu.
393 - Added basic API for direct operations on rhodecode via JSON
395 - Added basic API for direct operations on rhodecode via JSON
394 - Implemented advanced hook management
396 - Implemented advanced hook management
395
397
396 fixes
398 fixes
397 +++++
399 +++++
398
400
399 - fixed file browser bug, when switching into given form revision the url was
401 - fixed file browser bug, when switching into given form revision the url was
400 not changing
402 not changing
401 - fixed propagation to error controller on simplehg and simplegit middlewares
403 - fixed propagation to error controller on simplehg and simplegit middlewares
402 - fixed error when trying to make a download on empty repository
404 - fixed error when trying to make a download on empty repository
403 - fixed problem with '[' chars in commit messages in journal
405 - fixed problem with '[' chars in commit messages in journal
404 - fixed #99 Unicode errors, on file node paths with non utf-8 characters
406 - fixed #99 Unicode errors, on file node paths with non utf-8 characters
405 - journal fork fixes
407 - journal fork fixes
406 - removed issue with space inside renamed repository after deletion
408 - removed issue with space inside renamed repository after deletion
407 - fixed strange issue on formencode imports
409 - fixed strange issue on formencode imports
408 - fixed #126 Deleting repository on Windows, rename used incompatible chars.
410 - fixed #126 Deleting repository on Windows, rename used incompatible chars.
409 - #150 fixes for errors on repositories mapped in db but corrupted in
411 - #150 fixes for errors on repositories mapped in db but corrupted in
410 filesystem
412 filesystem
411 - fixed problem with ascendant characters in realm #181
413 - fixed problem with ascendant characters in realm #181
412 - fixed problem with sqlite file based database connection pool
414 - fixed problem with sqlite file based database connection pool
413 - whoosh indexer and code stats share the same dynamic extensions map
415 - whoosh indexer and code stats share the same dynamic extensions map
414 - fixes #188 - relationship delete of repo_to_perm entry on user removal
416 - fixes #188 - relationship delete of repo_to_perm entry on user removal
415 - fixes issue #189 Trending source files shows "show more" when no more exist
417 - fixes issue #189 Trending source files shows "show more" when no more exist
416 - fixes issue #197 Relative paths for pidlocks
418 - fixes issue #197 Relative paths for pidlocks
417 - fixes issue #198 password will require only 3 chars now for login form
419 - fixes issue #198 password will require only 3 chars now for login form
418 - fixes issue #199 wrong redirection for non admin users after creating a repository
420 - fixes issue #199 wrong redirection for non admin users after creating a repository
419 - fixes issues #202, bad db constraint made impossible to attach same group
421 - fixes issues #202, bad db constraint made impossible to attach same group
420 more than one time. Affects only mysql/postgres
422 more than one time. Affects only mysql/postgres
421 - fixes #218 os.kill patch for windows was missing sig param
423 - fixes #218 os.kill patch for windows was missing sig param
422 - improved rendering of dag (they are not trimmed anymore when number of
424 - improved rendering of dag (they are not trimmed anymore when number of
423 heads exceeds 5)
425 heads exceeds 5)
424
426
425 1.1.8 (**2011-04-12**)
427 1.1.8 (**2011-04-12**)
426 ----------------------
428 ----------------------
427
429
428 news
430 news
429 ++++
431 ++++
430
432
431 - improved windows support
433 - improved windows support
432
434
433 fixes
435 fixes
434 +++++
436 +++++
435
437
436 - fixed #140 freeze of python dateutil library, since new version is python2.x
438 - fixed #140 freeze of python dateutil library, since new version is python2.x
437 incompatible
439 incompatible
438 - setup-app will check for write permission in given path
440 - setup-app will check for write permission in given path
439 - cleaned up license info issue #149
441 - cleaned up license info issue #149
440 - fixes for issues #137,#116 and problems with unicode and accented characters.
442 - fixes for issues #137,#116 and problems with unicode and accented characters.
441 - fixes crashes on gravatar, when passed in email as unicode
443 - fixes crashes on gravatar, when passed in email as unicode
442 - fixed tooltip flickering problems
444 - fixed tooltip flickering problems
443 - fixed came_from redirection on windows
445 - fixed came_from redirection on windows
444 - fixed logging modules, and sql formatters
446 - fixed logging modules, and sql formatters
445 - windows fixes for os.kill issue #133
447 - windows fixes for os.kill issue #133
446 - fixes path splitting for windows issues #148
448 - fixes path splitting for windows issues #148
447 - fixed issue #143 wrong import on migration to 1.1.X
449 - fixed issue #143 wrong import on migration to 1.1.X
448 - fixed problems with displaying binary files, thanks to Thomas Waldmann
450 - fixed problems with displaying binary files, thanks to Thomas Waldmann
449 - removed name from archive files since it's breaking ui for long repo names
451 - removed name from archive files since it's breaking ui for long repo names
450 - fixed issue with archive headers sent to browser, thanks to Thomas Waldmann
452 - fixed issue with archive headers sent to browser, thanks to Thomas Waldmann
451 - fixed compatibility for 1024px displays, and larger dpi settings, thanks to
453 - fixed compatibility for 1024px displays, and larger dpi settings, thanks to
452 Thomas Waldmann
454 Thomas Waldmann
453 - fixed issue #166 summary pager was skipping 10 revisions on second page
455 - fixed issue #166 summary pager was skipping 10 revisions on second page
454
456
455
457
456 1.1.7 (**2011-03-23**)
458 1.1.7 (**2011-03-23**)
457 ----------------------
459 ----------------------
458
460
459 news
461 news
460 ++++
462 ++++
461
463
462 fixes
464 fixes
463 +++++
465 +++++
464
466
465 - fixed (again) #136 installation support for FreeBSD
467 - fixed (again) #136 installation support for FreeBSD
466
468
467
469
468 1.1.6 (**2011-03-21**)
470 1.1.6 (**2011-03-21**)
469 ----------------------
471 ----------------------
470
472
471 news
473 news
472 ++++
474 ++++
473
475
474 fixes
476 fixes
475 +++++
477 +++++
476
478
477 - fixed #136 installation support for FreeBSD
479 - fixed #136 installation support for FreeBSD
478 - RhodeCode will check for python version during installation
480 - RhodeCode will check for python version during installation
479
481
480 1.1.5 (**2011-03-17**)
482 1.1.5 (**2011-03-17**)
481 ----------------------
483 ----------------------
482
484
483 news
485 news
484 ++++
486 ++++
485
487
486 - basic windows support, by exchanging pybcrypt into sha256 for windows only
488 - basic windows support, by exchanging pybcrypt into sha256 for windows only
487 highly inspired by idea of mantis406
489 highly inspired by idea of mantis406
488
490
489 fixes
491 fixes
490 +++++
492 +++++
491
493
492 - fixed sorting by author in main page
494 - fixed sorting by author in main page
493 - fixed crashes with diffs on binary files
495 - fixed crashes with diffs on binary files
494 - fixed #131 problem with boolean values for LDAP
496 - fixed #131 problem with boolean values for LDAP
495 - fixed #122 mysql problems thanks to striker69
497 - fixed #122 mysql problems thanks to striker69
496 - fixed problem with errors on calling raw/raw_files/annotate functions
498 - fixed problem with errors on calling raw/raw_files/annotate functions
497 with unknown revisions
499 with unknown revisions
498 - fixed returned rawfiles attachment names with international character
500 - fixed returned rawfiles attachment names with international character
499 - cleaned out docs, big thanks to Jason Harris
501 - cleaned out docs, big thanks to Jason Harris
500
502
501 1.1.4 (**2011-02-19**)
503 1.1.4 (**2011-02-19**)
502 ----------------------
504 ----------------------
503
505
504 news
506 news
505 ++++
507 ++++
506
508
507 fixes
509 fixes
508 +++++
510 +++++
509
511
510 - fixed formencode import problem on settings page, that caused server crash
512 - fixed formencode import problem on settings page, that caused server crash
511 when that page was accessed as first after server start
513 when that page was accessed as first after server start
512 - journal fixes
514 - journal fixes
513 - fixed option to access repository just by entering http://server/<repo_name>
515 - fixed option to access repository just by entering http://server/<repo_name>
514
516
515 1.1.3 (**2011-02-16**)
517 1.1.3 (**2011-02-16**)
516 ----------------------
518 ----------------------
517
519
518 news
520 news
519 ++++
521 ++++
520
522
521 - implemented #102 allowing the '.' character in username
523 - implemented #102 allowing the '.' character in username
522 - added option to access repository just by entering http://server/<repo_name>
524 - added option to access repository just by entering http://server/<repo_name>
523 - celery task ignores result for better performance
525 - celery task ignores result for better performance
524
526
525 fixes
527 fixes
526 +++++
528 +++++
527
529
528 - fixed ehlo command and non auth mail servers on smtp_lib. Thanks to
530 - fixed ehlo command and non auth mail servers on smtp_lib. Thanks to
529 apollo13 and Johan Walles
531 apollo13 and Johan Walles
530 - small fixes in journal
532 - small fixes in journal
531 - fixed problems with getting setting for celery from .ini files
533 - fixed problems with getting setting for celery from .ini files
532 - registration, password reset and login boxes share the same title as main
534 - registration, password reset and login boxes share the same title as main
533 application now
535 application now
534 - fixed #113: to high permissions to fork repository
536 - fixed #113: to high permissions to fork repository
535 - fixed problem with '[' chars in commit messages in journal
537 - fixed problem with '[' chars in commit messages in journal
536 - removed issue with space inside renamed repository after deletion
538 - removed issue with space inside renamed repository after deletion
537 - db transaction fixes when filesystem repository creation failed
539 - db transaction fixes when filesystem repository creation failed
538 - fixed #106 relation issues on databases different than sqlite
540 - fixed #106 relation issues on databases different than sqlite
539 - fixed static files paths links to use of url() method
541 - fixed static files paths links to use of url() method
540
542
541 1.1.2 (**2011-01-12**)
543 1.1.2 (**2011-01-12**)
542 ----------------------
544 ----------------------
543
545
544 news
546 news
545 ++++
547 ++++
546
548
547
549
548 fixes
550 fixes
549 +++++
551 +++++
550
552
551 - fixes #98 protection against float division of percentage stats
553 - fixes #98 protection against float division of percentage stats
552 - fixed graph bug
554 - fixed graph bug
553 - forced webhelpers version since it was making troubles during installation
555 - forced webhelpers version since it was making troubles during installation
554
556
555 1.1.1 (**2011-01-06**)
557 1.1.1 (**2011-01-06**)
556 ----------------------
558 ----------------------
557
559
558 news
560 news
559 ++++
561 ++++
560
562
561 - added force https option into ini files for easier https usage (no need to
563 - added force https option into ini files for easier https usage (no need to
562 set server headers with this options)
564 set server headers with this options)
563 - small css updates
565 - small css updates
564
566
565 fixes
567 fixes
566 +++++
568 +++++
567
569
568 - fixed #96 redirect loop on files view on repositories without changesets
570 - fixed #96 redirect loop on files view on repositories without changesets
569 - fixed #97 unicode string passed into server header in special cases (mod_wsgi)
571 - fixed #97 unicode string passed into server header in special cases (mod_wsgi)
570 and server crashed with errors
572 and server crashed with errors
571 - fixed large tooltips problems on main page
573 - fixed large tooltips problems on main page
572 - fixed #92 whoosh indexer is more error proof
574 - fixed #92 whoosh indexer is more error proof
573
575
574 1.1.0 (**2010-12-18**)
576 1.1.0 (**2010-12-18**)
575 ----------------------
577 ----------------------
576
578
577 news
579 news
578 ++++
580 ++++
579
581
580 - rewrite of internals for vcs >=0.1.10
582 - rewrite of internals for vcs >=0.1.10
581 - uses mercurial 1.7 with dotencode disabled for maintaining compatibility
583 - uses mercurial 1.7 with dotencode disabled for maintaining compatibility
582 with older clients
584 with older clients
583 - anonymous access, authentication via ldap
585 - anonymous access, authentication via ldap
584 - performance upgrade for cached repos list - each repository has its own
586 - performance upgrade for cached repos list - each repository has its own
585 cache that's invalidated when needed.
587 cache that's invalidated when needed.
586 - performance upgrades on repositories with large amount of commits (20K+)
588 - performance upgrades on repositories with large amount of commits (20K+)
587 - main page quick filter for filtering repositories
589 - main page quick filter for filtering repositories
588 - user dashboards with ability to follow chosen repositories actions
590 - user dashboards with ability to follow chosen repositories actions
589 - sends email to admin on new user registration
591 - sends email to admin on new user registration
590 - added cache/statistics reset options into repository settings
592 - added cache/statistics reset options into repository settings
591 - more detailed action logger (based on hooks) with pushed changesets lists
593 - more detailed action logger (based on hooks) with pushed changesets lists
592 and options to disable those hooks from admin panel
594 and options to disable those hooks from admin panel
593 - introduced new enhanced changelog for merges that shows more accurate results
595 - introduced new enhanced changelog for merges that shows more accurate results
594 - new improved and faster code stats (based on pygments lexers mapping tables,
596 - new improved and faster code stats (based on pygments lexers mapping tables,
595 showing up to 10 trending sources for each repository. Additionally stats
597 showing up to 10 trending sources for each repository. Additionally stats
596 can be disabled in repository settings.
598 can be disabled in repository settings.
597 - gui optimizations, fixed application width to 1024px
599 - gui optimizations, fixed application width to 1024px
598 - added cut off (for large files/changesets) limit into config files
600 - added cut off (for large files/changesets) limit into config files
599 - whoosh, celeryd, upgrade moved to paster command
601 - whoosh, celeryd, upgrade moved to paster command
600 - other than sqlite database backends can be used
602 - other than sqlite database backends can be used
601
603
602 fixes
604 fixes
603 +++++
605 +++++
604
606
605 - fixes #61 forked repo was showing only after cache expired
607 - fixes #61 forked repo was showing only after cache expired
606 - fixes #76 no confirmation on user deletes
608 - fixes #76 no confirmation on user deletes
607 - fixes #66 Name field misspelled
609 - fixes #66 Name field misspelled
608 - fixes #72 block user removal when he owns repositories
610 - fixes #72 block user removal when he owns repositories
609 - fixes #69 added password confirmation fields
611 - fixes #69 added password confirmation fields
610 - fixes #87 RhodeCode crashes occasionally on updating repository owner
612 - fixes #87 RhodeCode crashes occasionally on updating repository owner
611 - fixes #82 broken annotations on files with more than 1 blank line at the end
613 - fixes #82 broken annotations on files with more than 1 blank line at the end
612 - a lot of fixes and tweaks for file browser
614 - a lot of fixes and tweaks for file browser
613 - fixed detached session issues
615 - fixed detached session issues
614 - fixed when user had no repos he would see all repos listed in my account
616 - fixed when user had no repos he would see all repos listed in my account
615 - fixed ui() instance bug when global hgrc settings was loaded for server
617 - fixed ui() instance bug when global hgrc settings was loaded for server
616 instance and all hgrc options were merged with our db ui() object
618 instance and all hgrc options were merged with our db ui() object
617 - numerous small bugfixes
619 - numerous small bugfixes
618
620
619 (special thanks for TkSoh for detailed feedback)
621 (special thanks for TkSoh for detailed feedback)
620
622
621
623
622 1.0.2 (**2010-11-12**)
624 1.0.2 (**2010-11-12**)
623 ----------------------
625 ----------------------
624
626
625 news
627 news
626 ++++
628 ++++
627
629
628 - tested under python2.7
630 - tested under python2.7
629 - bumped sqlalchemy and celery versions
631 - bumped sqlalchemy and celery versions
630
632
631 fixes
633 fixes
632 +++++
634 +++++
633
635
634 - fixed #59 missing graph.js
636 - fixed #59 missing graph.js
635 - fixed repo_size crash when repository had broken symlinks
637 - fixed repo_size crash when repository had broken symlinks
636 - fixed python2.5 crashes.
638 - fixed python2.5 crashes.
637
639
638
640
639 1.0.1 (**2010-11-10**)
641 1.0.1 (**2010-11-10**)
640 ----------------------
642 ----------------------
641
643
642 news
644 news
643 ++++
645 ++++
644
646
645 - small css updated
647 - small css updated
646
648
647 fixes
649 fixes
648 +++++
650 +++++
649
651
650 - fixed #53 python2.5 incompatible enumerate calls
652 - fixed #53 python2.5 incompatible enumerate calls
651 - fixed #52 disable mercurial extension for web
653 - fixed #52 disable mercurial extension for web
652 - fixed #51 deleting repositories don't delete it's dependent objects
654 - fixed #51 deleting repositories don't delete it's dependent objects
653
655
654
656
655 1.0.0 (**2010-11-02**)
657 1.0.0 (**2010-11-02**)
656 ----------------------
658 ----------------------
657
659
658 - security bugfix simplehg wasn't checking for permissions on commands
660 - security bugfix simplehg wasn't checking for permissions on commands
659 other than pull or push.
661 other than pull or push.
660 - fixed doubled messages after push or pull in admin journal
662 - fixed doubled messages after push or pull in admin journal
661 - templating and css corrections, fixed repo switcher on chrome, updated titles
663 - templating and css corrections, fixed repo switcher on chrome, updated titles
662 - admin menu accessible from options menu on repository view
664 - admin menu accessible from options menu on repository view
663 - permissions cached queries
665 - permissions cached queries
664
666
665 1.0.0rc4 (**2010-10-12**)
667 1.0.0rc4 (**2010-10-12**)
666 --------------------------
668 --------------------------
667
669
668 - fixed python2.5 missing simplejson imports (thanks to Jens BΓ€ckman)
670 - fixed python2.5 missing simplejson imports (thanks to Jens BΓ€ckman)
669 - removed cache_manager settings from sqlalchemy meta
671 - removed cache_manager settings from sqlalchemy meta
670 - added sqlalchemy cache settings to ini files
672 - added sqlalchemy cache settings to ini files
671 - validated password length and added second try of failure on paster setup-app
673 - validated password length and added second try of failure on paster setup-app
672 - fixed setup database destroy prompt even when there was no db
674 - fixed setup database destroy prompt even when there was no db
673
675
674
676
675 1.0.0rc3 (**2010-10-11**)
677 1.0.0rc3 (**2010-10-11**)
676 -------------------------
678 -------------------------
677
679
678 - fixed i18n during installation.
680 - fixed i18n during installation.
679
681
680 1.0.0rc2 (**2010-10-11**)
682 1.0.0rc2 (**2010-10-11**)
681 -------------------------
683 -------------------------
682
684
683 - Disabled dirsize in file browser, it's causing nasty bug when dir renames
685 - Disabled dirsize in file browser, it's causing nasty bug when dir renames
684 occure. After vcs is fixed it'll be put back again.
686 occure. After vcs is fixed it'll be put back again.
685 - templating/css rewrites, optimized css. No newline at end of file
687 - templating/css rewrites, optimized css.
@@ -1,230 +1,240 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """
2 """
3 rhodecode.lib.indexers.__init__
3 rhodecode.lib.indexers.__init__
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5
5
6 Whoosh indexing module for RhodeCode
6 Whoosh indexing module for RhodeCode
7
7
8 :created_on: Aug 17, 2010
8 :created_on: Aug 17, 2010
9 :author: marcink
9 :author: marcink
10 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
10 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
11 :license: GPLv3, see COPYING for more details.
11 :license: GPLv3, see COPYING for more details.
12 """
12 """
13 # This program is free software: you can redistribute it and/or modify
13 # This program is free software: you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation, either version 3 of the License, or
15 # the Free Software Foundation, either version 3 of the License, or
16 # (at your option) any later version.
16 # (at your option) any later version.
17 #
17 #
18 # This program is distributed in the hope that it will be useful,
18 # This program is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
21 # GNU General Public License for more details.
22 #
22 #
23 # You should have received a copy of the GNU General Public License
23 # You should have received a copy of the GNU General Public License
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25 import os
25 import os
26 import sys
26 import sys
27 import traceback
27 import traceback
28 import logging
28 import logging
29 from os.path import dirname as dn, join as jn
29 from os.path import dirname as dn, join as jn
30
30
31 #to get the rhodecode import
31 #to get the rhodecode import
32 sys.path.append(dn(dn(dn(os.path.realpath(__file__)))))
32 sys.path.append(dn(dn(dn(os.path.realpath(__file__)))))
33
33
34 from string import strip
34 from string import strip
35 from shutil import rmtree
35 from shutil import rmtree
36
36
37 from whoosh.analysis import RegexTokenizer, LowercaseFilter, StopFilter
37 from whoosh.analysis import RegexTokenizer, LowercaseFilter, StopFilter
38 from whoosh.fields import TEXT, ID, STORED, Schema, FieldType
38 from whoosh.fields import TEXT, ID, STORED, Schema, FieldType
39 from whoosh.index import create_in, open_dir
39 from whoosh.index import create_in, open_dir
40 from whoosh.formats import Characters
40 from whoosh.formats import Characters
41 from whoosh.highlight import highlight, HtmlFormatter, ContextFragmenter
41 from whoosh.highlight import highlight, HtmlFormatter, ContextFragmenter
42
42
43 from webhelpers.html.builder import escape
43 from webhelpers.html.builder import escape
44 from sqlalchemy import engine_from_config
44 from sqlalchemy import engine_from_config
45
45
46 from rhodecode.model import init_model
46 from rhodecode.model import init_model
47 from rhodecode.model.scm import ScmModel
47 from rhodecode.model.scm import ScmModel
48 from rhodecode.model.repo import RepoModel
48 from rhodecode.model.repo import RepoModel
49 from rhodecode.config.environment import load_environment
49 from rhodecode.config.environment import load_environment
50 from rhodecode.lib.utils2 import LazyProperty
50 from rhodecode.lib.utils2 import LazyProperty
51 from rhodecode.lib.utils import BasePasterCommand, Command, add_cache,\
51 from rhodecode.lib.utils import BasePasterCommand, Command, add_cache,\
52 load_rcextensions
52 load_rcextensions
53
53
54 # CUSTOM ANALYZER wordsplit + lowercase filter
54 # CUSTOM ANALYZER wordsplit + lowercase filter
55 ANALYZER = RegexTokenizer(expression=r"\w+") | LowercaseFilter()
55 ANALYZER = RegexTokenizer(expression=r"\w+") | LowercaseFilter()
56
56
57
57
58 #INDEX SCHEMA DEFINITION
58 #INDEX SCHEMA DEFINITION
59 SCHEMA = Schema(
59 SCHEMA = Schema(
60 owner=TEXT(),
60 owner=TEXT(),
61 repository=TEXT(stored=True),
61 repository=TEXT(stored=True),
62 path=TEXT(stored=True),
62 path=TEXT(stored=True),
63 content=FieldType(format=Characters(), analyzer=ANALYZER,
63 content=FieldType(format=Characters(), analyzer=ANALYZER,
64 scorable=True, stored=True),
64 scorable=True, stored=True),
65 modtime=STORED(),
65 modtime=STORED(),
66 extension=TEXT(stored=True)
66 extension=TEXT(stored=True)
67 )
67 )
68
68
69 IDX_NAME = 'HG_INDEX'
69 IDX_NAME = 'HG_INDEX'
70 FORMATTER = HtmlFormatter('span', between='\n<span class="break">...</span>\n')
70 FORMATTER = HtmlFormatter('span', between='\n<span class="break">...</span>\n')
71 FRAGMENTER = ContextFragmenter(200)
71 FRAGMENTER = ContextFragmenter(200)
72
72
73
73
74 class MakeIndex(BasePasterCommand):
74 class MakeIndex(BasePasterCommand):
75
75
76 max_args = 1
76 max_args = 1
77 min_args = 1
77 min_args = 1
78
78
79 usage = "CONFIG_FILE"
79 usage = "CONFIG_FILE"
80 summary = "Creates index for full text search given configuration file"
80 summary = "Creates index for full text search given configuration file"
81 group_name = "RhodeCode"
81 group_name = "RhodeCode"
82 takes_config_file = -1
82 takes_config_file = -1
83 parser = Command.standard_parser(verbose=True)
83 parser = Command.standard_parser(verbose=True)
84
84
85 def command(self):
85 def command(self):
86 logging.config.fileConfig(self.path_to_ini_file)
86 logging.config.fileConfig(self.path_to_ini_file)
87 from pylons import config
87 from pylons import config
88 add_cache(config)
88 add_cache(config)
89 engine = engine_from_config(config, 'sqlalchemy.db1.')
89 engine = engine_from_config(config, 'sqlalchemy.db1.')
90 init_model(engine)
90 init_model(engine)
91 index_location = config['index_dir']
91 index_location = config['index_dir']
92 repo_location = self.options.repo_location \
92 repo_location = self.options.repo_location \
93 if self.options.repo_location else RepoModel().repos_path
93 if self.options.repo_location else RepoModel().repos_path
94 repo_list = map(strip, self.options.repo_list.split(',')) \
94 repo_list = map(strip, self.options.repo_list.split(',')) \
95 if self.options.repo_list else None
95 if self.options.repo_list else None
96 repo_update_list = map(strip, self.options.repo_update_list.split(',')) \
97 if self.options.repo_update_list else None
96 load_rcextensions(config['here'])
98 load_rcextensions(config['here'])
97 #======================================================================
99 #======================================================================
98 # WHOOSH DAEMON
100 # WHOOSH DAEMON
99 #======================================================================
101 #======================================================================
100 from rhodecode.lib.pidlock import LockHeld, DaemonLock
102 from rhodecode.lib.pidlock import LockHeld, DaemonLock
101 from rhodecode.lib.indexers.daemon import WhooshIndexingDaemon
103 from rhodecode.lib.indexers.daemon import WhooshIndexingDaemon
102 try:
104 try:
103 l = DaemonLock(file_=jn(dn(dn(index_location)), 'make_index.lock'))
105 l = DaemonLock(file_=jn(dn(dn(index_location)), 'make_index.lock'))
104 WhooshIndexingDaemon(index_location=index_location,
106 WhooshIndexingDaemon(index_location=index_location,
105 repo_location=repo_location,
107 repo_location=repo_location,
106 repo_list=repo_list,)\
108 repo_list=repo_list,
109 repo_update_list=repo_update_list)\
107 .run(full_index=self.options.full_index)
110 .run(full_index=self.options.full_index)
108 l.release()
111 l.release()
109 except LockHeld:
112 except LockHeld:
110 sys.exit(1)
113 sys.exit(1)
111
114
112 def update_parser(self):
115 def update_parser(self):
113 self.parser.add_option('--repo-location',
116 self.parser.add_option('--repo-location',
114 action='store',
117 action='store',
115 dest='repo_location',
118 dest='repo_location',
116 help="Specifies repositories location to index OPTIONAL",
119 help="Specifies repositories location to index OPTIONAL",
117 )
120 )
118 self.parser.add_option('--index-only',
121 self.parser.add_option('--index-only',
119 action='store',
122 action='store',
120 dest='repo_list',
123 dest='repo_list',
121 help="Specifies a comma separated list of repositores "
124 help="Specifies a comma separated list of repositores "
122 "to build index on OPTIONAL",
125 "to build index on. If not given all repositories "
126 "are scanned for indexing. OPTIONAL",
127 )
128 self.parser.add_option('--update-only',
129 action='store',
130 dest='repo_update_list',
131 help="Specifies a comma separated list of repositores "
132 "to re-build index on. OPTIONAL",
123 )
133 )
124 self.parser.add_option('-f',
134 self.parser.add_option('-f',
125 action='store_true',
135 action='store_true',
126 dest='full_index',
136 dest='full_index',
127 help="Specifies that index should be made full i.e"
137 help="Specifies that index should be made full i.e"
128 " destroy old and build from scratch",
138 " destroy old and build from scratch",
129 default=False)
139 default=False)
130
140
131
141
132 class WhooshResultWrapper(object):
142 class WhooshResultWrapper(object):
133 def __init__(self, search_type, searcher, matcher, highlight_items,
143 def __init__(self, search_type, searcher, matcher, highlight_items,
134 repo_location):
144 repo_location):
135 self.search_type = search_type
145 self.search_type = search_type
136 self.searcher = searcher
146 self.searcher = searcher
137 self.matcher = matcher
147 self.matcher = matcher
138 self.highlight_items = highlight_items
148 self.highlight_items = highlight_items
139 self.fragment_size = 200
149 self.fragment_size = 200
140 self.repo_location = repo_location
150 self.repo_location = repo_location
141
151
142 @LazyProperty
152 @LazyProperty
143 def doc_ids(self):
153 def doc_ids(self):
144 docs_id = []
154 docs_id = []
145 while self.matcher.is_active():
155 while self.matcher.is_active():
146 docnum = self.matcher.id()
156 docnum = self.matcher.id()
147 chunks = [offsets for offsets in self.get_chunks()]
157 chunks = [offsets for offsets in self.get_chunks()]
148 docs_id.append([docnum, chunks])
158 docs_id.append([docnum, chunks])
149 self.matcher.next()
159 self.matcher.next()
150 return docs_id
160 return docs_id
151
161
152 def __str__(self):
162 def __str__(self):
153 return '<%s at %s>' % (self.__class__.__name__, len(self.doc_ids))
163 return '<%s at %s>' % (self.__class__.__name__, len(self.doc_ids))
154
164
155 def __repr__(self):
165 def __repr__(self):
156 return self.__str__()
166 return self.__str__()
157
167
158 def __len__(self):
168 def __len__(self):
159 return len(self.doc_ids)
169 return len(self.doc_ids)
160
170
161 def __iter__(self):
171 def __iter__(self):
162 """
172 """
163 Allows Iteration over results,and lazy generate content
173 Allows Iteration over results,and lazy generate content
164
174
165 *Requires* implementation of ``__getitem__`` method.
175 *Requires* implementation of ``__getitem__`` method.
166 """
176 """
167 for docid in self.doc_ids:
177 for docid in self.doc_ids:
168 yield self.get_full_content(docid)
178 yield self.get_full_content(docid)
169
179
170 def __getitem__(self, key):
180 def __getitem__(self, key):
171 """
181 """
172 Slicing of resultWrapper
182 Slicing of resultWrapper
173 """
183 """
174 i, j = key.start, key.stop
184 i, j = key.start, key.stop
175
185
176 slices = []
186 slices = []
177 for docid in self.doc_ids[i:j]:
187 for docid in self.doc_ids[i:j]:
178 slices.append(self.get_full_content(docid))
188 slices.append(self.get_full_content(docid))
179 return slices
189 return slices
180
190
181 def get_full_content(self, docid):
191 def get_full_content(self, docid):
182 res = self.searcher.stored_fields(docid[0])
192 res = self.searcher.stored_fields(docid[0])
183 full_repo_path = jn(self.repo_location, res['repository'])
193 full_repo_path = jn(self.repo_location, res['repository'])
184 f_path = res['path'].split(full_repo_path)[-1]
194 f_path = res['path'].split(full_repo_path)[-1]
185 f_path = f_path.lstrip(os.sep)
195 f_path = f_path.lstrip(os.sep)
186
196
187 content_short = self.get_short_content(res, docid[1])
197 content_short = self.get_short_content(res, docid[1])
188 res.update({'content_short': content_short,
198 res.update({'content_short': content_short,
189 'content_short_hl': self.highlight(content_short),
199 'content_short_hl': self.highlight(content_short),
190 'f_path': f_path})
200 'f_path': f_path})
191
201
192 return res
202 return res
193
203
194 def get_short_content(self, res, chunks):
204 def get_short_content(self, res, chunks):
195
205
196 return ''.join([res['content'][chunk[0]:chunk[1]] for chunk in chunks])
206 return ''.join([res['content'][chunk[0]:chunk[1]] for chunk in chunks])
197
207
198 def get_chunks(self):
208 def get_chunks(self):
199 """
209 """
200 Smart function that implements chunking the content
210 Smart function that implements chunking the content
201 but not overlap chunks so it doesn't highlight the same
211 but not overlap chunks so it doesn't highlight the same
202 close occurrences twice.
212 close occurrences twice.
203
213
204 :param matcher:
214 :param matcher:
205 :param size:
215 :param size:
206 """
216 """
207 memory = [(0, 0)]
217 memory = [(0, 0)]
208 for span in self.matcher.spans():
218 for span in self.matcher.spans():
209 start = span.startchar or 0
219 start = span.startchar or 0
210 end = span.endchar or 0
220 end = span.endchar or 0
211 start_offseted = max(0, start - self.fragment_size)
221 start_offseted = max(0, start - self.fragment_size)
212 end_offseted = end + self.fragment_size
222 end_offseted = end + self.fragment_size
213
223
214 if start_offseted < memory[-1][1]:
224 if start_offseted < memory[-1][1]:
215 start_offseted = memory[-1][1]
225 start_offseted = memory[-1][1]
216 memory.append((start_offseted, end_offseted,))
226 memory.append((start_offseted, end_offseted,))
217 yield (start_offseted, end_offseted,)
227 yield (start_offseted, end_offseted,)
218
228
219 def highlight(self, content, top=5):
229 def highlight(self, content, top=5):
220 if self.search_type != 'content':
230 if self.search_type != 'content':
221 return ''
231 return ''
222 hl = highlight(
232 hl = highlight(
223 text=escape(content),
233 text=escape(content),
224 terms=self.highlight_items,
234 terms=self.highlight_items,
225 analyzer=ANALYZER,
235 analyzer=ANALYZER,
226 fragmenter=FRAGMENTER,
236 fragmenter=FRAGMENTER,
227 formatter=FORMATTER,
237 formatter=FORMATTER,
228 top=top
238 top=top
229 )
239 )
230 return hl
240 return hl
@@ -1,238 +1,251 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """
2 """
3 rhodecode.lib.indexers.daemon
3 rhodecode.lib.indexers.daemon
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5
5
6 A daemon will read from task table and run tasks
6 A daemon will read from task table and run tasks
7
7
8 :created_on: Jan 26, 2010
8 :created_on: Jan 26, 2010
9 :author: marcink
9 :author: marcink
10 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
10 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
11 :license: GPLv3, see COPYING for more details.
11 :license: GPLv3, see COPYING for more details.
12 """
12 """
13 # This program is free software: you can redistribute it and/or modify
13 # This program is free software: you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation, either version 3 of the License, or
15 # the Free Software Foundation, either version 3 of the License, or
16 # (at your option) any later version.
16 # (at your option) any later version.
17 #
17 #
18 # This program is distributed in the hope that it will be useful,
18 # This program is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
21 # GNU General Public License for more details.
22 #
22 #
23 # You should have received a copy of the GNU General Public License
23 # You should have received a copy of the GNU General Public License
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25
25
26 import os
26 import os
27 import sys
27 import sys
28 import logging
28 import logging
29 import traceback
29 import traceback
30
30
31 from shutil import rmtree
31 from shutil import rmtree
32 from time import mktime
32 from time import mktime
33
33
34 from os.path import dirname as dn
34 from os.path import dirname as dn
35 from os.path import join as jn
35 from os.path import join as jn
36
36
37 #to get the rhodecode import
37 #to get the rhodecode import
38 project_path = dn(dn(dn(dn(os.path.realpath(__file__)))))
38 project_path = dn(dn(dn(dn(os.path.realpath(__file__)))))
39 sys.path.append(project_path)
39 sys.path.append(project_path)
40
40
41 from rhodecode.config.conf import INDEX_EXTENSIONS
41 from rhodecode.config.conf import INDEX_EXTENSIONS
42 from rhodecode.model.scm import ScmModel
42 from rhodecode.model.scm import ScmModel
43 from rhodecode.lib.utils2 import safe_unicode
43 from rhodecode.lib.utils2 import safe_unicode
44 from rhodecode.lib.indexers import SCHEMA, IDX_NAME
44 from rhodecode.lib.indexers import SCHEMA, IDX_NAME
45
45
46 from rhodecode.lib.vcs.exceptions import ChangesetError, RepositoryError, \
46 from rhodecode.lib.vcs.exceptions import ChangesetError, RepositoryError, \
47 NodeDoesNotExistError
47 NodeDoesNotExistError
48
48
49 from whoosh.index import create_in, open_dir
49 from whoosh.index import create_in, open_dir
50
50
51 log = logging.getLogger('whoosh_indexer')
51 log = logging.getLogger('whoosh_indexer')
52
52
53
53
54 class WhooshIndexingDaemon(object):
54 class WhooshIndexingDaemon(object):
55 """
55 """
56 Daemon for atomic jobs
56 Daemon for atomic indexing jobs
57 """
57 """
58
58
59 def __init__(self, indexname=IDX_NAME, index_location=None,
59 def __init__(self, indexname=IDX_NAME, index_location=None,
60 repo_location=None, sa=None, repo_list=None):
60 repo_location=None, sa=None, repo_list=None,
61 repo_update_list=None):
61 self.indexname = indexname
62 self.indexname = indexname
62
63
63 self.index_location = index_location
64 self.index_location = index_location
64 if not index_location:
65 if not index_location:
65 raise Exception('You have to provide index location')
66 raise Exception('You have to provide index location')
66
67
67 self.repo_location = repo_location
68 self.repo_location = repo_location
68 if not repo_location:
69 if not repo_location:
69 raise Exception('You have to provide repositories location')
70 raise Exception('You have to provide repositories location')
70
71
71 self.repo_paths = ScmModel(sa).repo_scan(self.repo_location)
72 self.repo_paths = ScmModel(sa).repo_scan(self.repo_location)
72
73
74 #filter repo list
73 if repo_list:
75 if repo_list:
74 filtered_repo_paths = {}
76 self.filtered_repo_paths = {}
75 for repo_name, repo in self.repo_paths.items():
77 for repo_name, repo in self.repo_paths.items():
76 if repo_name in repo_list:
78 if repo_name in repo_list:
77 filtered_repo_paths[repo_name] = repo
79 self.filtered_repo_paths[repo_name] = repo
80
81 self.repo_paths = self.filtered_repo_paths
78
82
79 self.repo_paths = filtered_repo_paths
83 #filter update repo list
84 self.filtered_repo_update_paths = {}
85 if repo_update_list:
86 self.filtered_repo_update_paths = {}
87 for repo_name, repo in self.repo_paths.items():
88 if repo_name in repo_update_list:
89 self.filtered_repo_update_paths[repo_name] = repo
90 self.repo_paths = self.filtered_repo_update_paths
80
91
81 self.initial = False
92 self.initial = False
82 if not os.path.isdir(self.index_location):
93 if not os.path.isdir(self.index_location):
83 os.makedirs(self.index_location)
94 os.makedirs(self.index_location)
84 log.info('Cannot run incremental index since it does not'
95 log.info('Cannot run incremental index since it does not'
85 ' yet exist running full build')
96 ' yet exist running full build')
86 self.initial = True
97 self.initial = True
87
98
88 def get_paths(self, repo):
99 def get_paths(self, repo):
89 """
100 """
90 recursive walk in root dir and return a set of all path in that dir
101 recursive walk in root dir and return a set of all path in that dir
91 based on repository walk function
102 based on repository walk function
92 """
103 """
93 index_paths_ = set()
104 index_paths_ = set()
94 try:
105 try:
95 tip = repo.get_changeset('tip')
106 tip = repo.get_changeset('tip')
96 for topnode, dirs, files in tip.walk('/'):
107 for topnode, dirs, files in tip.walk('/'):
97 for f in files:
108 for f in files:
98 index_paths_.add(jn(repo.path, f.path))
109 index_paths_.add(jn(repo.path, f.path))
99
110
100 except RepositoryError, e:
111 except RepositoryError, e:
101 log.debug(traceback.format_exc())
112 log.debug(traceback.format_exc())
102 pass
113 pass
103 return index_paths_
114 return index_paths_
104
115
105 def get_node(self, repo, path):
116 def get_node(self, repo, path):
106 n_path = path[len(repo.path) + 1:]
117 n_path = path[len(repo.path) + 1:]
107 node = repo.get_changeset().get_node(n_path)
118 node = repo.get_changeset().get_node(n_path)
108 return node
119 return node
109
120
110 def get_node_mtime(self, node):
121 def get_node_mtime(self, node):
111 return mktime(node.last_changeset.date.timetuple())
122 return mktime(node.last_changeset.date.timetuple())
112
123
113 def add_doc(self, writer, path, repo, repo_name):
124 def add_doc(self, writer, path, repo, repo_name):
114 """
125 """
115 Adding doc to writer this function itself fetches data from
126 Adding doc to writer this function itself fetches data from
116 the instance of vcs backend
127 the instance of vcs backend
117 """
128 """
118
129
119 node = self.get_node(repo, path)
130 node = self.get_node(repo, path)
120 indexed = indexed_w_content = 0
131 indexed = indexed_w_content = 0
121 # we just index the content of chosen files, and skip binary files
132 # we just index the content of chosen files, and skip binary files
122 if node.extension in INDEX_EXTENSIONS and not node.is_binary:
133 if node.extension in INDEX_EXTENSIONS and not node.is_binary:
123 u_content = node.content
134 u_content = node.content
124 if not isinstance(u_content, unicode):
135 if not isinstance(u_content, unicode):
125 log.warning(' >> %s Could not get this content as unicode '
136 log.warning(' >> %s Could not get this content as unicode '
126 'replacing with empty content' % path)
137 'replacing with empty content' % path)
127 u_content = u''
138 u_content = u''
128 else:
139 else:
129 log.debug(' >> %s [WITH CONTENT]' % path)
140 log.debug(' >> %s [WITH CONTENT]' % path)
130 indexed_w_content += 1
141 indexed_w_content += 1
131
142
132 else:
143 else:
133 log.debug(' >> %s' % path)
144 log.debug(' >> %s' % path)
134 # just index file name without it's content
145 # just index file name without it's content
135 u_content = u''
146 u_content = u''
136 indexed += 1
147 indexed += 1
137
148
138 writer.add_document(
149 writer.add_document(
139 owner=unicode(repo.contact),
150 owner=unicode(repo.contact),
140 repository=safe_unicode(repo_name),
151 repository=safe_unicode(repo_name),
141 path=safe_unicode(path),
152 path=safe_unicode(path),
142 content=u_content,
153 content=u_content,
143 modtime=self.get_node_mtime(node),
154 modtime=self.get_node_mtime(node),
144 extension=node.extension
155 extension=node.extension
145 )
156 )
146 return indexed, indexed_w_content
157 return indexed, indexed_w_content
147
158
148 def build_index(self):
159 def build_index(self):
149 if os.path.exists(self.index_location):
160 if os.path.exists(self.index_location):
150 log.debug('removing previous index')
161 log.debug('removing previous index')
151 rmtree(self.index_location)
162 rmtree(self.index_location)
152
163
153 if not os.path.exists(self.index_location):
164 if not os.path.exists(self.index_location):
154 os.mkdir(self.index_location)
165 os.mkdir(self.index_location)
155
166
156 idx = create_in(self.index_location, SCHEMA, indexname=IDX_NAME)
167 idx = create_in(self.index_location, SCHEMA, indexname=IDX_NAME)
157 writer = idx.writer()
168 writer = idx.writer()
158 log.debug('BUILDIN INDEX FOR EXTENSIONS %s' % INDEX_EXTENSIONS)
169 log.debug('BUILDIN INDEX FOR EXTENSIONS %s' % INDEX_EXTENSIONS)
159 for repo_name, repo in self.repo_paths.items():
170 for repo_name, repo in self.repo_paths.items():
160 log.debug('building index @ %s' % repo.path)
171 log.debug('building index @ %s' % repo.path)
161 i_cnt = iwc_cnt = 0
172 i_cnt = iwc_cnt = 0
162 for idx_path in self.get_paths(repo):
173 for idx_path in self.get_paths(repo):
163 i, iwc = self.add_doc(writer, idx_path, repo, repo_name)
174 i, iwc = self.add_doc(writer, idx_path, repo, repo_name)
164 i_cnt += i
175 i_cnt += i
165 iwc_cnt += iwc
176 iwc_cnt += iwc
166 log.debug('added %s files %s with content for repo %s' % (
177 log.debug('added %s files %s with content for repo %s' % (
167 i_cnt + iwc_cnt, iwc_cnt, repo.path)
178 i_cnt + iwc_cnt, iwc_cnt, repo.path)
168 )
179 )
169
180
170 log.debug('>> COMMITING CHANGES <<')
181 log.debug('>> COMMITING CHANGES <<')
171 writer.commit(merge=True)
182 writer.commit(merge=True)
172 log.debug('>>> FINISHED BUILDING INDEX <<<')
183 log.debug('>>> FINISHED BUILDING INDEX <<<')
173
184
174 def update_index(self):
185 def update_index(self):
175 log.debug(('STARTING INCREMENTAL INDEXING UPDATE FOR EXTENSIONS %s '
186 log.debug((u'STARTING INCREMENTAL INDEXING UPDATE FOR EXTENSIONS %s '
176 'AND REPOS %s') % (INDEX_EXTENSIONS, self.repo_paths))
187 'AND REPOS %s') % (INDEX_EXTENSIONS, self.repo_paths.keys()))
177
188
178 idx = open_dir(self.index_location, indexname=self.indexname)
189 idx = open_dir(self.index_location, indexname=self.indexname)
179 # The set of all paths in the index
190 # The set of all paths in the index
180 indexed_paths = set()
191 indexed_paths = set()
181 # The set of all paths we need to re-index
192 # The set of all paths we need to re-index
182 to_index = set()
193 to_index = set()
183
194
184 reader = idx.reader()
195 reader = idx.reader()
185 writer = idx.writer()
196 writer = idx.writer()
186
197
187 # Loop over the stored fields in the index
198 # Loop over the stored fields in the index
188 for fields in reader.all_stored_fields():
199 for fields in reader.all_stored_fields():
189 indexed_path = fields['path']
200 indexed_path = fields['path']
201 indexed_repo_path = fields['repository']
190 indexed_paths.add(indexed_path)
202 indexed_paths.add(indexed_path)
191
203
192 repo = self.repo_paths[fields['repository']]
204 if not indexed_repo_path in self.filtered_repo_update_paths:
205 continue
206
207 repo = self.repo_paths[indexed_repo_path]
193
208
194 try:
209 try:
195 node = self.get_node(repo, indexed_path)
210 node = self.get_node(repo, indexed_path)
196 except (ChangesetError, NodeDoesNotExistError):
197 # This file was deleted since it was indexed
198 log.debug('removing from index %s' % indexed_path)
199 writer.delete_by_term('path', indexed_path)
200
201 else:
202 # Check if this file was changed since it was indexed
211 # Check if this file was changed since it was indexed
203 indexed_time = fields['modtime']
212 indexed_time = fields['modtime']
204 mtime = self.get_node_mtime(node)
213 mtime = self.get_node_mtime(node)
205 if mtime > indexed_time:
214 if mtime > indexed_time:
206 # The file has changed, delete it and add it to the list of
215 # The file has changed, delete it and add it to the list of
207 # files to reindex
216 # files to reindex
208 log.debug('adding to reindex list %s' % indexed_path)
217 log.debug('adding to reindex list %s' % indexed_path)
209 writer.delete_by_term('path', indexed_path)
218 writer.delete_by_term('path', indexed_path)
210 to_index.add(indexed_path)
219 to_index.add(indexed_path)
220 except (ChangesetError, NodeDoesNotExistError):
221 # This file was deleted since it was indexed
222 log.debug('removing from index %s' % indexed_path)
223 writer.delete_by_term('path', indexed_path)
211
224
212 # Loop over the files in the filesystem
225 # Loop over the files in the filesystem
213 # Assume we have a function that gathers the filenames of the
226 # Assume we have a function that gathers the filenames of the
214 # documents to be indexed
227 # documents to be indexed
215 ri_cnt = riwc_cnt = 0
228 ri_cnt = riwc_cnt = 0
216 for repo_name, repo in self.repo_paths.items():
229 for repo_name, repo in self.repo_paths.items():
217 for path in self.get_paths(repo):
230 for path in self.get_paths(repo):
218 path = safe_unicode(path)
231 path = safe_unicode(path)
219 if path in to_index or path not in indexed_paths:
232 if path in to_index or path not in indexed_paths:
220 # This is either a file that's changed, or a new file
233 # This is either a file that's changed, or a new file
221 # that wasn't indexed before. So index it!
234 # that wasn't indexed before. So index it!
222 i, iwc = self.add_doc(writer, path, repo, repo_name)
235 i, iwc = self.add_doc(writer, path, repo, repo_name)
223 log.debug('re indexing %s' % path)
236 log.debug('re indexing %s' % path)
224 ri_cnt += i
237 ri_cnt += i
225 riwc_cnt += iwc
238 riwc_cnt += iwc
226 log.debug('added %s files %s with content for repo %s' % (
239 log.debug('added %s files %s with content for repo %s' % (
227 ri_cnt + riwc_cnt, riwc_cnt, repo.path)
240 ri_cnt + riwc_cnt, riwc_cnt, repo.path)
228 )
241 )
229 log.debug('>> COMMITING CHANGES <<')
242 log.debug('>> COMMITING CHANGES <<')
230 writer.commit(merge=True)
243 writer.commit(merge=True)
231 log.debug('>>> FINISHED REBUILDING INDEX <<<')
244 log.debug('>>> FINISHED REBUILDING INDEX <<<')
232
245
233 def run(self, full_index=False):
246 def run(self, full_index=False):
234 """Run daemon"""
247 """Run daemon"""
235 if full_index or self.initial:
248 if full_index or self.initial:
236 self.build_index()
249 self.build_index()
237 else:
250 else:
238 self.update_index()
251 self.update_index()
General Comments 0
You need to be logged in to leave comments. Login now