Mercurial > kallithea
comparison rhodecode/controllers/files.py @ 1232:0dc8d578ff49
merges for stable
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sat, 09 Apr 2011 18:38:18 +0200 |
parents | 3d9da7893fdb |
children | 438524e84c57 |
comparison
equal
deleted
inserted
replaced
1231:9f6560667743 | 1232:0dc8d578ff49 |
---|---|
5 | 5 |
6 Files controller for RhodeCode | 6 Files controller for RhodeCode |
7 | 7 |
8 :created_on: Apr 21, 2010 | 8 :created_on: Apr 21, 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 |
14 # it under the terms of the GNU General Public License as published by | 14 # it under the terms of the GNU General Public License as published by |
15 # the Free Software Foundation, either version 3 of the License, or | 15 # the Free Software Foundation, either version 3 of the License, or |
43 from vcs.nodes import FileNode | 43 from vcs.nodes import FileNode |
44 from vcs.utils import diffs as differ | 44 from vcs.utils import diffs as differ |
45 | 45 |
46 log = logging.getLogger(__name__) | 46 log = logging.getLogger(__name__) |
47 | 47 |
48 | |
48 class FilesController(BaseController): | 49 class FilesController(BaseController): |
49 | 50 |
50 @LoginRequired() | 51 @LoginRequired() |
51 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', | 52 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', |
52 'repository.admin') | 53 'repository.admin') |
56 | 57 |
57 def __get_cs_or_redirect(self, rev, repo_name): | 58 def __get_cs_or_redirect(self, rev, repo_name): |
58 """ | 59 """ |
59 Safe way to get changeset if error occur it redirects to tip with | 60 Safe way to get changeset if error occur it redirects to tip with |
60 proper message | 61 proper message |
61 | 62 |
62 :param rev: revision to fetch | 63 :param rev: revision to fetch |
63 :param repo_name: repo name to redirect after | 64 :param repo_name: repo name to redirect after |
64 """ | 65 """ |
65 | 66 |
66 _repo = ScmModel().get_repo(c.repo_name) | 67 _repo = ScmModel().get_repo(c.repo_name) |
226 if node1.is_binary or node2.is_binary: | 227 if node1.is_binary or node2.is_binary: |
227 return _('binary file changed') | 228 return _('binary file changed') |
228 return diff.raw_diff() | 229 return diff.raw_diff() |
229 | 230 |
230 elif c.action == 'diff': | 231 elif c.action == 'diff': |
231 if node1.size > self.cut_off_limit or node2.size > self.cut_off_limit: | 232 if node1.is_binary or node2.is_binary: |
232 c.cur_diff = _('Diff is to big to display') | |
233 elif node1.is_binary or node2.is_binary: | |
234 c.cur_diff = _('Binary file') | 233 c.cur_diff = _('Binary file') |
234 elif node1.size > self.cut_off_limit or \ | |
235 node2.size > self.cut_off_limit: | |
236 c.cur_diff = _('Diff is too big to display') | |
235 else: | 237 else: |
236 c.cur_diff = diff.as_html() | 238 c.cur_diff = diff.as_html() |
237 else: | 239 else: |
238 #default option | 240 #default option |
239 if node1.size > self.cut_off_limit or node2.size > self.cut_off_limit: | 241 if node1.size > self.cut_off_limit or node2.size > self.cut_off_limit: |