Show More
@@ -17,13 +17,17 b' fixes' | |||||
17 | incompatible |
|
17 | incompatible | |
18 | - setup-app will check for write permission in given path |
|
18 | - setup-app will check for write permission in given path | |
19 | - cleaned up license info issue #149 |
|
19 | - cleaned up license info issue #149 | |
20 | - fixes for issues #137 and #116 |
|
20 | - fixes for issues #137,#116 and #116, problems with unicode and | |
|
21 | accented characters. | |||
21 | - fixes crashes on gravatar, when passed in email as unicode |
|
22 | - fixes crashes on gravatar, when passed in email as unicode | |
22 | - fixed tooltip flickering problems |
|
23 | - fixed tooltip flickering problems | |
23 | - fixed came_from redirection on windows |
|
24 | - fixed came_from redirection on windows | |
24 | - fixed logging modules,and sql formatters |
|
25 | - fixed logging modules,and sql formatters | |
25 |
- windows fixes for os.kill |
|
26 | - windows fixes for os.kill #133 | |
|
27 | - fixes path splitting for windows issues #148 | |||
|
28 | - fixed issue #143 wrong import on migration to 1.1.X | |||
26 |
|
29 | |||
|
30 | ||||
27 | 1.1.7 (**2011-03-23**) |
|
31 | 1.1.7 (**2011-03-23**) | |
28 | ====================== |
|
32 | ====================== | |
29 |
|
33 |
@@ -6,14 +6,14 b' from sqlalchemy.exc import DatabaseError' | |||||
6 | from sqlalchemy.orm import relation, backref, class_mapper |
|
6 | from sqlalchemy.orm import relation, backref, class_mapper | |
7 | from sqlalchemy.orm.session import Session |
|
7 | from sqlalchemy.orm.session import Session | |
8 | from rhodecode.model.meta import Base |
|
8 | from rhodecode.model.meta import Base | |
9 | from rhodecode.model.db import BaseModel |
|
|||
10 |
|
9 | |||
11 | from rhodecode.lib.dbmigrate.migrate import * |
|
10 | from rhodecode.lib.dbmigrate.migrate import * | |
|
11 | from rhodecode.lib.dbmigrate.migrate.changeset import * | |||
12 |
|
12 | |||
13 | log = logging.getLogger(__name__) |
|
13 | log = logging.getLogger(__name__) | |
14 |
|
14 | |||
15 | def upgrade(migrate_engine): |
|
15 | def upgrade(migrate_engine): | |
16 |
""" Upgrade operations go here. |
|
16 | """ Upgrade operations go here. | |
17 | Don't create your own engine; bind migrate_engine to your metadata |
|
17 | Don't create your own engine; bind migrate_engine to your metadata | |
18 | """ |
|
18 | """ | |
19 |
|
19 | |||
@@ -32,7 +32,7 b' def upgrade(migrate_engine):' | |||||
32 |
|
32 | |||
33 | #========================================================================== |
|
33 | #========================================================================== | |
34 | # Upgrade of `user_logs` table |
|
34 | # Upgrade of `user_logs` table | |
35 |
#========================================================================== |
|
35 | #========================================================================== | |
36 |
|
36 | |||
37 | tblname = 'users' |
|
37 | tblname = 'users' | |
38 | tbl = Table(tblname, MetaData(bind=migrate_engine), autoload=True, |
|
38 | tbl = Table(tblname, MetaData(bind=migrate_engine), autoload=True, | |
@@ -48,7 +48,7 b' def upgrade(migrate_engine):' | |||||
48 |
|
48 | |||
49 | #========================================================================== |
|
49 | #========================================================================== | |
50 | # Upgrade of `repositories` table |
|
50 | # Upgrade of `repositories` table | |
51 |
#========================================================================== |
|
51 | #========================================================================== | |
52 | tblname = 'repositories' |
|
52 | tblname = 'repositories' | |
53 | tbl = Table(tblname, MetaData(bind=migrate_engine), autoload=True, |
|
53 | tbl = Table(tblname, MetaData(bind=migrate_engine), autoload=True, | |
54 | autoload_with=migrate_engine) |
|
54 | autoload_with=migrate_engine) | |
@@ -69,8 +69,6 b' def upgrade(migrate_engine):' | |||||
69 | #========================================================================== |
|
69 | #========================================================================== | |
70 | # Add table `user_followings` |
|
70 | # Add table `user_followings` | |
71 | #========================================================================== |
|
71 | #========================================================================== | |
72 | tblname = 'user_followings' |
|
|||
73 |
|
||||
74 | class UserFollowing(Base, BaseModel): |
|
72 | class UserFollowing(Base, BaseModel): | |
75 | __tablename__ = 'user_followings' |
|
73 | __tablename__ = 'user_followings' | |
76 | __table_args__ = (UniqueConstraint('user_id', 'follows_repository_id'), |
|
74 | __table_args__ = (UniqueConstraint('user_id', 'follows_repository_id'), | |
@@ -87,13 +85,11 b' def upgrade(migrate_engine):' | |||||
87 | follows_user = relation('User', primaryjoin='User.user_id==UserFollowing.follows_user_id') |
|
85 | follows_user = relation('User', primaryjoin='User.user_id==UserFollowing.follows_user_id') | |
88 | follows_repository = relation('Repository') |
|
86 | follows_repository = relation('Repository') | |
89 |
|
87 | |||
90 | Base.metadata.tables[tblname].create(migrate_engine) |
|
88 | UserFollowing().__table__.create() | |
91 |
|
89 | |||
92 | #========================================================================== |
|
90 | #========================================================================== | |
93 | # Add table `cache_invalidation` |
|
91 | # Add table `cache_invalidation` | |
94 | #========================================================================== |
|
92 | #========================================================================== | |
95 | tblname = 'cache_invalidation' |
|
|||
96 |
|
||||
97 | class CacheInvalidation(Base, BaseModel): |
|
93 | class CacheInvalidation(Base, BaseModel): | |
98 | __tablename__ = 'cache_invalidation' |
|
94 | __tablename__ = 'cache_invalidation' | |
99 | __table_args__ = (UniqueConstraint('cache_key'), {'useexisting':True}) |
|
95 | __table_args__ = (UniqueConstraint('cache_key'), {'useexisting':True}) | |
@@ -110,18 +106,10 b' def upgrade(migrate_engine):' | |||||
110 |
|
106 | |||
111 | def __repr__(self): |
|
107 | def __repr__(self): | |
112 | return "<CacheInvalidation('%s:%s')>" % (self.cache_id, self.cache_key) |
|
108 | return "<CacheInvalidation('%s:%s')>" % (self.cache_id, self.cache_key) | |
113 |
|
109 | CacheInvalidation().__table__.create() | ||
114 | Base.metadata.tables[tblname].create(migrate_engine) |
|
|||
115 |
|
110 | |||
116 | return |
|
111 | return | |
117 |
|
112 | |||
118 |
|
||||
119 |
|
||||
120 |
|
||||
121 |
|
||||
122 |
|
||||
123 | def downgrade(migrate_engine): |
|
113 | def downgrade(migrate_engine): | |
124 | meta = MetaData() |
|
114 | meta = MetaData() | |
125 | meta.bind = migrate_engine |
|
115 | meta.bind = migrate_engine | |
126 |
|
||||
127 |
|
@@ -402,8 +402,6 b' HasRepoPermissionAny, HasRepoPermissionA' | |||||
402 | #============================================================================== |
|
402 | #============================================================================== | |
403 | # GRAVATAR URL |
|
403 | # GRAVATAR URL | |
404 | #============================================================================== |
|
404 | #============================================================================== | |
405 | import hashlib |
|
|||
406 | import urllib |
|
|||
407 | from pylons import request |
|
405 | from pylons import request | |
408 |
|
406 | |||
409 | def gravatar_url(email_address, size=30): |
|
407 | def gravatar_url(email_address, size=30): |
@@ -4,10 +4,10 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Hooks runned by rhodecode |
|
6 | Hooks runned by rhodecode | |
7 |
|
7 | |||
8 | :created_on: Aug 6, 2010 |
|
8 | :created_on: Aug 6, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 |
:copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 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 | |
@@ -34,7 +34,7 b' from rhodecode.lib.utils import action_l' | |||||
34 |
|
34 | |||
35 | def repo_size(ui, repo, hooktype=None, **kwargs): |
|
35 | def repo_size(ui, repo, hooktype=None, **kwargs): | |
36 | """Presents size of repository after push |
|
36 | """Presents size of repository after push | |
37 |
|
37 | |||
38 | :param ui: |
|
38 | :param ui: | |
39 | :param repo: |
|
39 | :param repo: | |
40 | :param hooktype: |
|
40 | :param hooktype: | |
@@ -65,7 +65,7 b' def repo_size(ui, repo, hooktype=None, *' | |||||
65 |
|
65 | |||
66 | def log_pull_action(ui, repo, **kwargs): |
|
66 | def log_pull_action(ui, repo, **kwargs): | |
67 | """Logs user last pull action |
|
67 | """Logs user last pull action | |
68 |
|
68 | |||
69 | :param ui: |
|
69 | :param ui: | |
70 | :param repo: |
|
70 | :param repo: | |
71 | """ |
|
71 | """ | |
@@ -81,7 +81,7 b' def log_pull_action(ui, repo, **kwargs):' | |||||
81 |
|
81 | |||
82 | def log_push_action(ui, repo, **kwargs): |
|
82 | def log_push_action(ui, repo, **kwargs): | |
83 | """Maps user last push action to new changeset id, from mercurial |
|
83 | """Maps user last push action to new changeset id, from mercurial | |
84 |
|
84 | |||
85 | :param ui: |
|
85 | :param ui: | |
86 | :param repo: |
|
86 | :param repo: | |
87 | """ |
|
87 | """ | |
@@ -111,4 +111,3 b' def log_push_action(ui, repo, **kwargs):' | |||||
111 | action_logger(username, action, repository, extra_params['ip']) |
|
111 | action_logger(username, action, repository, extra_params['ip']) | |
112 |
|
112 | |||
113 | return 0 |
|
113 | return 0 | |
114 |
|
@@ -1,3 +1,27 b'' | |||||
|
1 | # -*- coding: utf-8 -*- | |||
|
2 | """ | |||
|
3 | rhodecode.lib.indexers.__init__ | |||
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |||
|
5 | ||||
|
6 | Whoosh indexing module for RhodeCode | |||
|
7 | ||||
|
8 | :created_on: Aug 17, 2010 | |||
|
9 | :author: marcink | |||
|
10 | :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> | |||
|
11 | :license: GPLv3, see COPYING for more details. | |||
|
12 | """ | |||
|
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 | |||
|
15 | # the Free Software Foundation, either version 3 of the License, or | |||
|
16 | # (at your option) any later version. | |||
|
17 | # | |||
|
18 | # This program is distributed in the hope that it will be useful, | |||
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
21 | # GNU General Public License for more details. | |||
|
22 | # | |||
|
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/>. | |||
1 | import os |
|
25 | import os | |
2 | import sys |
|
26 | import sys | |
3 | import traceback |
|
27 | import traceback | |
@@ -6,6 +30,8 b' from os.path import dirname as dn, join ' | |||||
6 | #to get the rhodecode import |
|
30 | #to get the rhodecode import | |
7 | sys.path.append(dn(dn(dn(os.path.realpath(__file__))))) |
|
31 | sys.path.append(dn(dn(dn(os.path.realpath(__file__))))) | |
8 |
|
32 | |||
|
33 | from string import strip | |||
|
34 | ||||
9 | from rhodecode.model import init_model |
|
35 | from rhodecode.model import init_model | |
10 | from rhodecode.model.scm import ScmModel |
|
36 | from rhodecode.model.scm import ScmModel | |
11 | from rhodecode.config.environment import load_environment |
|
37 | from rhodecode.config.environment import load_environment | |
@@ -135,10 +161,12 b' class ResultWrapper(object):' | |||||
135 | for docid in self.doc_ids: |
|
161 | for docid in self.doc_ids: | |
136 | yield self.get_full_content(docid) |
|
162 | yield self.get_full_content(docid) | |
137 |
|
163 | |||
138 |
def __get |
|
164 | def __getitem__(self, key): | |
139 | """ |
|
165 | """ | |
140 | Slicing of resultWrapper |
|
166 | Slicing of resultWrapper | |
141 | """ |
|
167 | """ | |
|
168 | i, j = key.start, key.stop | |||
|
169 | ||||
142 | slice = [] |
|
170 | slice = [] | |
143 | for docid in self.doc_ids[i:j]: |
|
171 | for docid in self.doc_ids[i:j]: | |
144 | slice.append(self.get_full_content(docid)) |
|
172 | slice.append(self.get_full_content(docid)) |
@@ -1,8 +1,16 b'' | |||||
1 | #!/usr/bin/env python |
|
1 | # -*- coding: utf-8 -*- | |
2 | # encoding: utf-8 |
|
2 | """ | |
3 | # middleware to handle mercurial api calls |
|
3 | rhodecode.lib.middleware.simplehg | |
4 | # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 | # |
|
5 | ||
|
6 | SimpleHG middleware for handling mercurial protocol request | |||
|
7 | (push/clone etc.). It's implemented with basic auth function | |||
|
8 | ||||
|
9 | :created_on: Apr 28, 2010 | |||
|
10 | :author: marcink | |||
|
11 | :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> | |||
|
12 | :license: GPLv3, see COPYING for more details. | |||
|
13 | """ | |||
6 | # This program is free software: you can redistribute it and/or modify |
|
14 | # This program is free software: you can redistribute it and/or modify | |
7 | # it under the terms of the GNU General Public License as published by |
|
15 | # it under the terms of the GNU General Public License as published by | |
8 | # the Free Software Foundation, either version 3 of the License, or |
|
16 | # the Free Software Foundation, either version 3 of the License, or | |
@@ -15,13 +23,11 b'' | |||||
15 | # |
|
23 | # | |
16 | # You should have received a copy of the GNU General Public License |
|
24 | # You should have received a copy of the GNU General Public License | |
17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
25 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
18 | """ |
|
|||
19 | Created on 2010-04-28 |
|
|||
20 |
|
26 | |||
21 | @author: marcink |
|
27 | import os | |
22 | SimpleHG middleware for handling mercurial protocol request (push/clone etc.) |
|
28 | import logging | |
23 | It's implemented with basic auth function |
|
29 | import traceback | |
24 | """ |
|
30 | ||
25 | from mercurial.error import RepoError |
|
31 | from mercurial.error import RepoError | |
26 | from mercurial.hgweb import hgweb |
|
32 | from mercurial.hgweb import hgweb | |
27 | from mercurial.hgweb.request import wsgiapplication |
|
33 | from mercurial.hgweb.request import wsgiapplication |
@@ -12,8 +12,8 b' class ProfilingMiddleware(object):' | |||||
12 | def __init__(self, app): |
|
12 | def __init__(self, app): | |
13 | self.lock = threading.Lock() |
|
13 | self.lock = threading.Lock() | |
14 | self.app = app |
|
14 | self.app = app | |
15 |
|
15 | |||
16 |
|
16 | |||
17 | def __call__(self, environ, start_response): |
|
17 | def __call__(self, environ, start_response): | |
18 | with self.lock: |
|
18 | with self.lock: | |
19 | profiler = cProfile.Profile() |
|
19 | profiler = cProfile.Profile() | |
@@ -41,13 +41,11 b' class ProfilingMiddleware(object):' | |||||
41 | ## Browsers don't mind this. |
|
41 | ## Browsers don't mind this. | |
42 | resp += '<pre style="text-align:left; border-top: 4px dashed red; padding: 1em;">' |
|
42 | resp += '<pre style="text-align:left; border-top: 4px dashed red; padding: 1em;">' | |
43 | resp += cgi.escape(out.getvalue(), True) |
|
43 | resp += cgi.escape(out.getvalue(), True) | |
44 |
|
44 | |||
45 | output = StringIO() |
|
45 | output = StringIO() | |
46 | pprint.pprint(environ, output, depth=3) |
|
46 | pprint.pprint(environ, output, depth=3) | |
47 |
|
47 | |||
48 | resp += cgi.escape(output.getvalue(), True) |
|
48 | resp += cgi.escape(output.getvalue(), True) | |
49 | resp += '</pre>' |
|
49 | resp += '</pre>' | |
50 |
|
50 | |||
51 | return resp |
|
51 | return resp | |
52 |
|
||||
53 |
|
@@ -2,9 +2,9 b'' | |||||
2 | """ |
|
2 | """ | |
3 | rhodecode.lib.smtp_mailer |
|
3 | rhodecode.lib.smtp_mailer | |
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Simple smtp mailer used in RhodeCode |
|
6 | Simple smtp mailer used in RhodeCode | |
7 |
|
7 | |||
8 | :created_on: Sep 13, 2010 |
|
8 | :created_on: Sep 13, 2010 | |
9 | :copyright: (c) 2011 by marcink. |
|
9 | :copyright: (c) 2011 by marcink. | |
10 | :license: LICENSE_NAME, see LICENSE_FILE for more details. |
|
10 | :license: LICENSE_NAME, see LICENSE_FILE for more details. | |
@@ -25,18 +25,18 b' from email import encoders' | |||||
25 |
|
25 | |||
26 | class SmtpMailer(object): |
|
26 | class SmtpMailer(object): | |
27 | """SMTP mailer class |
|
27 | """SMTP mailer class | |
28 |
|
28 | |||
29 | mailer = SmtpMailer(mail_from, user, passwd, mail_server, mail_port, ssl, tls) |
|
29 | mailer = SmtpMailer(mail_from, user, passwd, mail_server, mail_port, ssl, tls) | |
30 |
mailer.send(recipients, subject, body, attachment_files) |
|
30 | mailer.send(recipients, subject, body, attachment_files) | |
31 |
|
31 | |||
32 | :param recipients might be a list of string or single string |
|
32 | :param recipients might be a list of string or single string | |
33 |
:param attachment_files is a dict of {filename:location} |
|
33 | :param attachment_files is a dict of {filename:location} | |
34 |
it tries to guess the mimetype and attach the file |
|
34 | it tries to guess the mimetype and attach the file | |
35 |
|
35 | |||
36 | """ |
|
36 | """ | |
37 |
|
37 | |||
38 | def __init__(self, mail_from, user, passwd, mail_server, |
|
38 | def __init__(self, mail_from, user, passwd, mail_server, | |
39 | mail_port=None, ssl=False, tls=False): |
|
39 | mail_port=None, ssl=False, tls=False, debug=False): | |
40 |
|
40 | |||
41 | self.mail_from = mail_from |
|
41 | self.mail_from = mail_from | |
42 | self.mail_server = mail_server |
|
42 | self.mail_server = mail_server | |
@@ -45,7 +45,7 b' class SmtpMailer(object):' | |||||
45 | self.passwd = passwd |
|
45 | self.passwd = passwd | |
46 | self.ssl = ssl |
|
46 | self.ssl = ssl | |
47 | self.tls = tls |
|
47 | self.tls = tls | |
48 |
self.debug = |
|
48 | self.debug = debug | |
49 |
|
49 | |||
50 | def send(self, recipients=[], subject='', body='', attachment_files=None): |
|
50 | def send(self, recipients=[], subject='', body='', attachment_files=None): | |
51 |
|
51 | |||
@@ -132,7 +132,7 b' class SmtpMailer(object):' | |||||
132 | def get_content(self, msg_file): |
|
132 | def get_content(self, msg_file): | |
133 | """Get content based on type, if content is a string do open first |
|
133 | """Get content based on type, if content is a string do open first | |
134 | else just read because it's a probably open file object |
|
134 | else just read because it's a probably open file object | |
135 |
|
135 | |||
136 | :param msg_file: |
|
136 | :param msg_file: | |
137 | """ |
|
137 | """ | |
138 | if isinstance(msg_file, str): |
|
138 | if isinstance(msg_file, str): |
@@ -50,6 +50,7 b' from rhodecode.model.user import UserMod' | |||||
50 |
|
50 | |||
51 | log = logging.getLogger(__name__) |
|
51 | log = logging.getLogger(__name__) | |
52 |
|
52 | |||
|
53 | ||||
53 | def recursive_replace(str, replace=' '): |
|
54 | def recursive_replace(str, replace=' '): | |
54 | """Recursive replace of given sign to just one instance |
|
55 | """Recursive replace of given sign to just one instance | |
55 |
|
56 | |||
@@ -67,6 +68,7 b" def recursive_replace(str, replace=' '):" | |||||
67 | str = str.replace(replace * 2, replace) |
|
68 | str = str.replace(replace * 2, replace) | |
68 | return recursive_replace(str, replace) |
|
69 | return recursive_replace(str, replace) | |
69 |
|
70 | |||
|
71 | ||||
70 | def repo_name_slug(value): |
|
72 | def repo_name_slug(value): | |
71 | """Return slug of name of repository |
|
73 | """Return slug of name of repository | |
72 | This function is called on each creation/modification |
|
74 | This function is called on each creation/modification | |
@@ -86,10 +88,11 b' def repo_name_slug(value):' | |||||
86 | def get_repo_slug(request): |
|
88 | def get_repo_slug(request): | |
87 | return request.environ['pylons.routes_dict'].get('repo_name') |
|
89 | return request.environ['pylons.routes_dict'].get('repo_name') | |
88 |
|
90 | |||
|
91 | ||||
89 | def action_logger(user, action, repo, ipaddr='', sa=None): |
|
92 | def action_logger(user, action, repo, ipaddr='', sa=None): | |
90 | """ |
|
93 | """ | |
91 | Action logger for various actions made by users |
|
94 | Action logger for various actions made by users | |
92 |
|
95 | |||
93 | :param user: user that made this action, can be a unique username string or |
|
96 | :param user: user that made this action, can be a unique username string or | |
94 | object containing user_id attribute |
|
97 | object containing user_id attribute | |
95 | :param action: action to log, should be on of predefined unique actions for |
|
98 | :param action: action to log, should be on of predefined unique actions for | |
@@ -98,7 +101,7 b' def action_logger(user, action, repo, ip' | |||||
98 | that action was made on |
|
101 | that action was made on | |
99 | :param ipaddr: optional ip address from what the action was made |
|
102 | :param ipaddr: optional ip address from what the action was made | |
100 | :param sa: optional sqlalchemy session |
|
103 | :param sa: optional sqlalchemy session | |
101 |
|
104 | |||
102 | """ |
|
105 | """ | |
103 |
|
106 | |||
104 | if not sa: |
|
107 | if not sa: | |
@@ -113,7 +116,6 b' def action_logger(user, action, repo, ip' | |||||
113 | else: |
|
116 | else: | |
114 | raise Exception('You have to provide user object or username') |
|
117 | raise Exception('You have to provide user object or username') | |
115 |
|
118 | |||
116 |
|
||||
117 | rm = RepoModel() |
|
119 | rm = RepoModel() | |
118 | if hasattr(repo, 'repo_id'): |
|
120 | if hasattr(repo, 'repo_id'): | |
119 | repo_obj = rm.get(repo.repo_id, cache=False) |
|
121 | repo_obj = rm.get(repo.repo_id, cache=False) | |
@@ -124,7 +126,6 b' def action_logger(user, action, repo, ip' | |||||
124 | else: |
|
126 | else: | |
125 | raise Exception('You have to provide repository to action logger') |
|
127 | raise Exception('You have to provide repository to action logger') | |
126 |
|
128 | |||
127 |
|
||||
128 | user_log = UserLog() |
|
129 | user_log = UserLog() | |
129 | user_log.user_id = user_obj.user_id |
|
130 | user_log.user_id = user_obj.user_id | |
130 | user_log.action = action |
|
131 | user_log.action = action | |
@@ -142,6 +143,7 b' def action_logger(user, action, repo, ip' | |||||
142 | log.error(traceback.format_exc()) |
|
143 | log.error(traceback.format_exc()) | |
143 | sa.rollback() |
|
144 | sa.rollback() | |
144 |
|
145 | |||
|
146 | ||||
145 | def get_repos(path, recursive=False, initial=False): |
|
147 | def get_repos(path, recursive=False, initial=False): | |
146 | """ |
|
148 | """ | |
147 | Scans given path for repos and return (name,(type,path)) tuple |
|
149 | Scans given path for repos and return (name,(type,path)) tuple | |
@@ -173,12 +175,14 b' def check_repo_fast(repo_name, base_path' | |||||
173 | Check given path for existence of directory |
|
175 | Check given path for existence of directory | |
174 | :param repo_name: |
|
176 | :param repo_name: | |
175 | :param base_path: |
|
177 | :param base_path: | |
176 |
|
178 | |||
177 | :return False: if this directory is present |
|
179 | :return False: if this directory is present | |
178 | """ |
|
180 | """ | |
179 |
if os.path.isdir(os.path.join(base_path, repo_name)): |
|
181 | if os.path.isdir(os.path.join(base_path, repo_name)): | |
|
182 | return False | |||
180 | return True |
|
183 | return True | |
181 |
|
184 | |||
|
185 | ||||
182 | def check_repo(repo_name, base_path, verify=True): |
|
186 | def check_repo(repo_name, base_path, verify=True): | |
183 |
|
187 | |||
184 | repo_path = os.path.join(base_path, repo_name) |
|
188 | repo_path = os.path.join(base_path, repo_name) | |
@@ -197,13 +201,17 b' def check_repo(repo_name, base_path, ver' | |||||
197 | log.info('%s repo is free for creation', repo_name) |
|
201 | log.info('%s repo is free for creation', repo_name) | |
198 | return True |
|
202 | return True | |
199 |
|
203 | |||
|
204 | ||||
200 | def ask_ok(prompt, retries=4, complaint='Yes or no, please!'): |
|
205 | def ask_ok(prompt, retries=4, complaint='Yes or no, please!'): | |
201 | while True: |
|
206 | while True: | |
202 | ok = raw_input(prompt) |
|
207 | ok = raw_input(prompt) | |
203 |
if ok in ('y', 'ye', 'yes'): |
|
208 | if ok in ('y', 'ye', 'yes'): | |
204 | if ok in ('n', 'no', 'nop', 'nope'): return False |
|
209 | return True | |
|
210 | if ok in ('n', 'no', 'nop', 'nope'): | |||
|
211 | return False | |||
205 | retries = retries - 1 |
|
212 | retries = retries - 1 | |
206 |
if retries < 0: |
|
213 | if retries < 0: | |
|
214 | raise IOError | |||
207 | print complaint |
|
215 | print complaint | |
208 |
|
216 | |||
209 | #propagated from mercurial documentation |
|
217 | #propagated from mercurial documentation | |
@@ -218,11 +226,11 b" ui_sections = ['alias', 'auth'," | |||||
218 | 'server', 'trusted', |
|
226 | 'server', 'trusted', | |
219 | 'ui', 'web', ] |
|
227 | 'ui', 'web', ] | |
220 |
|
228 | |||
|
229 | ||||
221 | def make_ui(read_from='file', path=None, checkpaths=True): |
|
230 | def make_ui(read_from='file', path=None, checkpaths=True): | |
222 | """ |
|
231 | """A function that will read python rc files or database | |
223 | A function that will read python rc files or database |
|
|||
224 | and make an mercurial ui object from read options |
|
232 | and make an mercurial ui object from read options | |
225 |
|
233 | |||
226 | :param path: path to mercurial config file |
|
234 | :param path: path to mercurial config file | |
227 | :param checkpaths: check the path |
|
235 | :param checkpaths: check the path | |
228 | :param read_from: read from 'file' or 'db' |
|
236 | :param read_from: read from 'file' or 'db' | |
@@ -247,7 +255,6 b" def make_ui(read_from='file', path=None," | |||||
247 | log.debug('settings ui from file[%s]%s:%s', section, k, v) |
|
255 | log.debug('settings ui from file[%s]%s:%s', section, k, v) | |
248 | baseui.setconfig(section, k, v) |
|
256 | baseui.setconfig(section, k, v) | |
249 |
|
257 | |||
250 |
|
||||
251 | elif read_from == 'db': |
|
258 | elif read_from == 'db': | |
252 | sa = meta.Session() |
|
259 | sa = meta.Session() | |
253 | ret = sa.query(RhodeCodeUi)\ |
|
260 | ret = sa.query(RhodeCodeUi)\ | |
@@ -276,6 +283,7 b' def set_rhodecode_config(config):' | |||||
276 | for k, v in hgsettings.items(): |
|
283 | for k, v in hgsettings.items(): | |
277 | config[k] = v |
|
284 | config[k] = v | |
278 |
|
285 | |||
|
286 | ||||
279 | def invalidate_cache(cache_key, *args): |
|
287 | def invalidate_cache(cache_key, *args): | |
280 | """Puts cache invalidation task into db for |
|
288 | """Puts cache invalidation task into db for | |
281 | further global cache invalidation |
|
289 | further global cache invalidation | |
@@ -287,18 +295,20 b' def invalidate_cache(cache_key, *args):' | |||||
287 | name = cache_key.split('get_repo_cached_')[-1] |
|
295 | name = cache_key.split('get_repo_cached_')[-1] | |
288 | ScmModel().mark_for_invalidation(name) |
|
296 | ScmModel().mark_for_invalidation(name) | |
289 |
|
297 | |||
|
298 | ||||
290 | class EmptyChangeset(BaseChangeset): |
|
299 | class EmptyChangeset(BaseChangeset): | |
291 | """ |
|
300 | """ | |
292 | An dummy empty changeset. It's possible to pass hash when creating |
|
301 | An dummy empty changeset. It's possible to pass hash when creating | |
293 | an EmptyChangeset |
|
302 | an EmptyChangeset | |
294 | """ |
|
303 | """ | |
295 |
|
304 | |||
296 | def __init__(self, cs='0' * 40): |
|
305 | def __init__(self, cs='0' * 40, repo=None): | |
297 | self._empty_cs = cs |
|
306 | self._empty_cs = cs | |
298 | self.revision = -1 |
|
307 | self.revision = -1 | |
299 | self.message = '' |
|
308 | self.message = '' | |
300 | self.author = '' |
|
309 | self.author = '' | |
301 | self.date = '' |
|
310 | self.date = '' | |
|
311 | self.repository = repo | |||
302 |
|
312 | |||
303 | @LazyProperty |
|
313 | @LazyProperty | |
304 | def raw_id(self): |
|
314 | def raw_id(self): | |
@@ -350,6 +360,7 b' def repo2db_mapper(initial_repo_list, re' | |||||
350 | sa.delete(repo) |
|
360 | sa.delete(repo) | |
351 | sa.commit() |
|
361 | sa.commit() | |
352 |
|
362 | |||
|
363 | ||||
353 | class OrderedDict(dict, DictMixin): |
|
364 | class OrderedDict(dict, DictMixin): | |
354 |
|
365 | |||
355 | def __init__(self, *args, **kwds): |
|
366 | def __init__(self, *args, **kwds): | |
@@ -452,7 +463,7 b' class OrderedDict(dict, DictMixin):' | |||||
452 |
|
463 | |||
453 | #set cache regions for beaker so celery can utilise it |
|
464 | #set cache regions for beaker so celery can utilise it | |
454 | def add_cache(settings): |
|
465 | def add_cache(settings): | |
455 | cache_settings = {'regions':None} |
|
466 | cache_settings = {'regions': None} | |
456 | for key in settings.keys(): |
|
467 | for key in settings.keys(): | |
457 | for prefix in ['beaker.cache.', 'cache.']: |
|
468 | for prefix in ['beaker.cache.', 'cache.']: | |
458 | if key.startswith(prefix): |
|
469 | if key.startswith(prefix): | |
@@ -477,6 +488,7 b' def add_cache(settings):' | |||||
477 | 'memory') |
|
488 | 'memory') | |
478 | beaker.cache.cache_regions[region] = region_settings |
|
489 | beaker.cache.cache_regions[region] = region_settings | |
479 |
|
490 | |||
|
491 | ||||
480 | def get_current_revision(): |
|
492 | def get_current_revision(): | |
481 | """Returns tuple of (number, id) from repository containing this package |
|
493 | """Returns tuple of (number, id) from repository containing this package | |
482 | or None if repository could not be found. |
|
494 | or None if repository could not be found. | |
@@ -496,9 +508,10 b' def get_current_revision():' | |||||
496 | "was: %s" % err) |
|
508 | "was: %s" % err) | |
497 | return None |
|
509 | return None | |
498 |
|
510 | |||
499 | #=============================================================================== |
|
511 | ||
|
512 | #============================================================================== | |||
500 | # TEST FUNCTIONS AND CREATORS |
|
513 | # TEST FUNCTIONS AND CREATORS | |
501 |
#============================================================================== |
|
514 | #============================================================================== | |
502 | def create_test_index(repo_location, full_index): |
|
515 | def create_test_index(repo_location, full_index): | |
503 | """Makes default test index |
|
516 | """Makes default test index | |
504 | :param repo_location: |
|
517 | :param repo_location: | |
@@ -521,6 +534,7 b' def create_test_index(repo_location, ful' | |||||
521 | except LockHeld: |
|
534 | except LockHeld: | |
522 | pass |
|
535 | pass | |
523 |
|
536 | |||
|
537 | ||||
524 | def create_test_env(repos_test_path, config): |
|
538 | def create_test_env(repos_test_path, config): | |
525 | """Makes a fresh database and |
|
539 | """Makes a fresh database and | |
526 | install test repository into tmp dir |
|
540 | install test repository into tmp dir | |
@@ -541,7 +555,8 b' def create_test_env(repos_test_path, con' | |||||
541 | ch.setLevel(logging.DEBUG) |
|
555 | ch.setLevel(logging.DEBUG) | |
542 |
|
556 | |||
543 | # create formatter |
|
557 | # create formatter | |
544 |
formatter = logging.Formatter("%(asctime)s - %(name)s - |
|
558 | formatter = logging.Formatter("%(asctime)s - %(name)s -" | |
|
559 | " %(levelname)s - %(message)s") | |||
545 |
|
560 | |||
546 | # add formatter to ch |
|
561 | # add formatter to ch | |
547 | ch.setFormatter(formatter) |
|
562 | ch.setFormatter(formatter) | |
@@ -582,7 +597,6 b' def create_test_env(repos_test_path, con' | |||||
582 | #============================================================================== |
|
597 | #============================================================================== | |
583 | # PASTER COMMANDS |
|
598 | # PASTER COMMANDS | |
584 | #============================================================================== |
|
599 | #============================================================================== | |
585 |
|
||||
586 | class BasePasterCommand(Command): |
|
600 | class BasePasterCommand(Command): | |
587 | """ |
|
601 | """ | |
588 | Abstract Base Class for paster commands. |
|
602 | Abstract Base Class for paster commands. | |
@@ -609,7 +623,6 b' class BasePasterCommand(Command):' | |||||
609 | if log and isinstance(log, logging): |
|
623 | if log and isinstance(log, logging): | |
610 | log(msg) |
|
624 | log(msg) | |
611 |
|
625 | |||
612 |
|
||||
613 | def run(self, args): |
|
626 | def run(self, args): | |
614 | """ |
|
627 | """ | |
615 | Overrides Command.run |
|
628 | Overrides Command.run |
@@ -1,6 +1,6 b'' | |||||
1 | ################################################################################ |
|
1 | ################################################################################ | |
2 | ################################################################################ |
|
2 | ################################################################################ | |
3 |
# |
|
3 | # RhodeCode - Pylons environment configuration # | |
4 | # # |
|
4 | # # | |
5 | # The %(here)s variable will be replaced with the parent directory of this file# |
|
5 | # The %(here)s variable will be replaced with the parent directory of this file# | |
6 | ################################################################################ |
|
6 | ################################################################################ | |
@@ -10,7 +10,7 b' debug = true' | |||||
10 | ################################################################################ |
|
10 | ################################################################################ | |
11 | ## Uncomment and replace with the address which should receive ## |
|
11 | ## Uncomment and replace with the address which should receive ## | |
12 | ## any error reports after application crash ## |
|
12 | ## any error reports after application crash ## | |
13 |
## Additionally those settings will be used by |
|
13 | ## Additionally those settings will be used by RhodeCode mailing system ## | |
14 | ################################################################################ |
|
14 | ################################################################################ | |
15 | #email_to = admin@localhost |
|
15 | #email_to = admin@localhost | |
16 | #error_email_from = paste_error@localhost |
|
16 | #error_email_from = paste_error@localhost | |
@@ -42,7 +42,7 b' use = egg:rhodecode' | |||||
42 | full_stack = true |
|
42 | full_stack = true | |
43 | static_files = true |
|
43 | static_files = true | |
44 | lang=en |
|
44 | lang=en | |
45 |
cache_dir = |
|
45 | cache_dir = /tmp/data | |
46 | index_dir = /tmp/index |
|
46 | index_dir = /tmp/index | |
47 | cut_off_limit = 256000 |
|
47 | cut_off_limit = 256000 | |
48 | force_https = false |
|
48 | force_https = false | |
@@ -69,7 +69,7 b' celery.result.serialier = json' | |||||
69 | celeryd.concurrency = 2 |
|
69 | celeryd.concurrency = 2 | |
70 | #celeryd.log.file = celeryd.log |
|
70 | #celeryd.log.file = celeryd.log | |
71 | celeryd.log.level = debug |
|
71 | celeryd.log.level = debug | |
72 |
celeryd.max.tasks.per.child = |
|
72 | celeryd.max.tasks.per.child = 1 | |
73 |
|
73 | |||
74 | #tasks will never be sent to the queue, but executed locally instead. |
|
74 | #tasks will never be sent to the queue, but executed locally instead. | |
75 | celery.always.eager = false |
|
75 | celery.always.eager = false | |
@@ -77,8 +77,8 b' celery.always.eager = false' | |||||
77 | #################################### |
|
77 | #################################### | |
78 | ### BEAKER CACHE #### |
|
78 | ### BEAKER CACHE #### | |
79 | #################################### |
|
79 | #################################### | |
80 |
beaker.cache.data_dir=/ |
|
80 | beaker.cache.data_dir=/tmp/data/cache/data | |
81 |
beaker.cache.lock_dir=/ |
|
81 | beaker.cache.lock_dir=/tmp/data/cache/lock | |
82 | beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long |
|
82 | beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long | |
83 |
|
83 | |||
84 | beaker.cache.super_short_term.type=memory |
|
84 | beaker.cache.super_short_term.type=memory | |
@@ -147,7 +147,7 b' sqlalchemy.convert_unicode = true' | |||||
147 | ### LOGGING CONFIGURATION #### |
|
147 | ### LOGGING CONFIGURATION #### | |
148 | ################################ |
|
148 | ################################ | |
149 | [loggers] |
|
149 | [loggers] | |
150 | keys = root, routes, rhodecode, sqlalchemy |
|
150 | keys = root, routes, rhodecode, sqlalchemy,beaker,templates | |
151 |
|
151 | |||
152 | [handlers] |
|
152 | [handlers] | |
153 | keys = console |
|
153 | keys = console |
General Comments 0
You need to be logged in to leave comments.
Login now