##// END OF EJS Templates
Don't clear dbsessions when celery_eager is turned on
marcink -
r2299:e2dbdaf1 beta
parent child Browse files
Show More
@@ -1,666 +1,669 b''
1 1 .. _changelog:
2 2
3 3 =========
4 4 Changelog
5 5 =========
6 6
7 7 1.4.0 (**2012-XX-XX**)
8 8 ----------------------
9 9
10 10 :status: in-progress
11 11 :branch: beta
12 12
13 13 news
14 14 ++++
15 15
16 - new codereview system
17 - changed setup-app into setup-rhodecode and added default options to it.
16 - new codereview system
17 - changed setup-app into setup-rhodecode and added default options to it.
18 18
19 19 fixes
20 20 +++++
21 21
22
23
22 24 1.3.6 (**2012-05-17**)
23 25 ----------------------
24 26
25 27 news
26 28 ++++
27 29
28 30 - chinese traditional translation
29 31 - changed setup-app into setup-rhodecode and added arguments for auto-setup
30 32 mode that doesn't need user interaction
31 33
32 34 fixes
33 35 +++++
34 36
35 37 - fixed no scm found warning
36 38 - fixed __future__ import error on rcextensions
37 39 - made simplejson required lib for speedup on JSON encoding
38 40 - fixes #449 bad regex could get more than revisions from parsing history
41 - don't clear DB session when CELERY_EAGER is turned ON
39 42
40 43 1.3.5 (**2012-05-10**)
41 44 ----------------------
42 45
43 46 news
44 47 ++++
45 48
46 49 - use ext_json for json module
47 50 - unified annotation view with file source view
48 51 - notification improvements, better inbox + css
49 52 - #419 don't strip passwords for login forms, make rhodecode
50 53 more compatible with LDAP servers
51 54 - Added HTTP_X_FORWARDED_FOR as another method of extracting
52 55 IP for pull/push logs. - moved all to base controller
53 56 - #415: Adding comment to changeset causes reload.
54 57 Comments are now added via ajax and doesn't reload the page
55 58 - #374 LDAP config is discarded when LDAP can't be activated
56 59 - limited push/pull operations are now logged for git in the journal
57 60 - bumped mercurial to 2.2.X series
58 61 - added support for displaying submodules in file-browser
59 62 - #421 added bookmarks in changelog view
60 63
61 64 fixes
62 65 +++++
63 66
64 67 - fixed dev-version marker for stable when served from source codes
65 68 - fixed missing permission checks on show forks page
66 69 - #418 cast to unicode fixes in notification objects
67 70 - #426 fixed mention extracting regex
68 71 - fixed remote-pulling for git remotes remopositories
69 72 - fixed #434: Error when accessing files or changesets of a git repository
70 73 with submodules
71 74 - fixed issue with empty APIKEYS for users after registration ref. #438
72 75 - fixed issue with getting README files from git repositories
73 76
74 77 1.3.4 (**2012-03-28**)
75 78 ----------------------
76 79
77 80 news
78 81 ++++
79 82
80 83 - Whoosh logging is now controlled by the .ini files logging setup
81 84 - added clone-url into edit form on /settings page
82 85 - added help text into repo add/edit forms
83 86 - created rcextensions module with additional mappings (ref #322) and
84 87 post push/pull/create repo hooks callbacks
85 88 - implemented #377 Users view for his own permissions on account page
86 89 - #399 added inheritance of permissions for users group on repos groups
87 90 - #401 repository group is automatically pre-selected when adding repos
88 91 inside a repository group
89 92 - added alternative HTTP 403 response when client failed to authenticate. Helps
90 93 solving issues with Mercurial and LDAP
91 94 - #402 removed group prefix from repository name when listing repositories
92 95 inside a group
93 96 - added gravatars into permission view and permissions autocomplete
94 97 - #347 when running multiple RhodeCode instances, properly invalidates cache
95 98 for all registered servers
96 99
97 100 fixes
98 101 +++++
99 102
100 103 - fixed #390 cache invalidation problems on repos inside group
101 104 - fixed #385 clone by ID url was loosing proxy prefix in URL
102 105 - fixed some unicode problems with waitress
103 106 - fixed issue with escaping < and > in changeset commits
104 107 - fixed error occurring during recursive group creation in API
105 108 create_repo function
106 109 - fixed #393 py2.5 fixes for routes url generator
107 110 - fixed #397 Private repository groups shows up before login
108 111 - fixed #396 fixed problems with revoking users in nested groups
109 112 - fixed mysql unicode issues + specified InnoDB as default engine with
110 113 utf8 charset
111 114 - #406 trim long branch/tag names in changelog to not break UI
112 115
113 116 1.3.3 (**2012-03-02**)
114 117 ----------------------
115 118
116 119 news
117 120 ++++
118 121
119 122
120 123 fixes
121 124 +++++
122 125
123 126 - fixed some python2.5 compatibility issues
124 127 - fixed issues with removed repos was accidentally added as groups, after
125 128 full rescan of paths
126 129 - fixes #376 Cannot edit user (using container auth)
127 130 - fixes #378 Invalid image urls on changeset screen with proxy-prefix
128 131 configuration
129 132 - fixed initial sorting of repos inside repo group
130 133 - fixes issue when user tried to resubmit same permission into user/user_groups
131 134 - bumped beaker version that fixes #375 leap error bug
132 135 - fixed raw_changeset for git. It was generated with hg patch headers
133 136 - fixed vcs issue with last_changeset for filenodes
134 137 - fixed missing commit after hook delete
135 138 - fixed #372 issues with git operation detection that caused a security issue
136 139 for git repos
137 140
138 141 1.3.2 (**2012-02-28**)
139 142 ----------------------
140 143
141 144 news
142 145 ++++
143 146
144 147
145 148 fixes
146 149 +++++
147 150
148 151 - fixed git protocol issues with repos-groups
149 152 - fixed git remote repos validator that prevented from cloning remote git repos
150 153 - fixes #370 ending slashes fixes for repo and groups
151 154 - fixes #368 improved git-protocol detection to handle other clients
152 155 - fixes #366 When Setting Repository Group To Blank Repo Group Wont Be
153 156 Moved To Root
154 157 - fixes #371 fixed issues with beaker/sqlalchemy and non-ascii cache keys
155 158 - fixed #373 missing cascade drop on user_group_to_perm table
156 159
157 160 1.3.1 (**2012-02-27**)
158 161 ----------------------
159 162
160 163 news
161 164 ++++
162 165
163 166
164 167 fixes
165 168 +++++
166 169
167 170 - redirection loop occurs when remember-me wasn't checked during login
168 171 - fixes issues with git blob history generation
169 172 - don't fetch branch for git in file history dropdown. Causes unneeded slowness
170 173
171 174 1.3.0 (**2012-02-26**)
172 175 ----------------------
173 176
174 177 news
175 178 ++++
176 179
177 180 - code review, inspired by github code-comments
178 181 - #215 rst and markdown README files support
179 182 - #252 Container-based and proxy pass-through authentication support
180 183 - #44 branch browser. Filtering of changelog by branches
181 184 - mercurial bookmarks support
182 185 - new hover top menu, optimized to add maximum size for important views
183 186 - configurable clone url template with possibility to specify protocol like
184 187 ssh:// or http:// and also manually alter other parts of clone_url.
185 188 - enabled largefiles extension by default
186 189 - optimized summary file pages and saved a lot of unused space in them
187 190 - #239 option to manually mark repository as fork
188 191 - #320 mapping of commit authors to RhodeCode users
189 192 - #304 hashes are displayed using monospace font
190 193 - diff configuration, toggle white lines and context lines
191 194 - #307 configurable diffs, whitespace toggle, increasing context lines
192 195 - sorting on branches, tags and bookmarks using YUI datatable
193 196 - improved file filter on files page
194 197 - implements #330 api method for listing nodes ar particular revision
195 198 - #73 added linking issues in commit messages to chosen issue tracker url
196 199 based on user defined regular expression
197 200 - added linking of changesets in commit messages
198 201 - new compact changelog with expandable commit messages
199 202 - firstname and lastname are optional in user creation
200 203 - #348 added post-create repository hook
201 204 - #212 global encoding settings is now configurable from .ini files
202 205 - #227 added repository groups permissions
203 206 - markdown gets codehilite extensions
204 207 - new API methods, delete_repositories, grante/revoke permissions for groups
205 208 and repos
206 209
207 210
208 211 fixes
209 212 +++++
210 213
211 214 - rewrote dbsession management for atomic operations, and better error handling
212 215 - fixed sorting of repo tables
213 216 - #326 escape of special html entities in diffs
214 217 - normalized user_name => username in api attributes
215 218 - fixes #298 ldap created users with mixed case emails created conflicts
216 219 on saving a form
217 220 - fixes issue when owner of a repo couldn't revoke permissions for users
218 221 and groups
219 222 - fixes #271 rare JSON serialization problem with statistics
220 223 - fixes #337 missing validation check for conflicting names of a group with a
221 224 repositories group
222 225 - #340 fixed session problem for mysql and celery tasks
223 226 - fixed #331 RhodeCode mangles repository names if the a repository group
224 227 contains the "full path" to the repositories
225 228 - #355 RhodeCode doesn't store encrypted LDAP passwords
226 229
227 230 1.2.5 (**2012-01-28**)
228 231 ----------------------
229 232
230 233 news
231 234 ++++
232 235
233 236 fixes
234 237 +++++
235 238
236 239 - #340 Celery complains about MySQL server gone away, added session cleanup
237 240 for celery tasks
238 241 - #341 "scanning for repositories in None" log message during Rescan was missing
239 242 a parameter
240 243 - fixed creating archives with subrepos. Some hooks were triggered during that
241 244 operation leading to crash.
242 245 - fixed missing email in account page.
243 246 - Reverted Mercurial to 2.0.1 for windows due to bug in Mercurial that makes
244 247 forking on windows impossible
245 248
246 249 1.2.4 (**2012-01-19**)
247 250 ----------------------
248 251
249 252 news
250 253 ++++
251 254
252 255 - RhodeCode is bundled with mercurial series 2.0.X by default, with
253 256 full support to largefiles extension. Enabled by default in new installations
254 257 - #329 Ability to Add/Remove Groups to/from a Repository via AP
255 258 - added requires.txt file with requirements
256 259
257 260 fixes
258 261 +++++
259 262
260 263 - fixes db session issues with celery when emailing admins
261 264 - #331 RhodeCode mangles repository names if the a repository group
262 265 contains the "full path" to the repositories
263 266 - #298 Conflicting e-mail addresses for LDAP and RhodeCode users
264 267 - DB session cleanup after hg protocol operations, fixes issues with
265 268 `mysql has gone away` errors
266 269 - #333 doc fixes for get_repo api function
267 270 - #271 rare JSON serialization problem with statistics enabled
268 271 - #337 Fixes issues with validation of repository name conflicting with
269 272 a group name. A proper message is now displayed.
270 273 - #292 made ldap_dn in user edit readonly, to get rid of confusion that field
271 274 doesn't work
272 275 - #316 fixes issues with web description in hgrc files
273 276
274 277 1.2.3 (**2011-11-02**)
275 278 ----------------------
276 279
277 280 news
278 281 ++++
279 282
280 283 - added option to manage repos group for non admin users
281 284 - added following API methods for get_users, create_user, get_users_groups,
282 285 get_users_group, create_users_group, add_user_to_users_groups, get_repos,
283 286 get_repo, create_repo, add_user_to_repo
284 287 - implements #237 added password confirmation for my account
285 288 and admin edit user.
286 289 - implements #291 email notification for global events are now sent to all
287 290 administrator users, and global config email.
288 291
289 292 fixes
290 293 +++++
291 294
292 295 - added option for passing auth method for smtp mailer
293 296 - #276 issue with adding a single user with id>10 to usergroups
294 297 - #277 fixes windows LDAP settings in which missing values breaks the ldap auth
295 298 - #288 fixes managing of repos in a group for non admin user
296 299
297 300 1.2.2 (**2011-10-17**)
298 301 ----------------------
299 302
300 303 news
301 304 ++++
302 305
303 306 - #226 repo groups are available by path instead of numerical id
304 307
305 308 fixes
306 309 +++++
307 310
308 311 - #259 Groups with the same name but with different parent group
309 312 - #260 Put repo in group, then move group to another group -> repo becomes unavailable
310 313 - #258 RhodeCode 1.2 assumes egg folder is writable (lockfiles problems)
311 314 - #265 ldap save fails sometimes on converting attributes to booleans,
312 315 added getter and setter into model that will prevent from this on db model level
313 316 - fixed problems with timestamps issues #251 and #213
314 317 - fixes #266 RhodeCode allows to create repo with the same name and in
315 318 the same parent as group
316 319 - fixes #245 Rescan of the repositories on Windows
317 320 - fixes #248 cannot edit repos inside a group on windows
318 321 - fixes #219 forking problems on windows
319 322
320 323 1.2.1 (**2011-10-08**)
321 324 ----------------------
322 325
323 326 news
324 327 ++++
325 328
326 329
327 330 fixes
328 331 +++++
329 332
330 333 - fixed problems with basic auth and push problems
331 334 - gui fixes
332 335 - fixed logger
333 336
334 337 1.2.0 (**2011-10-07**)
335 338 ----------------------
336 339
337 340 news
338 341 ++++
339 342
340 343 - implemented #47 repository groups
341 344 - implemented #89 Can setup google analytics code from settings menu
342 345 - implemented #91 added nicer looking archive urls with more download options
343 346 like tags, branches
344 347 - implemented #44 into file browsing, and added follow branch option
345 348 - implemented #84 downloads can be enabled/disabled for each repository
346 349 - anonymous repository can be cloned without having to pass default:default
347 350 into clone url
348 351 - fixed #90 whoosh indexer can index chooses repositories passed in command
349 352 line
350 353 - extended journal with day aggregates and paging
351 354 - implemented #107 source code lines highlight ranges
352 355 - implemented #93 customizable changelog on combined revision ranges -
353 356 equivalent of githubs compare view
354 357 - implemented #108 extended and more powerful LDAP configuration
355 358 - implemented #56 users groups
356 359 - major code rewrites optimized codes for speed and memory usage
357 360 - raw and diff downloads are now in git format
358 361 - setup command checks for write access to given path
359 362 - fixed many issues with international characters and unicode. It uses utf8
360 363 decode with replace to provide less errors even with non utf8 encoded strings
361 364 - #125 added API KEY access to feeds
362 365 - #109 Repository can be created from external Mercurial link (aka. remote
363 366 repository, and manually updated (via pull) from admin panel
364 367 - beta git support - push/pull server + basic view for git repos
365 368 - added followers page and forks page
366 369 - server side file creation (with binary file upload interface)
367 370 and edition with commits powered by codemirror
368 371 - #111 file browser file finder, quick lookup files on whole file tree
369 372 - added quick login sliding menu into main page
370 373 - changelog uses lazy loading of affected files details, in some scenarios
371 374 this can improve speed of changelog page dramatically especially for
372 375 larger repositories.
373 376 - implements #214 added support for downloading subrepos in download menu.
374 377 - Added basic API for direct operations on rhodecode via JSON
375 378 - Implemented advanced hook management
376 379
377 380 fixes
378 381 +++++
379 382
380 383 - fixed file browser bug, when switching into given form revision the url was
381 384 not changing
382 385 - fixed propagation to error controller on simplehg and simplegit middlewares
383 386 - fixed error when trying to make a download on empty repository
384 387 - fixed problem with '[' chars in commit messages in journal
385 388 - fixed #99 Unicode errors, on file node paths with non utf-8 characters
386 389 - journal fork fixes
387 390 - removed issue with space inside renamed repository after deletion
388 391 - fixed strange issue on formencode imports
389 392 - fixed #126 Deleting repository on Windows, rename used incompatible chars.
390 393 - #150 fixes for errors on repositories mapped in db but corrupted in
391 394 filesystem
392 395 - fixed problem with ascendant characters in realm #181
393 396 - fixed problem with sqlite file based database connection pool
394 397 - whoosh indexer and code stats share the same dynamic extensions map
395 398 - fixes #188 - relationship delete of repo_to_perm entry on user removal
396 399 - fixes issue #189 Trending source files shows "show more" when no more exist
397 400 - fixes issue #197 Relative paths for pidlocks
398 401 - fixes issue #198 password will require only 3 chars now for login form
399 402 - fixes issue #199 wrong redirection for non admin users after creating a repository
400 403 - fixes issues #202, bad db constraint made impossible to attach same group
401 404 more than one time. Affects only mysql/postgres
402 405 - fixes #218 os.kill patch for windows was missing sig param
403 406 - improved rendering of dag (they are not trimmed anymore when number of
404 407 heads exceeds 5)
405 408
406 409 1.1.8 (**2011-04-12**)
407 410 ----------------------
408 411
409 412 news
410 413 ++++
411 414
412 415 - improved windows support
413 416
414 417 fixes
415 418 +++++
416 419
417 420 - fixed #140 freeze of python dateutil library, since new version is python2.x
418 421 incompatible
419 422 - setup-app will check for write permission in given path
420 423 - cleaned up license info issue #149
421 424 - fixes for issues #137,#116 and problems with unicode and accented characters.
422 425 - fixes crashes on gravatar, when passed in email as unicode
423 426 - fixed tooltip flickering problems
424 427 - fixed came_from redirection on windows
425 428 - fixed logging modules, and sql formatters
426 429 - windows fixes for os.kill issue #133
427 430 - fixes path splitting for windows issues #148
428 431 - fixed issue #143 wrong import on migration to 1.1.X
429 432 - fixed problems with displaying binary files, thanks to Thomas Waldmann
430 433 - removed name from archive files since it's breaking ui for long repo names
431 434 - fixed issue with archive headers sent to browser, thanks to Thomas Waldmann
432 435 - fixed compatibility for 1024px displays, and larger dpi settings, thanks to
433 436 Thomas Waldmann
434 437 - fixed issue #166 summary pager was skipping 10 revisions on second page
435 438
436 439
437 440 1.1.7 (**2011-03-23**)
438 441 ----------------------
439 442
440 443 news
441 444 ++++
442 445
443 446 fixes
444 447 +++++
445 448
446 449 - fixed (again) #136 installation support for FreeBSD
447 450
448 451
449 452 1.1.6 (**2011-03-21**)
450 453 ----------------------
451 454
452 455 news
453 456 ++++
454 457
455 458 fixes
456 459 +++++
457 460
458 461 - fixed #136 installation support for FreeBSD
459 462 - RhodeCode will check for python version during installation
460 463
461 464 1.1.5 (**2011-03-17**)
462 465 ----------------------
463 466
464 467 news
465 468 ++++
466 469
467 470 - basic windows support, by exchanging pybcrypt into sha256 for windows only
468 471 highly inspired by idea of mantis406
469 472
470 473 fixes
471 474 +++++
472 475
473 476 - fixed sorting by author in main page
474 477 - fixed crashes with diffs on binary files
475 478 - fixed #131 problem with boolean values for LDAP
476 479 - fixed #122 mysql problems thanks to striker69
477 480 - fixed problem with errors on calling raw/raw_files/annotate functions
478 481 with unknown revisions
479 482 - fixed returned rawfiles attachment names with international character
480 483 - cleaned out docs, big thanks to Jason Harris
481 484
482 485 1.1.4 (**2011-02-19**)
483 486 ----------------------
484 487
485 488 news
486 489 ++++
487 490
488 491 fixes
489 492 +++++
490 493
491 494 - fixed formencode import problem on settings page, that caused server crash
492 495 when that page was accessed as first after server start
493 496 - journal fixes
494 497 - fixed option to access repository just by entering http://server/<repo_name>
495 498
496 499 1.1.3 (**2011-02-16**)
497 500 ----------------------
498 501
499 502 news
500 503 ++++
501 504
502 505 - implemented #102 allowing the '.' character in username
503 506 - added option to access repository just by entering http://server/<repo_name>
504 507 - celery task ignores result for better performance
505 508
506 509 fixes
507 510 +++++
508 511
509 512 - fixed ehlo command and non auth mail servers on smtp_lib. Thanks to
510 513 apollo13 and Johan Walles
511 514 - small fixes in journal
512 515 - fixed problems with getting setting for celery from .ini files
513 516 - registration, password reset and login boxes share the same title as main
514 517 application now
515 518 - fixed #113: to high permissions to fork repository
516 519 - fixed problem with '[' chars in commit messages in journal
517 520 - removed issue with space inside renamed repository after deletion
518 521 - db transaction fixes when filesystem repository creation failed
519 522 - fixed #106 relation issues on databases different than sqlite
520 523 - fixed static files paths links to use of url() method
521 524
522 525 1.1.2 (**2011-01-12**)
523 526 ----------------------
524 527
525 528 news
526 529 ++++
527 530
528 531
529 532 fixes
530 533 +++++
531 534
532 535 - fixes #98 protection against float division of percentage stats
533 536 - fixed graph bug
534 537 - forced webhelpers version since it was making troubles during installation
535 538
536 539 1.1.1 (**2011-01-06**)
537 540 ----------------------
538 541
539 542 news
540 543 ++++
541 544
542 545 - added force https option into ini files for easier https usage (no need to
543 546 set server headers with this options)
544 547 - small css updates
545 548
546 549 fixes
547 550 +++++
548 551
549 552 - fixed #96 redirect loop on files view on repositories without changesets
550 553 - fixed #97 unicode string passed into server header in special cases (mod_wsgi)
551 554 and server crashed with errors
552 555 - fixed large tooltips problems on main page
553 556 - fixed #92 whoosh indexer is more error proof
554 557
555 558 1.1.0 (**2010-12-18**)
556 559 ----------------------
557 560
558 561 news
559 562 ++++
560 563
561 564 - rewrite of internals for vcs >=0.1.10
562 565 - uses mercurial 1.7 with dotencode disabled for maintaining compatibility
563 566 with older clients
564 567 - anonymous access, authentication via ldap
565 568 - performance upgrade for cached repos list - each repository has its own
566 569 cache that's invalidated when needed.
567 570 - performance upgrades on repositories with large amount of commits (20K+)
568 571 - main page quick filter for filtering repositories
569 572 - user dashboards with ability to follow chosen repositories actions
570 573 - sends email to admin on new user registration
571 574 - added cache/statistics reset options into repository settings
572 575 - more detailed action logger (based on hooks) with pushed changesets lists
573 576 and options to disable those hooks from admin panel
574 577 - introduced new enhanced changelog for merges that shows more accurate results
575 578 - new improved and faster code stats (based on pygments lexers mapping tables,
576 579 showing up to 10 trending sources for each repository. Additionally stats
577 580 can be disabled in repository settings.
578 581 - gui optimizations, fixed application width to 1024px
579 582 - added cut off (for large files/changesets) limit into config files
580 583 - whoosh, celeryd, upgrade moved to paster command
581 584 - other than sqlite database backends can be used
582 585
583 586 fixes
584 587 +++++
585 588
586 589 - fixes #61 forked repo was showing only after cache expired
587 590 - fixes #76 no confirmation on user deletes
588 591 - fixes #66 Name field misspelled
589 592 - fixes #72 block user removal when he owns repositories
590 593 - fixes #69 added password confirmation fields
591 594 - fixes #87 RhodeCode crashes occasionally on updating repository owner
592 595 - fixes #82 broken annotations on files with more than 1 blank line at the end
593 596 - a lot of fixes and tweaks for file browser
594 597 - fixed detached session issues
595 598 - fixed when user had no repos he would see all repos listed in my account
596 599 - fixed ui() instance bug when global hgrc settings was loaded for server
597 600 instance and all hgrc options were merged with our db ui() object
598 601 - numerous small bugfixes
599 602
600 603 (special thanks for TkSoh for detailed feedback)
601 604
602 605
603 606 1.0.2 (**2010-11-12**)
604 607 ----------------------
605 608
606 609 news
607 610 ++++
608 611
609 612 - tested under python2.7
610 613 - bumped sqlalchemy and celery versions
611 614
612 615 fixes
613 616 +++++
614 617
615 618 - fixed #59 missing graph.js
616 619 - fixed repo_size crash when repository had broken symlinks
617 620 - fixed python2.5 crashes.
618 621
619 622
620 623 1.0.1 (**2010-11-10**)
621 624 ----------------------
622 625
623 626 news
624 627 ++++
625 628
626 629 - small css updated
627 630
628 631 fixes
629 632 +++++
630 633
631 634 - fixed #53 python2.5 incompatible enumerate calls
632 635 - fixed #52 disable mercurial extension for web
633 636 - fixed #51 deleting repositories don't delete it's dependent objects
634 637
635 638
636 639 1.0.0 (**2010-11-02**)
637 640 ----------------------
638 641
639 642 - security bugfix simplehg wasn't checking for permissions on commands
640 643 other than pull or push.
641 644 - fixed doubled messages after push or pull in admin journal
642 645 - templating and css corrections, fixed repo switcher on chrome, updated titles
643 646 - admin menu accessible from options menu on repository view
644 647 - permissions cached queries
645 648
646 649 1.0.0rc4 (**2010-10-12**)
647 650 --------------------------
648 651
649 652 - fixed python2.5 missing simplejson imports (thanks to Jens BΓ€ckman)
650 653 - removed cache_manager settings from sqlalchemy meta
651 654 - added sqlalchemy cache settings to ini files
652 655 - validated password length and added second try of failure on paster setup-app
653 656 - fixed setup database destroy prompt even when there was no db
654 657
655 658
656 659 1.0.0rc3 (**2010-10-11**)
657 660 -------------------------
658 661
659 662 - fixed i18n during installation.
660 663
661 664 1.0.0rc2 (**2010-10-11**)
662 665 -------------------------
663 666
664 667 - Disabled dirsize in file browser, it's causing nasty bug when dir renames
665 668 occure. After vcs is fixed it'll be put back again.
666 669 - templating/css rewrites, optimized css. No newline at end of file
@@ -1,97 +1,98 b''
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 rhodecode.__init__
4 4 ~~~~~~~~~~~~~~~~~~
5 5
6 6 RhodeCode, a web based repository management based on pylons
7 7 versioning implementation: http://www.python.org/dev/peps/pep-0386/
8 8
9 9 :created_on: Apr 9, 2010
10 10 :author: marcink
11 11 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
12 12 :license: GPLv3, see COPYING for more details.
13 13 """
14 14 # This program is free software: you can redistribute it and/or modify
15 15 # it under the terms of the GNU General Public License as published by
16 16 # the Free Software Foundation, either version 3 of the License, or
17 17 # (at your option) any later version.
18 18 #
19 19 # This program is distributed in the hope that it will be useful,
20 20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 22 # GNU General Public License for more details.
23 23 #
24 24 # You should have received a copy of the GNU General Public License
25 25 # along with this program. If not, see <http://www.gnu.org/licenses/>.
26 26 import sys
27 27 import platform
28 28
29 29 VERSION = (1, 4, 0, 'b')
30 30
31 31 try:
32 32 from rhodecode.lib import get_current_revision
33 33 _rev = get_current_revision()
34 34 if _rev and len(VERSION) > 3:
35 35 VERSION += ('dev%s' % _rev[0],)
36 36 except ImportError:
37 37 pass
38 38
39 39 __version__ = ('.'.join((str(each) for each in VERSION[:3])) +
40 40 '.'.join(VERSION[3:]))
41 41 __dbversion__ = 5 # defines current db version for migrations
42 42 __platform__ = platform.system()
43 43 __license__ = 'GPLv3'
44 44 __py_version__ = sys.version_info
45 45
46 46 PLATFORM_WIN = ('Windows')
47 47 PLATFORM_OTHERS = ('Linux', 'Darwin', 'FreeBSD', 'OpenBSD', 'SunOS')
48 48
49 49 is_windows = __platform__ in PLATFORM_WIN
50 50 is_unix = __platform__ in PLATFORM_OTHERS
51 51
52 52 requirements = [
53 53 "Pylons==1.0.0",
54 54 "Beaker==1.6.3",
55 55 "WebHelpers==1.3",
56 56 "formencode==1.2.4",
57 57 "SQLAlchemy==0.7.6",
58 58 "Mako==0.7.0",
59 59 "pygments>=1.4",
60 60 "whoosh>=2.4.0,<2.5",
61 61 "celery>=2.2.5,<2.3",
62 62 "babel",
63 63 "python-dateutil>=1.5.0,<2.0.0",
64 64 "dulwich>=0.8.5,<0.9.0",
65 65 "webob==1.0.8",
66 66 "markdown==2.1.1",
67 67 "docutils==0.8.1",
68 68 "simplejson==2.5.2",
69 69 ]
70 70
71 71 if __py_version__ < (2, 6):
72 72 requirements.append("pysqlite")
73 73
74 74 if is_windows:
75 75 requirements.append("mercurial>=2.2.1,<2.3")
76 76 else:
77 77 requirements.append("py-bcrypt")
78 78 requirements.append("mercurial>=2.2.1,<2.3")
79 79
80 80
81 81 def get_version():
82 82 """Returns shorter version (digit parts only) as string."""
83 83
84 84 return '.'.join((str(each) for each in VERSION[:3]))
85 85
86 86 BACKENDS = {
87 87 'hg': 'Mercurial repository',
88 88 'git': 'Git repository',
89 89 }
90 90
91 91 CELERY_ON = False
92 CELERY_EAGER = False
92 93
93 94 # link to config for pylons
94 95 CONFIG = {}
95 96
96 97 # Linked module for extensions
97 98 EXTENSIONS = {}
@@ -1,96 +1,97 b''
1 1 """Pylons environment configuration"""
2 2
3 3 import os
4 4 import logging
5 5 import rhodecode
6 6
7 7 from mako.lookup import TemplateLookup
8 8 from pylons.configuration import PylonsConfig
9 9 from pylons.error import handle_mako_error
10 10
11 11 # don't remove this import it does magic for celery
12 12 from rhodecode.lib import celerypylons
13 13
14 14 import rhodecode.lib.app_globals as app_globals
15 15
16 16 from rhodecode.config.routing import make_map
17 17
18 18 from rhodecode.lib import helpers
19 19 from rhodecode.lib.auth import set_available_permissions
20 20 from rhodecode.lib.utils import repo2db_mapper, make_ui, set_rhodecode_config,\
21 21 load_rcextensions
22 22 from rhodecode.lib.utils2 import engine_from_config, str2bool
23 23 from rhodecode.model import init_model
24 24 from rhodecode.model.scm import ScmModel
25 25
26 26 log = logging.getLogger(__name__)
27 27
28 28
29 29 def load_environment(global_conf, app_conf, initial=False):
30 30 """
31 31 Configure the Pylons environment via the ``pylons.config``
32 32 object
33 33 """
34 34 config = PylonsConfig()
35 35
36 36 # Pylons paths
37 37 root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
38 38 paths = dict(
39 39 root=root,
40 40 controllers=os.path.join(root, 'controllers'),
41 41 static_files=os.path.join(root, 'public'),
42 42 templates=[os.path.join(root, 'templates')]
43 43 )
44 44
45 45 # Initialize config with the basic options
46 46 config.init_app(global_conf, app_conf, package='rhodecode', paths=paths)
47 47
48 48 # store some globals into rhodecode
49 49 rhodecode.CELERY_ON = str2bool(config['app_conf'].get('use_celery'))
50 rhodecode.CELERY_EAGER = str2bool(config['app_conf'].get('celery.always.eager'))
50 51
51 52 config['routes.map'] = make_map(config)
52 53 config['pylons.app_globals'] = app_globals.Globals(config)
53 54 config['pylons.h'] = helpers
54 55 rhodecode.CONFIG = config
55 56
56 57 load_rcextensions(root_path=config['here'])
57 58
58 59 # Setup cache object as early as possible
59 60 import pylons
60 61 pylons.cache._push_object(config['pylons.app_globals'].cache)
61 62
62 63 # Create the Mako TemplateLookup, with the default auto-escaping
63 64 config['pylons.app_globals'].mako_lookup = TemplateLookup(
64 65 directories=paths['templates'],
65 66 error_handler=handle_mako_error,
66 67 module_directory=os.path.join(app_conf['cache_dir'], 'templates'),
67 68 input_encoding='utf-8', default_filters=['escape'],
68 69 imports=['from webhelpers.html import escape'])
69 70
70 71 # sets the c attribute access when don't existing attribute are accessed
71 72 config['pylons.strict_tmpl_context'] = True
72 73 test = os.path.split(config['__file__'])[-1] == 'test.ini'
73 74 if test:
74 75 from rhodecode.lib.utils import create_test_env, create_test_index
75 76 from rhodecode.tests import TESTS_TMP_PATH
76 77 create_test_env(TESTS_TMP_PATH, config)
77 78 create_test_index(TESTS_TMP_PATH, config, True)
78 79
79 80 # MULTIPLE DB configs
80 81 # Setup the SQLAlchemy database engine
81 82 sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.')
82 83
83 84 init_model(sa_engine_db1)
84 85
85 86 repos_path = make_ui('db').configitems('paths')[0][1]
86 87 repo2db_mapper(ScmModel().repo_scan(repos_path))
87 88 set_available_permissions(config)
88 89 config['base_path'] = repos_path
89 90 set_rhodecode_config(config)
90 91 # CONFIGURATION OPTIONS HERE (note: all config options will override
91 92 # any Pylons config options)
92 93
93 94 # store config reference into our module to skip import magic of
94 95 # pylons
95 96 rhodecode.CONFIG.update(config)
96 97 return config
@@ -1,128 +1,128 b''
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 rhodecode.lib.celerylib.__init__
4 4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 5
6 6 celery libs for RhodeCode
7 7
8 8 :created_on: Nov 27, 2010
9 9 :author: marcink
10 10 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
11 11 :license: GPLv3, see COPYING for more details.
12 12 """
13 13 # This program is free software: you can redistribute it and/or modify
14 14 # it under the terms of the GNU General Public License as published by
15 15 # the Free Software Foundation, either version 3 of the License, or
16 16 # (at your option) any later version.
17 17 #
18 18 # This program is distributed in the hope that it will be useful,
19 19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 21 # GNU General Public License for more details.
22 22 #
23 23 # You should have received a copy of the GNU General Public License
24 24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25 25
26 26 import os
27 27 import sys
28 28 import socket
29 29 import traceback
30 30 import logging
31 31 from os.path import dirname as dn, join as jn
32 32 from pylons import config
33 33
34 34 from hashlib import md5
35 35 from decorator import decorator
36 36
37 37 from rhodecode.lib.vcs.utils.lazy import LazyProperty
38 from rhodecode import CELERY_ON
38 from rhodecode import CELERY_ON, CELERY_EAGER
39 39 from rhodecode.lib.utils2 import str2bool, safe_str
40 40 from rhodecode.lib.pidlock import DaemonLock, LockHeld
41 41 from rhodecode.model import init_model
42 42 from rhodecode.model import meta
43 43 from rhodecode.model.db import Statistics, Repository, User
44 44
45 45 from sqlalchemy import engine_from_config
46 46
47 47 from celery.messaging import establish_connection
48 48
49 49 log = logging.getLogger(__name__)
50 50
51 51
52 52 class ResultWrapper(object):
53 53 def __init__(self, task):
54 54 self.task = task
55 55
56 56 @LazyProperty
57 57 def result(self):
58 58 return self.task
59 59
60 60
61 61 def run_task(task, *args, **kwargs):
62 62 if CELERY_ON:
63 63 try:
64 64 t = task.apply_async(args=args, kwargs=kwargs)
65 65 log.info('running task %s:%s' % (t.task_id, task))
66 66 return t
67 67
68 68 except socket.error, e:
69 69 if isinstance(e, IOError) and e.errno == 111:
70 70 log.debug('Unable to connect to celeryd. Sync execution')
71 71 else:
72 72 log.error(traceback.format_exc())
73 73 except KeyError, e:
74 74 log.debug('Unable to connect to celeryd. Sync execution')
75 75 except Exception, e:
76 76 log.error(traceback.format_exc())
77 77
78 78 log.debug('executing task %s in sync mode' % task)
79 79 return ResultWrapper(task(*args, **kwargs))
80 80
81 81
82 82 def __get_lockkey(func, *fargs, **fkwargs):
83 83 params = list(fargs)
84 84 params.extend(['%s-%s' % ar for ar in fkwargs.items()])
85 85
86 86 func_name = str(func.__name__) if hasattr(func, '__name__') else str(func)
87 87
88 88 lockkey = 'task_%s.lock' % \
89 89 md5(func_name + '-' + '-'.join(map(safe_str, params))).hexdigest()
90 90 return lockkey
91 91
92 92
93 93 def locked_task(func):
94 94 def __wrapper(func, *fargs, **fkwargs):
95 95 lockkey = __get_lockkey(func, *fargs, **fkwargs)
96 96 lockkey_path = config['here']
97 97
98 98 log.info('running task with lockkey %s' % lockkey)
99 99 try:
100 100 l = DaemonLock(file_=jn(lockkey_path, lockkey))
101 101 ret = func(*fargs, **fkwargs)
102 102 l.release()
103 103 return ret
104 104 except LockHeld:
105 105 log.info('LockHeld')
106 106 return 'Task with key %s already running' % lockkey
107 107
108 108 return decorator(__wrapper, func)
109 109
110 110
111 111 def get_session():
112 112 if CELERY_ON:
113 113 engine = engine_from_config(config, 'sqlalchemy.db1.')
114 114 init_model(engine)
115 115 sa = meta.Session
116 116 return sa
117 117
118 118
119 119 def dbsession(func):
120 120 def __wrapper(func, *fargs, **fkwargs):
121 121 try:
122 122 ret = func(*fargs, **fkwargs)
123 123 return ret
124 124 finally:
125 if CELERY_ON:
125 if CELERY_ON and CELERY_EAGER is False:
126 126 meta.Session.remove()
127 127
128 128 return decorator(__wrapper, func)
@@ -1,421 +1,421 b''
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 rhodecode.lib.celerylib.tasks
4 4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 5
6 6 RhodeCode task modules, containing all task that suppose to be run
7 7 by celery daemon
8 8
9 9 :created_on: Oct 6, 2010
10 10 :author: marcink
11 11 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
12 12 :license: GPLv3, see COPYING for more details.
13 13 """
14 14 # This program is free software: you can redistribute it and/or modify
15 15 # it under the terms of the GNU General Public License as published by
16 16 # the Free Software Foundation, either version 3 of the License, or
17 17 # (at your option) any later version.
18 18 #
19 19 # This program is distributed in the hope that it will be useful,
20 20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 22 # GNU General Public License for more details.
23 23 #
24 24 # You should have received a copy of the GNU General Public License
25 25 # along with this program. If not, see <http://www.gnu.org/licenses/>.
26 26 from celery.decorators import task
27 27
28 28 import os
29 29 import traceback
30 30 import logging
31 31 from os.path import join as jn
32 32
33 33 from time import mktime
34 34 from operator import itemgetter
35 35 from string import lower
36 36
37 37 from pylons import config, url
38 38 from pylons.i18n.translation import _
39 39
40 40 from rhodecode.lib.vcs import get_backend
41 41
42 from rhodecode import CELERY_ON
42 from rhodecode import CELERY_ON, CELERY_EAGER
43 43 from rhodecode.lib.utils2 import safe_str
44 44 from rhodecode.lib.celerylib import run_task, locked_task, dbsession, \
45 45 str2bool, __get_lockkey, LockHeld, DaemonLock, get_session
46 46 from rhodecode.lib.helpers import person
47 47 from rhodecode.lib.rcmail.smtp_mailer import SmtpMailer
48 48 from rhodecode.lib.utils import add_cache, action_logger
49 49 from rhodecode.lib.compat import json, OrderedDict
50 50 from rhodecode.lib.hooks import log_create_repository
51 51
52 52 from rhodecode.model.db import Statistics, Repository, User
53 53
54 54
55 55 add_cache(config)
56 56
57 57 __all__ = ['whoosh_index', 'get_commits_stats',
58 58 'reset_user_password', 'send_email']
59 59
60 60
61 61 def get_logger(cls):
62 62 if CELERY_ON:
63 63 try:
64 64 log = cls.get_logger()
65 65 except:
66 66 log = logging.getLogger(__name__)
67 67 else:
68 68 log = logging.getLogger(__name__)
69 69
70 70 return log
71 71
72 72
73 73 @task(ignore_result=True)
74 74 @locked_task
75 75 @dbsession
76 76 def whoosh_index(repo_location, full_index):
77 77 from rhodecode.lib.indexers.daemon import WhooshIndexingDaemon
78 78 log = whoosh_index.get_logger(whoosh_index)
79 79 DBS = get_session()
80 80
81 81 index_location = config['index_dir']
82 82 WhooshIndexingDaemon(index_location=index_location,
83 83 repo_location=repo_location, sa=DBS)\
84 84 .run(full_index=full_index)
85 85
86 86
87 87 @task(ignore_result=True)
88 88 @dbsession
89 89 def get_commits_stats(repo_name, ts_min_y, ts_max_y):
90 90 log = get_logger(get_commits_stats)
91 91 DBS = get_session()
92 92 lockkey = __get_lockkey('get_commits_stats', repo_name, ts_min_y,
93 93 ts_max_y)
94 94 lockkey_path = config['here']
95 95
96 96 log.info('running task with lockkey %s' % lockkey)
97 97
98 98 try:
99 99 lock = l = DaemonLock(file_=jn(lockkey_path, lockkey))
100 100
101 101 # for js data compatibility cleans the key for person from '
102 102 akc = lambda k: person(k).replace('"', "")
103 103
104 104 co_day_auth_aggr = {}
105 105 commits_by_day_aggregate = {}
106 106 repo = Repository.get_by_repo_name(repo_name)
107 107 if repo is None:
108 108 return True
109 109
110 110 repo = repo.scm_instance
111 111 repo_size = repo.count()
112 112 # return if repo have no revisions
113 113 if repo_size < 1:
114 114 lock.release()
115 115 return True
116 116
117 117 skip_date_limit = True
118 118 parse_limit = int(config['app_conf'].get('commit_parse_limit'))
119 119 last_rev = None
120 120 last_cs = None
121 121 timegetter = itemgetter('time')
122 122
123 123 dbrepo = DBS.query(Repository)\
124 124 .filter(Repository.repo_name == repo_name).scalar()
125 125 cur_stats = DBS.query(Statistics)\
126 126 .filter(Statistics.repository == dbrepo).scalar()
127 127
128 128 if cur_stats is not None:
129 129 last_rev = cur_stats.stat_on_revision
130 130
131 131 if last_rev == repo.get_changeset().revision and repo_size > 1:
132 132 # pass silently without any work if we're not on first revision or
133 133 # current state of parsing revision(from db marker) is the
134 134 # last revision
135 135 lock.release()
136 136 return True
137 137
138 138 if cur_stats:
139 139 commits_by_day_aggregate = OrderedDict(json.loads(
140 140 cur_stats.commit_activity_combined))
141 141 co_day_auth_aggr = json.loads(cur_stats.commit_activity)
142 142
143 143 log.debug('starting parsing %s' % parse_limit)
144 144 lmktime = mktime
145 145
146 146 last_rev = last_rev + 1 if last_rev >= 0 else 0
147 147 log.debug('Getting revisions from %s to %s' % (
148 148 last_rev, last_rev + parse_limit)
149 149 )
150 150 for cs in repo[last_rev:last_rev + parse_limit]:
151 151 log.debug('parsing %s' % cs)
152 152 last_cs = cs # remember last parsed changeset
153 153 k = lmktime([cs.date.timetuple()[0], cs.date.timetuple()[1],
154 154 cs.date.timetuple()[2], 0, 0, 0, 0, 0, 0])
155 155
156 156 if akc(cs.author) in co_day_auth_aggr:
157 157 try:
158 158 l = [timegetter(x) for x in
159 159 co_day_auth_aggr[akc(cs.author)]['data']]
160 160 time_pos = l.index(k)
161 161 except ValueError:
162 162 time_pos = False
163 163
164 164 if time_pos >= 0 and time_pos is not False:
165 165
166 166 datadict = \
167 167 co_day_auth_aggr[akc(cs.author)]['data'][time_pos]
168 168
169 169 datadict["commits"] += 1
170 170 datadict["added"] += len(cs.added)
171 171 datadict["changed"] += len(cs.changed)
172 172 datadict["removed"] += len(cs.removed)
173 173
174 174 else:
175 175 if k >= ts_min_y and k <= ts_max_y or skip_date_limit:
176 176
177 177 datadict = {"time": k,
178 178 "commits": 1,
179 179 "added": len(cs.added),
180 180 "changed": len(cs.changed),
181 181 "removed": len(cs.removed),
182 182 }
183 183 co_day_auth_aggr[akc(cs.author)]['data']\
184 184 .append(datadict)
185 185
186 186 else:
187 187 if k >= ts_min_y and k <= ts_max_y or skip_date_limit:
188 188 co_day_auth_aggr[akc(cs.author)] = {
189 189 "label": akc(cs.author),
190 190 "data": [{"time":k,
191 191 "commits":1,
192 192 "added":len(cs.added),
193 193 "changed":len(cs.changed),
194 194 "removed":len(cs.removed),
195 195 }],
196 196 "schema": ["commits"],
197 197 }
198 198
199 199 #gather all data by day
200 200 if k in commits_by_day_aggregate:
201 201 commits_by_day_aggregate[k] += 1
202 202 else:
203 203 commits_by_day_aggregate[k] = 1
204 204
205 205 overview_data = sorted(commits_by_day_aggregate.items(),
206 206 key=itemgetter(0))
207 207
208 208 if not co_day_auth_aggr:
209 209 co_day_auth_aggr[akc(repo.contact)] = {
210 210 "label": akc(repo.contact),
211 211 "data": [0, 1],
212 212 "schema": ["commits"],
213 213 }
214 214
215 215 stats = cur_stats if cur_stats else Statistics()
216 216 stats.commit_activity = json.dumps(co_day_auth_aggr)
217 217 stats.commit_activity_combined = json.dumps(overview_data)
218 218
219 219 log.debug('last revison %s' % last_rev)
220 220 leftovers = len(repo.revisions[last_rev:])
221 221 log.debug('revisions to parse %s' % leftovers)
222 222
223 223 if last_rev == 0 or leftovers < parse_limit:
224 224 log.debug('getting code trending stats')
225 225 stats.languages = json.dumps(__get_codes_stats(repo_name))
226 226
227 227 try:
228 228 stats.repository = dbrepo
229 229 stats.stat_on_revision = last_cs.revision if last_cs else 0
230 230 DBS.add(stats)
231 231 DBS.commit()
232 232 except:
233 233 log.error(traceback.format_exc())
234 234 DBS.rollback()
235 235 lock.release()
236 236 return False
237 237
238 238 # final release
239 239 lock.release()
240 240
241 241 # execute another task if celery is enabled
242 242 if len(repo.revisions) > 1 and CELERY_ON:
243 243 run_task(get_commits_stats, repo_name, ts_min_y, ts_max_y)
244 244 return True
245 245 except LockHeld:
246 246 log.info('LockHeld')
247 247 return 'Task with key %s already running' % lockkey
248 248
249 249 @task(ignore_result=True)
250 250 @dbsession
251 251 def send_password_link(user_email):
252 252 from rhodecode.model.notification import EmailNotificationModel
253 253
254 254 log = get_logger(send_password_link)
255 255 DBS = get_session()
256 256
257 257 try:
258 258 user = User.get_by_email(user_email)
259 259 if user:
260 260 log.debug('password reset user found %s' % user)
261 261 link = url('reset_password_confirmation', key=user.api_key,
262 262 qualified=True)
263 263 reg_type = EmailNotificationModel.TYPE_PASSWORD_RESET
264 264 body = EmailNotificationModel().get_email_tmpl(reg_type,
265 265 **{'user':user.short_contact,
266 266 'reset_url':link})
267 267 log.debug('sending email')
268 268 run_task(send_email, user_email,
269 269 _("password reset link"), body)
270 270 log.info('send new password mail to %s' % user_email)
271 271 else:
272 272 log.debug("password reset email %s not found" % user_email)
273 273 except:
274 274 log.error(traceback.format_exc())
275 275 return False
276 276
277 277 return True
278 278
279 279 @task(ignore_result=True)
280 280 @dbsession
281 281 def reset_user_password(user_email):
282 282 from rhodecode.lib import auth
283 283
284 284 log = get_logger(reset_user_password)
285 285 DBS = get_session()
286 286
287 287 try:
288 288 try:
289 289 user = User.get_by_email(user_email)
290 290 new_passwd = auth.PasswordGenerator().gen_password(8,
291 291 auth.PasswordGenerator.ALPHABETS_BIG_SMALL)
292 292 if user:
293 293 user.password = auth.get_crypt_password(new_passwd)
294 294 user.api_key = auth.generate_api_key(user.username)
295 295 DBS.add(user)
296 296 DBS.commit()
297 297 log.info('change password for %s' % user_email)
298 298 if new_passwd is None:
299 299 raise Exception('unable to generate new password')
300 300 except:
301 301 log.error(traceback.format_exc())
302 302 DBS.rollback()
303 303
304 304 run_task(send_email, user_email,
305 305 'Your new password',
306 306 'Your new RhodeCode password:%s' % (new_passwd))
307 307 log.info('send new password mail to %s' % user_email)
308 308
309 309 except:
310 310 log.error('Failed to update user password')
311 311 log.error(traceback.format_exc())
312 312
313 313 return True
314 314
315 315
316 316 @task(ignore_result=True)
317 317 @dbsession
318 318 def send_email(recipients, subject, body, html_body=''):
319 319 """
320 320 Sends an email with defined parameters from the .ini files.
321 321
322 322 :param recipients: list of recipients, it this is empty the defined email
323 323 address from field 'email_to' is used instead
324 324 :param subject: subject of the mail
325 325 :param body: body of the mail
326 326 :param html_body: html version of body
327 327 """
328 328 log = get_logger(send_email)
329 329 DBS = get_session()
330 330
331 331 email_config = config
332 332 subject = "%s %s" % (email_config.get('email_prefix', ''), subject)
333 333 if not recipients:
334 334 # if recipients are not defined we send to email_config + all admins
335 335 admins = [u.email for u in User.query()
336 336 .filter(User.admin == True).all()]
337 337 recipients = [email_config.get('email_to')] + admins
338 338
339 339 mail_from = email_config.get('app_email_from', 'RhodeCode')
340 340 user = email_config.get('smtp_username')
341 341 passwd = email_config.get('smtp_password')
342 342 mail_server = email_config.get('smtp_server')
343 343 mail_port = email_config.get('smtp_port')
344 344 tls = str2bool(email_config.get('smtp_use_tls'))
345 345 ssl = str2bool(email_config.get('smtp_use_ssl'))
346 346 debug = str2bool(config.get('debug'))
347 347 smtp_auth = email_config.get('smtp_auth')
348 348
349 349 try:
350 350 m = SmtpMailer(mail_from, user, passwd, mail_server, smtp_auth,
351 351 mail_port, ssl, tls, debug=debug)
352 352 m.send(recipients, subject, body, html_body)
353 353 except:
354 354 log.error('Mail sending failed')
355 355 log.error(traceback.format_exc())
356 356 return False
357 357 return True
358 358
359 359
360 360 @task(ignore_result=True)
361 361 @dbsession
362 362 def create_repo_fork(form_data, cur_user):
363 363 """
364 364 Creates a fork of repository using interval VCS methods
365 365
366 366 :param form_data:
367 367 :param cur_user:
368 368 """
369 369 from rhodecode.model.repo import RepoModel
370 370
371 371 log = get_logger(create_repo_fork)
372 372 DBS = get_session()
373 373
374 374 base_path = Repository.base_path()
375 375
376 376 fork_repo = RepoModel(DBS).create(form_data, cur_user,
377 377 just_db=True, fork=True)
378 378
379 379 alias = form_data['repo_type']
380 380 org_repo_name = form_data['org_path']
381 381 fork_name = form_data['repo_name_full']
382 382 update_after_clone = form_data['update_after_clone']
383 383 source_repo_path = os.path.join(base_path, org_repo_name)
384 384 destination_fork_path = os.path.join(base_path, fork_name)
385 385
386 386 log.info('creating fork of %s as %s', source_repo_path,
387 387 destination_fork_path)
388 388 backend = get_backend(alias)
389 389 backend(safe_str(destination_fork_path), create=True,
390 390 src_url=safe_str(source_repo_path),
391 391 update_after_clone=update_after_clone)
392 392 log_create_repository(fork_repo.get_dict(), created_by=cur_user.username)
393 393
394 394 action_logger(cur_user, 'user_forked_repo:%s' % fork_name,
395 395 org_repo_name, '', DBS)
396 396
397 397 action_logger(cur_user, 'user_created_fork:%s' % fork_name,
398 398 fork_name, '', DBS)
399 399 # finally commit at latest possible stage
400 400 DBS.commit()
401 401
402 402
403 403 def __get_codes_stats(repo_name):
404 404 from rhodecode.config.conf import LANGUAGES_EXTENSIONS_MAP
405 405 repo = Repository.get_by_repo_name(repo_name).scm_instance
406 406
407 407 tip = repo.get_changeset()
408 408 code_stats = {}
409 409
410 410 def aggregate(cs):
411 411 for f in cs[2]:
412 412 ext = lower(f.extension)
413 413 if ext in LANGUAGES_EXTENSIONS_MAP.keys() and not f.is_binary:
414 414 if ext in code_stats:
415 415 code_stats[ext] += 1
416 416 else:
417 417 code_stats[ext] = 1
418 418
419 419 map(aggregate, tip.walk('/'))
420 420
421 421 return code_stats or {}
General Comments 0
You need to be logged in to leave comments. Login now