Show More
@@ -45,6 +45,7 b' static_files = true' | |||
|
45 | 45 | lang=en |
|
46 | 46 | cache_dir = %(here)s/data |
|
47 | 47 | index_dir = %(here)s/data/index |
|
48 | cut_off_limit = 256000 | |
|
48 | 49 | |
|
49 | 50 | #################################### |
|
50 | 51 | ### CELERY CONFIG #### |
@@ -45,6 +45,7 b' static_files = false' | |||
|
45 | 45 | lang=en |
|
46 | 46 | cache_dir = %(here)s/data |
|
47 | 47 | index_dir = %(here)s/data/index |
|
48 | cut_off_limit = 256000 | |
|
48 | 49 | |
|
49 | 50 | #################################### |
|
50 | 51 | ### CELERY CONFIG #### |
@@ -46,6 +46,7 b' lang=en' | |||
|
46 | 46 | cache_dir = %(here)s/data |
|
47 | 47 | index_dir = %(here)s/data/index |
|
48 | 48 | app_instance_uuid = ${app_instance_uuid} |
|
49 | cut_off_limit = 256000 | |
|
49 | 50 | |
|
50 | 51 | #################################### |
|
51 | 52 | ### CELERY CONFIG #### |
@@ -1,7 +1,15 b'' | |||
|
1 | #!/usr/bin/env python | |
|
2 | # encoding: utf-8 | |
|
3 | # changeset controller for pylons | |
|
4 | # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> | |
|
1 | # -*- coding: utf-8 -*- | |
|
2 | """ | |
|
3 | rhodecode.controllers.changeset | |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
|
5 | ||
|
6 | changeset controller for pylons | |
|
7 | ||
|
8 | :created_on: Apr 25, 2010 | |
|
9 | :author: marcink | |
|
10 | :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> | |
|
11 | :license: GPLv3, see COPYING for more details. | |
|
12 | """ | |
|
5 | 13 | # This program is free software; you can redistribute it and/or |
|
6 | 14 | # modify it under the terms of the GNU General Public License |
|
7 | 15 | # as published by the Free Software Foundation; version 2 |
@@ -16,24 +24,22 b'' | |||
|
16 | 24 | # along with this program; if not, write to the Free Software |
|
17 | 25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 | 26 | # MA 02110-1301, USA. |
|
19 | """ | |
|
20 | Created on April 25, 2010 | |
|
21 | changeset controller for pylons | |
|
22 | @author: marcink | |
|
23 | """ | |
|
27 | import logging | |
|
28 | import traceback | |
|
29 | ||
|
24 | 30 | from pylons import tmpl_context as c, url, request, response |
|
25 | 31 | from pylons.i18n.translation import _ |
|
26 | 32 | from pylons.controllers.util import redirect |
|
33 | ||
|
34 | import rhodecode.lib.helpers as h | |
|
27 | 35 | from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator |
|
28 | 36 | from rhodecode.lib.base import BaseController, render |
|
29 | 37 | from rhodecode.lib.utils import EmptyChangeset |
|
30 | import rhodecode.lib.helpers as h | |
|
31 | 38 | from rhodecode.model.scm import ScmModel |
|
39 | ||
|
32 | 40 | from vcs.exceptions import RepositoryError, ChangesetError |
|
33 | 41 | from vcs.nodes import FileNode |
|
34 | 42 | from vcs.utils import diffs as differ |
|
35 | import logging | |
|
36 | import traceback | |
|
37 | 43 | |
|
38 | 44 | log = logging.getLogger(__name__) |
|
39 | 45 | |
@@ -47,7 +53,6 b' class ChangesetController(BaseController' | |||
|
47 | 53 | |
|
48 | 54 | def index(self, revision): |
|
49 | 55 | hg_model = ScmModel() |
|
50 | cut_off_limit = 1024 * 250 | |
|
51 | 56 | |
|
52 | 57 | def wrap_to_table(str): |
|
53 | 58 | |
@@ -82,7 +87,7 b' class ChangesetController(BaseController' | |||
|
82 | 87 | diff = wrap_to_table(_('binary file')) |
|
83 | 88 | else: |
|
84 | 89 | c.sum_added += node.size |
|
85 | if c.sum_added < cut_off_limit: | |
|
90 | if c.sum_added < self.cut_off_limit: | |
|
86 | 91 | f_udiff = differ.get_udiff(filenode_old, node) |
|
87 | 92 | diff = differ.DiffProcessor(f_udiff).as_html() |
|
88 | 93 | |
@@ -108,7 +113,7 b' class ChangesetController(BaseController' | |||
|
108 | 113 | diff = wrap_to_table(_('binary file')) |
|
109 | 114 | else: |
|
110 | 115 | |
|
111 | if c.sum_removed < cut_off_limit: | |
|
116 | if c.sum_removed < self.cut_off_limit: | |
|
112 | 117 | f_udiff = differ.get_udiff(filenode_old, node) |
|
113 | 118 | diff = differ.DiffProcessor(f_udiff).as_html() |
|
114 | 119 | if diff: |
@@ -1,8 +1,15 b'' | |||
|
1 | #!/usr/bin/env python | |
|
2 | # encoding: utf-8 | |
|
3 | # files controller for pylons | |
|
4 | # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> | |
|
1 | # -*- coding: utf-8 -*- | |
|
2 | """ | |
|
3 | rhodecode.controllers.files | |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
|
5 | 5 |
|
|
6 | Files controller for RhodeCode | |
|
7 | ||
|
8 | :created_on: Apr 21, 2010 | |
|
9 | :author: marcink | |
|
10 | :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> | |
|
11 | :license: GPLv3, see COPYING for more details. | |
|
12 | """ | |
|
6 | 13 | # This program is free software; you can redistribute it and/or |
|
7 | 14 | # modify it under the terms of the GNU General Public License |
|
8 | 15 | # as published by the Free Software Foundation; version 2 |
@@ -17,25 +24,24 b'' | |||
|
17 | 24 | # along with this program; if not, write to the Free Software |
|
18 | 25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 | 26 | # MA 02110-1301, USA. |
|
20 | """ | |
|
21 | Created on April 21, 2010 | |
|
22 | files controller for pylons | |
|
23 | @author: marcink | |
|
24 | """ | |
|
27 | import tempfile | |
|
28 | import logging | |
|
29 | import rhodecode.lib.helpers as h | |
|
30 | ||
|
25 | 31 | from mercurial import archival |
|
32 | ||
|
26 | 33 | from pylons import request, response, session, tmpl_context as c, url |
|
27 | 34 | from pylons.i18n.translation import _ |
|
28 | 35 | from pylons.controllers.util import redirect |
|
36 | ||
|
29 | 37 | from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator |
|
30 | 38 | from rhodecode.lib.base import BaseController, render |
|
31 | 39 | from rhodecode.lib.utils import EmptyChangeset |
|
32 | 40 | from rhodecode.model.scm import ScmModel |
|
41 | ||
|
33 | 42 | from vcs.exceptions import RepositoryError, ChangesetError |
|
34 | 43 | from vcs.nodes import FileNode |
|
35 | 44 | from vcs.utils import diffs as differ |
|
36 | import logging | |
|
37 | import rhodecode.lib.helpers as h | |
|
38 | import tempfile | |
|
39 | 45 | |
|
40 | 46 | log = logging.getLogger(__name__) |
|
41 | 47 | |
@@ -46,7 +52,6 b' class FilesController(BaseController):' | |||
|
46 | 52 | 'repository.admin') |
|
47 | 53 | def __before__(self): |
|
48 | 54 | super(FilesController, self).__before__() |
|
49 | c.file_size_limit = 250 * 1024 #limit of file size to display | |
|
50 | 55 | |
|
51 | 56 | def index(self, repo_name, revision, f_path): |
|
52 | 57 | hg_model = ScmModel() |
@@ -197,13 +202,13 b' class FilesController(BaseController):' | |||
|
197 | 202 | return diff.raw_diff() |
|
198 | 203 | |
|
199 | 204 | elif c.action == 'diff': |
|
200 |
if node1.size > |
|
|
205 | if node1.size > self.cut_off_limit or node2.size > self.cut_off_limit: | |
|
201 | 206 | c.cur_diff = _('Diff is to big to display') |
|
202 | 207 | else: |
|
203 | 208 | c.cur_diff = diff.as_html() |
|
204 | 209 | else: |
|
205 | 210 | #default option |
|
206 |
if node1.size > |
|
|
211 | if node1.size > self.cut_off_limit or node2.size > self.cut_off_limit: | |
|
207 | 212 | c.cur_diff = _('Diff is to big to display') |
|
208 | 213 | else: |
|
209 | 214 | c.cur_diff = diff.as_html() |
@@ -20,7 +20,7 b' class BaseController(WSGIController):' | |||
|
20 | 20 | c.repo_name = get_repo_slug(request) |
|
21 | 21 | c.cached_repo_list = ScmModel().get_repos() |
|
22 | 22 | c.backends = BACKENDS.keys() |
|
23 | ||
|
23 | self.cut_off_limit = int(config['cut_off_limit']) | |
|
24 | 24 | self.sa = meta.Session() |
|
25 | 25 | scm_model = ScmModel(self.sa) |
|
26 | 26 | #c.unread_journal = scm_model.get_unread_journal() |
General Comments 0
You need to be logged in to leave comments.
Login now