Mercurial > kallithea
annotate rhodecode/controllers/files.py @ 1103:918c0b600a06 beta
changelog update, bumped mako version in setup
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sun, 27 Feb 2011 03:31:01 +0100 |
parents | 8d0858376163 |
children | ce4287e3e3c9 |
rev | line source |
---|---|
812
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
1 # -*- coding: utf-8 -*- |
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
2 """ |
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
3 rhodecode.controllers.files |
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
318
fdf9f6ee5217
Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
275
diff
changeset
|
5 |
812
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
6 Files controller for RhodeCode |
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
7 |
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
8 :created_on: Apr 21, 2010 |
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
9 :author: marcink |
902
07a6e8c65526
fixed copyright year to 2011
Marcin Kuzminski <marcin@python-works.com>
parents:
899
diff
changeset
|
10 :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
812
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
11 :license: GPLv3, see COPYING for more details. |
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
12 """ |
252
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
13 # This program is free software; you can redistribute it and/or |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
14 # modify it under the terms of the GNU General Public License |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
15 # as published by the Free Software Foundation; version 2 |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
16 # of the License or (at your opinion) any later version of the license. |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
17 # |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
18 # This program is distributed in the hope that it will be useful, |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
21 # GNU General Public License for more details. |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
22 # |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
23 # You should have received a copy of the GNU General Public License |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
24 # along with this program; if not, write to the Free Software |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
25 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
26 # MA 02110-1301, USA. |
812
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
27 import logging |
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
28 import rhodecode.lib.helpers as h |
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
29 |
318
fdf9f6ee5217
Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
275
diff
changeset
|
30 from pylons import request, response, session, tmpl_context as c, url |
544
d8778cde98f0
added limits to single file diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
31 from pylons.i18n.translation import _ |
318
fdf9f6ee5217
Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
275
diff
changeset
|
32 from pylons.controllers.util import redirect |
812
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
33 |
547
1e757ac98988
renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
544
diff
changeset
|
34 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
35 from rhodecode.lib.base import BaseRepoController, render |
547
1e757ac98988
renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
544
diff
changeset
|
36 from rhodecode.lib.utils import EmptyChangeset |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
37 from rhodecode.model.repo import RepoModel |
812
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
38 |
948
85ee0ea183e7
fixed archival in rhodecode to use new functions from vcs
Marcin Kuzminski <marcin@python-works.com>
parents:
945
diff
changeset
|
39 from vcs.backends import ARCHIVE_SPECS |
915
35e701dc801e
fixed #96 redirect loop on files
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
40 from vcs.exceptions import RepositoryError, ChangesetError, \ |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
41 ChangesetDoesNotExistError, EmptyRepositoryError, ImproperArchiveTypeError, \ |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
42 VCSError |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
43 from vcs.nodes import FileNode, NodeKind |
318
fdf9f6ee5217
Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
275
diff
changeset
|
44 from vcs.utils import diffs as differ |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
45 |
93
aec4c0071cb3
added empty controllers for branches tags files graph, routing and test for them
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
46 log = logging.getLogger(__name__) |
aec4c0071cb3
added empty controllers for branches tags files graph, routing and test for them
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
47 |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
48 class FilesController(BaseRepoController): |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
49 |
191
b68b2246e5a6
Authenticated controller with LoginRequired decorator, and cleaned __before__ (used in baseController now). fixed User for clone url with logged in session user.
Marcin Kuzminski <marcin@python-works.com>
parents:
160
diff
changeset
|
50 @LoginRequired() |
318
fdf9f6ee5217
Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
275
diff
changeset
|
51 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
52 'repository.admin') |
99
5b57295601b6
Updated basic files browser with, pygments
Marcin Kuzminski <marcin@python-works.com>
parents:
93
diff
changeset
|
53 def __before__(self): |
191
b68b2246e5a6
Authenticated controller with LoginRequired decorator, and cleaned __before__ (used in baseController now). fixed User for clone url with logged in session user.
Marcin Kuzminski <marcin@python-works.com>
parents:
160
diff
changeset
|
54 super(FilesController, self).__before__() |
813
e8b5be26fb78
fixed small issue made on latest patches
Marcin Kuzminski <marcin@python-works.com>
parents:
812
diff
changeset
|
55 c.cut_off_limit = self.cut_off_limit |
93
aec4c0071cb3
added empty controllers for branches tags files graph, routing and test for them
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
56 |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
57 def __get_cs(self, rev, repo_name): |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
58 """ |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
59 Safe way to get changeset if error ucure it redirects to given |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
60 :param rev: revision to fetch |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
61 :param repo_name: repo name to redirect after |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
62 """ |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
63 |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
64 try: |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
65 return c.rhodecode_repo.get_changeset(rev) |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
66 except EmptyRepositoryError, e: |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
67 h.flash(_('There are no files yet'), category='warning') |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
68 redirect(h.url('summary_home', repo_name=repo_name)) |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
69 |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
70 except RepositoryError, e: |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
71 h.flash(str(e), category='warning') |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
72 redirect(h.url('files_home', repo_name=repo_name, revision='tip')) |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
73 |
99
5b57295601b6
Updated basic files browser with, pygments
Marcin Kuzminski <marcin@python-works.com>
parents:
93
diff
changeset
|
74 def index(self, repo_name, revision, f_path): |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
75 |
138
5f42d751c719
fixed files when repository is empty
Marcin Kuzminski <marcin@python-works.com>
parents:
131
diff
changeset
|
76 try: |
884
322b53be49cc
Fixed url bug when using numeric revision in file browser,
Marcin Kuzminski <marcin@python-works.com>
parents:
883
diff
changeset
|
77 #reditect to given revision from form |
322b53be49cc
Fixed url bug when using numeric revision in file browser,
Marcin Kuzminski <marcin@python-works.com>
parents:
883
diff
changeset
|
78 post_revision = request.POST.get('at_rev', None) |
322b53be49cc
Fixed url bug when using numeric revision in file browser,
Marcin Kuzminski <marcin@python-works.com>
parents:
883
diff
changeset
|
79 if post_revision: |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
80 post_revision = c.rhodecode_repo.get_changeset(post_revision).raw_id |
884
322b53be49cc
Fixed url bug when using numeric revision in file browser,
Marcin Kuzminski <marcin@python-works.com>
parents:
883
diff
changeset
|
81 redirect(url('files_home', repo_name=c.repo_name, |
322b53be49cc
Fixed url bug when using numeric revision in file browser,
Marcin Kuzminski <marcin@python-works.com>
parents:
883
diff
changeset
|
82 revision=post_revision, f_path=f_path)) |
322b53be49cc
Fixed url bug when using numeric revision in file browser,
Marcin Kuzminski <marcin@python-works.com>
parents:
883
diff
changeset
|
83 |
322b53be49cc
Fixed url bug when using numeric revision in file browser,
Marcin Kuzminski <marcin@python-works.com>
parents:
883
diff
changeset
|
84 c.branch = request.GET.get('branch', None) |
322b53be49cc
Fixed url bug when using numeric revision in file browser,
Marcin Kuzminski <marcin@python-works.com>
parents:
883
diff
changeset
|
85 |
322b53be49cc
Fixed url bug when using numeric revision in file browser,
Marcin Kuzminski <marcin@python-works.com>
parents:
883
diff
changeset
|
86 c.f_path = f_path |
322b53be49cc
Fixed url bug when using numeric revision in file browser,
Marcin Kuzminski <marcin@python-works.com>
parents:
883
diff
changeset
|
87 |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
88 c.changeset = c.rhodecode_repo.get_changeset(revision) |
644
c8bd0e6cc3da
some changes for #45.
Marcin Kuzminski <marcin@python-works.com>
parents:
636
diff
changeset
|
89 cur_rev = c.changeset.revision |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
90 |
884
322b53be49cc
Fixed url bug when using numeric revision in file browser,
Marcin Kuzminski <marcin@python-works.com>
parents:
883
diff
changeset
|
91 #prev link |
883
20ed6f6a6329
Changed prev/next in file browser to new vcs methods
Marcin Kuzminski <marcin@python-works.com>
parents:
872
diff
changeset
|
92 try: |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
93 prev_rev = c.rhodecode_repo.get_changeset(cur_rev).prev(c.branch).raw_id |
883
20ed6f6a6329
Changed prev/next in file browser to new vcs methods
Marcin Kuzminski <marcin@python-works.com>
parents:
872
diff
changeset
|
94 c.url_prev = url('files_home', repo_name=c.repo_name, |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
95 revision=prev_rev, f_path=f_path) |
884
322b53be49cc
Fixed url bug when using numeric revision in file browser,
Marcin Kuzminski <marcin@python-works.com>
parents:
883
diff
changeset
|
96 if c.branch: |
322b53be49cc
Fixed url bug when using numeric revision in file browser,
Marcin Kuzminski <marcin@python-works.com>
parents:
883
diff
changeset
|
97 c.url_prev += '?branch=%s' % c.branch |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
98 except (ChangesetDoesNotExistError, VCSError): |
883
20ed6f6a6329
Changed prev/next in file browser to new vcs methods
Marcin Kuzminski <marcin@python-works.com>
parents:
872
diff
changeset
|
99 c.url_prev = '#' |
20ed6f6a6329
Changed prev/next in file browser to new vcs methods
Marcin Kuzminski <marcin@python-works.com>
parents:
872
diff
changeset
|
100 |
884
322b53be49cc
Fixed url bug when using numeric revision in file browser,
Marcin Kuzminski <marcin@python-works.com>
parents:
883
diff
changeset
|
101 #next link |
883
20ed6f6a6329
Changed prev/next in file browser to new vcs methods
Marcin Kuzminski <marcin@python-works.com>
parents:
872
diff
changeset
|
102 try: |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
103 next_rev = c.rhodecode_repo.get_changeset(cur_rev).next(c.branch).raw_id |
883
20ed6f6a6329
Changed prev/next in file browser to new vcs methods
Marcin Kuzminski <marcin@python-works.com>
parents:
872
diff
changeset
|
104 c.url_next = url('files_home', repo_name=c.repo_name, |
644
c8bd0e6cc3da
some changes for #45.
Marcin Kuzminski <marcin@python-works.com>
parents:
636
diff
changeset
|
105 revision=next_rev, f_path=f_path) |
884
322b53be49cc
Fixed url bug when using numeric revision in file browser,
Marcin Kuzminski <marcin@python-works.com>
parents:
883
diff
changeset
|
106 if c.branch: |
322b53be49cc
Fixed url bug when using numeric revision in file browser,
Marcin Kuzminski <marcin@python-works.com>
parents:
883
diff
changeset
|
107 c.url_next += '?branch=%s' % c.branch |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
108 except (ChangesetDoesNotExistError, VCSError): |
883
20ed6f6a6329
Changed prev/next in file browser to new vcs methods
Marcin Kuzminski <marcin@python-works.com>
parents:
872
diff
changeset
|
109 c.url_next = '#' |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
110 |
884
322b53be49cc
Fixed url bug when using numeric revision in file browser,
Marcin Kuzminski <marcin@python-works.com>
parents:
883
diff
changeset
|
111 #files |
644
c8bd0e6cc3da
some changes for #45.
Marcin Kuzminski <marcin@python-works.com>
parents:
636
diff
changeset
|
112 try: |
c8bd0e6cc3da
some changes for #45.
Marcin Kuzminski <marcin@python-works.com>
parents:
636
diff
changeset
|
113 c.files_list = c.changeset.get_node(f_path) |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
114 c.file_history = self._get_history(c.rhodecode_repo, c.files_list, f_path) |
644
c8bd0e6cc3da
some changes for #45.
Marcin Kuzminski <marcin@python-works.com>
parents:
636
diff
changeset
|
115 except RepositoryError, e: |
c8bd0e6cc3da
some changes for #45.
Marcin Kuzminski <marcin@python-works.com>
parents:
636
diff
changeset
|
116 h.flash(str(e), category='warning') |
c8bd0e6cc3da
some changes for #45.
Marcin Kuzminski <marcin@python-works.com>
parents:
636
diff
changeset
|
117 redirect(h.url('files_home', repo_name=repo_name, revision=revision)) |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
118 |
915
35e701dc801e
fixed #96 redirect loop on files
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
119 except EmptyRepositoryError, e: |
35e701dc801e
fixed #96 redirect loop on files
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
120 h.flash(_('There are no files yet'), category='warning') |
35e701dc801e
fixed #96 redirect loop on files
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
121 redirect(h.url('summary_home', repo_name=repo_name)) |
35e701dc801e
fixed #96 redirect loop on files
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
122 |
644
c8bd0e6cc3da
some changes for #45.
Marcin Kuzminski <marcin@python-works.com>
parents:
636
diff
changeset
|
123 except RepositoryError, e: |
c8bd0e6cc3da
some changes for #45.
Marcin Kuzminski <marcin@python-works.com>
parents:
636
diff
changeset
|
124 h.flash(str(e), category='warning') |
c8bd0e6cc3da
some changes for #45.
Marcin Kuzminski <marcin@python-works.com>
parents:
636
diff
changeset
|
125 redirect(h.url('files_home', repo_name=repo_name, revision='tip')) |
c8bd0e6cc3da
some changes for #45.
Marcin Kuzminski <marcin@python-works.com>
parents:
636
diff
changeset
|
126 |
c8bd0e6cc3da
some changes for #45.
Marcin Kuzminski <marcin@python-works.com>
parents:
636
diff
changeset
|
127 |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
128 |
128
9deb6f1d5b90
Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
106
diff
changeset
|
129 return render('files/files.html') |
9deb6f1d5b90
Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
106
diff
changeset
|
130 |
147
873fd2dc62c2
Added rawfile support, and few fixes for file
Marcin Kuzminski <marcin@python-works.com>
parents:
145
diff
changeset
|
131 def rawfile(self, repo_name, revision, f_path): |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
132 cs = self.__get_cs(revision, repo_name) |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
133 try: |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
134 file_node = cs.get_node(f_path) |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
135 except RepositoryError, e: |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
136 h.flash(str(e), category='warning') |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
137 redirect(h.url('files_home', repo_name=repo_name, revision=cs.raw_id)) |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
138 |
1102
8d0858376163
fixed problem with rawfile content_disposition attachment,
Marcin Kuzminski <marcin@python-works.com>
parents:
1045
diff
changeset
|
139 fname = f_path.split('/')[-1].encode('utf8', 'replace') |
160
0f7f93df5802
implemented rawdiff and diff download into diff view.
Marcin Kuzminski <marcin@python-works.com>
parents:
158
diff
changeset
|
140 response.content_type = file_node.mimetype |
1102
8d0858376163
fixed problem with rawfile content_disposition attachment,
Marcin Kuzminski <marcin@python-works.com>
parents:
1045
diff
changeset
|
141 response.content_disposition = 'attachment; filename=%s' % fname |
147
873fd2dc62c2
Added rawfile support, and few fixes for file
Marcin Kuzminski <marcin@python-works.com>
parents:
145
diff
changeset
|
142 return file_node.content |
485
9836541b0509
added limit for showing pygemntized source codes larger than 250kb.
Marcin Kuzminski <marcin@python-works.com>
parents:
438
diff
changeset
|
143 |
9836541b0509
added limit for showing pygemntized source codes larger than 250kb.
Marcin Kuzminski <marcin@python-works.com>
parents:
438
diff
changeset
|
144 def raw(self, repo_name, revision, f_path): |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
145 cs = self.__get_cs(revision, repo_name) |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
146 try: |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
147 file_node = cs.get_node(f_path) |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
148 except RepositoryError, e: |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
149 h.flash(str(e), category='warning') |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
150 redirect(h.url('files_home', repo_name=repo_name, revision=cs.raw_id)) |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
151 |
485
9836541b0509
added limit for showing pygemntized source codes larger than 250kb.
Marcin Kuzminski <marcin@python-works.com>
parents:
438
diff
changeset
|
152 response.content_type = 'text/plain' |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
153 |
485
9836541b0509
added limit for showing pygemntized source codes larger than 250kb.
Marcin Kuzminski <marcin@python-works.com>
parents:
438
diff
changeset
|
154 return file_node.content |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
155 |
191
b68b2246e5a6
Authenticated controller with LoginRequired decorator, and cleaned __before__ (used in baseController now). fixed User for clone url with logged in session user.
Marcin Kuzminski <marcin@python-works.com>
parents:
160
diff
changeset
|
156 def annotate(self, repo_name, revision, f_path): |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
157 cs = self.__get_cs(revision, repo_name) |
774
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
158 try: |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
159 c.file = cs.get_node(f_path) |
774
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
160 except RepositoryError, e: |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
161 h.flash(str(e), category='warning') |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
162 redirect(h.url('files_home', repo_name=repo_name, revision=cs.raw_id)) |
774
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
163 |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
164 c.file_history = self._get_history(c.rhodecode_repo, c.file, f_path) |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
165 c.cs = cs |
191
b68b2246e5a6
Authenticated controller with LoginRequired decorator, and cleaned __before__ (used in baseController now). fixed User for clone url with logged in session user.
Marcin Kuzminski <marcin@python-works.com>
parents:
160
diff
changeset
|
166 c.f_path = f_path |
335
588c6147efc7
removed unneded value
Marcin Kuzminski <marcin@python-works.com>
parents:
318
diff
changeset
|
167 |
191
b68b2246e5a6
Authenticated controller with LoginRequired decorator, and cleaned __before__ (used in baseController now). fixed User for clone url with logged in session user.
Marcin Kuzminski <marcin@python-works.com>
parents:
160
diff
changeset
|
168 return render('files/files_annotate.html') |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
169 |
872
b956e6f415a2
implemented #91,
Marcin Kuzminski <marcin@python-works.com>
parents:
813
diff
changeset
|
170 def archivefile(self, repo_name, fname): |
945
05b59c48556f
fixed error when trying to make download on empty repository
Marcin Kuzminski <marcin@python-works.com>
parents:
942
diff
changeset
|
171 |
942
32318ec7bfc1
added branch/tag options to download links in summary
Marcin Kuzminski <marcin@python-works.com>
parents:
915
diff
changeset
|
172 fileformat = None |
32318ec7bfc1
added branch/tag options to download links in summary
Marcin Kuzminski <marcin@python-works.com>
parents:
915
diff
changeset
|
173 revision = None |
948
85ee0ea183e7
fixed archival in rhodecode to use new functions from vcs
Marcin Kuzminski <marcin@python-works.com>
parents:
945
diff
changeset
|
174 ext = None |
945
05b59c48556f
fixed error when trying to make download on empty repository
Marcin Kuzminski <marcin@python-works.com>
parents:
942
diff
changeset
|
175 |
948
85ee0ea183e7
fixed archival in rhodecode to use new functions from vcs
Marcin Kuzminski <marcin@python-works.com>
parents:
945
diff
changeset
|
176 for a_type, ext_data in ARCHIVE_SPECS.items(): |
85ee0ea183e7
fixed archival in rhodecode to use new functions from vcs
Marcin Kuzminski <marcin@python-works.com>
parents:
945
diff
changeset
|
177 archive_spec = fname.split(ext_data[1]) |
85ee0ea183e7
fixed archival in rhodecode to use new functions from vcs
Marcin Kuzminski <marcin@python-works.com>
parents:
945
diff
changeset
|
178 if len(archive_spec) == 2 and archive_spec[1] == '': |
85ee0ea183e7
fixed archival in rhodecode to use new functions from vcs
Marcin Kuzminski <marcin@python-works.com>
parents:
945
diff
changeset
|
179 fileformat = a_type or ext_data[1] |
942
32318ec7bfc1
added branch/tag options to download links in summary
Marcin Kuzminski <marcin@python-works.com>
parents:
915
diff
changeset
|
180 revision = archive_spec[0] |
948
85ee0ea183e7
fixed archival in rhodecode to use new functions from vcs
Marcin Kuzminski <marcin@python-works.com>
parents:
945
diff
changeset
|
181 ext = ext_data[1] |
872
b956e6f415a2
implemented #91,
Marcin Kuzminski <marcin@python-works.com>
parents:
813
diff
changeset
|
182 |
b956e6f415a2
implemented #91,
Marcin Kuzminski <marcin@python-works.com>
parents:
813
diff
changeset
|
183 try: |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
184 dbrepo = RepoModel().get_by_repo_name(repo_name) |
1038
5554aa9c2480
another major code rafactor, reimplemented (almost from scratch)
Marcin Kuzminski <marcin@python-works.com>
parents:
962
diff
changeset
|
185 if dbrepo.enable_downloads is False: |
962
72f008ed9b18
implemented #84 downloads can be enabled/disabled per each repository from now.
Marcin Kuzminski <marcin@python-works.com>
parents:
961
diff
changeset
|
186 return _('downloads disabled') |
72f008ed9b18
implemented #84 downloads can be enabled/disabled per each repository from now.
Marcin Kuzminski <marcin@python-works.com>
parents:
961
diff
changeset
|
187 |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
188 cs = c.rhodecode_repo.get_changeset(revision) |
950
343c28c33c19
fixed key error on unknown archival
Marcin Kuzminski <marcin@python-works.com>
parents:
948
diff
changeset
|
189 content_type = ARCHIVE_SPECS[fileformat][0] |
872
b956e6f415a2
implemented #91,
Marcin Kuzminski <marcin@python-works.com>
parents:
813
diff
changeset
|
190 except ChangesetDoesNotExistError: |
b956e6f415a2
implemented #91,
Marcin Kuzminski <marcin@python-works.com>
parents:
813
diff
changeset
|
191 return _('Unknown revision %s') % revision |
945
05b59c48556f
fixed error when trying to make download on empty repository
Marcin Kuzminski <marcin@python-works.com>
parents:
942
diff
changeset
|
192 except EmptyRepositoryError: |
05b59c48556f
fixed error when trying to make download on empty repository
Marcin Kuzminski <marcin@python-works.com>
parents:
942
diff
changeset
|
193 return _('Empty repository') |
961
840ca7492dbe
fixed typo in exception
Marcin Kuzminski <marcin@python-works.com>
parents:
953
diff
changeset
|
194 except (ImproperArchiveTypeError, KeyError): |
948
85ee0ea183e7
fixed archival in rhodecode to use new functions from vcs
Marcin Kuzminski <marcin@python-works.com>
parents:
945
diff
changeset
|
195 return _('Unknown archive type') |
872
b956e6f415a2
implemented #91,
Marcin Kuzminski <marcin@python-works.com>
parents:
813
diff
changeset
|
196 |
950
343c28c33c19
fixed key error on unknown archival
Marcin Kuzminski <marcin@python-works.com>
parents:
948
diff
changeset
|
197 response.content_type = content_type |
343c28c33c19
fixed key error on unknown archival
Marcin Kuzminski <marcin@python-works.com>
parents:
948
diff
changeset
|
198 response.content_disposition = 'attachment; filename=%s-%s%s' \ |
343c28c33c19
fixed key error on unknown archival
Marcin Kuzminski <marcin@python-works.com>
parents:
948
diff
changeset
|
199 % (repo_name, revision, ext) |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
200 |
948
85ee0ea183e7
fixed archival in rhodecode to use new functions from vcs
Marcin Kuzminski <marcin@python-works.com>
parents:
945
diff
changeset
|
201 return cs.get_chunked_archive(kind=fileformat) |
85ee0ea183e7
fixed archival in rhodecode to use new functions from vcs
Marcin Kuzminski <marcin@python-works.com>
parents:
945
diff
changeset
|
202 |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
203 |
129
42d46deb124d
implemented simple diffs for history of files.
Marcin Kuzminski <marcin@python-works.com>
parents:
128
diff
changeset
|
204 def diff(self, repo_name, f_path): |
42d46deb124d
implemented simple diffs for history of files.
Marcin Kuzminski <marcin@python-works.com>
parents:
128
diff
changeset
|
205 diff1 = request.GET.get('diff1') |
42d46deb124d
implemented simple diffs for history of files.
Marcin Kuzminski <marcin@python-works.com>
parents:
128
diff
changeset
|
206 diff2 = request.GET.get('diff2') |
337
fa3835d34fc1
fixed bug when diff command was different than available options
Marcin Kuzminski <marcin@python-works.com>
parents:
335
diff
changeset
|
207 c.action = request.GET.get('diff') |
131
49c7e191c2cd
Implemented mercurial style diff-lib
Marcin Kuzminski <marcin@python-works.com>
parents:
130
diff
changeset
|
208 c.no_changes = diff1 == diff2 |
129
42d46deb124d
implemented simple diffs for history of files.
Marcin Kuzminski <marcin@python-works.com>
parents:
128
diff
changeset
|
209 c.f_path = f_path |
152
0c00fbaff55a
Fixed differ to properly extract filenames, and dates from diff file. and swaped order of columns with lines nr in diff html
Marcin Kuzminski <marcin@python-works.com>
parents:
149
diff
changeset
|
210 |
275
2d61aa00e855
fixed bugs when putting empty or unknown changesets into diff
Marcin Kuzminski <marcin@python-works.com>
parents:
272
diff
changeset
|
211 try: |
544
d8778cde98f0
added limits to single file diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
212 if diff1 not in ['', None, 'None', '0' * 12, '0' * 40]: |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
213 c.changeset_1 = c.rhodecode_repo.get_changeset(diff1) |
275
2d61aa00e855
fixed bugs when putting empty or unknown changesets into diff
Marcin Kuzminski <marcin@python-works.com>
parents:
272
diff
changeset
|
214 node1 = c.changeset_1.get_node(f_path) |
2d61aa00e855
fixed bugs when putting empty or unknown changesets into diff
Marcin Kuzminski <marcin@python-works.com>
parents:
272
diff
changeset
|
215 else: |
2d61aa00e855
fixed bugs when putting empty or unknown changesets into diff
Marcin Kuzminski <marcin@python-works.com>
parents:
272
diff
changeset
|
216 c.changeset_1 = EmptyChangeset() |
544
d8778cde98f0
added limits to single file diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
217 node1 = FileNode('.', '', changeset=c.changeset_1) |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
218 |
544
d8778cde98f0
added limits to single file diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
219 if diff2 not in ['', None, 'None', '0' * 12, '0' * 40]: |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
220 c.changeset_2 = c.rhodecode_repo.get_changeset(diff2) |
275
2d61aa00e855
fixed bugs when putting empty or unknown changesets into diff
Marcin Kuzminski <marcin@python-works.com>
parents:
272
diff
changeset
|
221 node2 = c.changeset_2.get_node(f_path) |
2d61aa00e855
fixed bugs when putting empty or unknown changesets into diff
Marcin Kuzminski <marcin@python-works.com>
parents:
272
diff
changeset
|
222 else: |
2d61aa00e855
fixed bugs when putting empty or unknown changesets into diff
Marcin Kuzminski <marcin@python-works.com>
parents:
272
diff
changeset
|
223 c.changeset_2 = EmptyChangeset() |
544
d8778cde98f0
added limits to single file diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
224 node2 = FileNode('.', '', changeset=c.changeset_2) |
275
2d61aa00e855
fixed bugs when putting empty or unknown changesets into diff
Marcin Kuzminski <marcin@python-works.com>
parents:
272
diff
changeset
|
225 except RepositoryError: |
2d61aa00e855
fixed bugs when putting empty or unknown changesets into diff
Marcin Kuzminski <marcin@python-works.com>
parents:
272
diff
changeset
|
226 return redirect(url('files_home', |
2d61aa00e855
fixed bugs when putting empty or unknown changesets into diff
Marcin Kuzminski <marcin@python-works.com>
parents:
272
diff
changeset
|
227 repo_name=c.repo_name, f_path=f_path)) |
2d61aa00e855
fixed bugs when putting empty or unknown changesets into diff
Marcin Kuzminski <marcin@python-works.com>
parents:
272
diff
changeset
|
228 |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
229 |
337
fa3835d34fc1
fixed bug when diff command was different than available options
Marcin Kuzminski <marcin@python-works.com>
parents:
335
diff
changeset
|
230 if c.action == 'download': |
1044
f3402cb92fdf
changed raw and download diffs to gitdiff
Marcin Kuzminski <marcin@python-works.com>
parents:
1043
diff
changeset
|
231 diff = differ.DiffProcessor(differ.get_gitdiff(node1, node2)) |
f3402cb92fdf
changed raw and download diffs to gitdiff
Marcin Kuzminski <marcin@python-works.com>
parents:
1043
diff
changeset
|
232 |
160
0f7f93df5802
implemented rawdiff and diff download into diff view.
Marcin Kuzminski <marcin@python-works.com>
parents:
158
diff
changeset
|
233 diff_name = '%s_vs_%s.diff' % (diff1, diff2) |
0f7f93df5802
implemented rawdiff and diff download into diff view.
Marcin Kuzminski <marcin@python-works.com>
parents:
158
diff
changeset
|
234 response.content_type = 'text/plain' |
0f7f93df5802
implemented rawdiff and diff download into diff view.
Marcin Kuzminski <marcin@python-works.com>
parents:
158
diff
changeset
|
235 response.content_disposition = 'attachment; filename=%s' \ |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
236 % diff_name |
160
0f7f93df5802
implemented rawdiff and diff download into diff view.
Marcin Kuzminski <marcin@python-works.com>
parents:
158
diff
changeset
|
237 return diff.raw_diff() |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
238 |
337
fa3835d34fc1
fixed bug when diff command was different than available options
Marcin Kuzminski <marcin@python-works.com>
parents:
335
diff
changeset
|
239 elif c.action == 'raw': |
1044
f3402cb92fdf
changed raw and download diffs to gitdiff
Marcin Kuzminski <marcin@python-works.com>
parents:
1043
diff
changeset
|
240 diff = differ.DiffProcessor(differ.get_gitdiff(node1, node2)) |
649
3765f0f479a2
fixed raw diff as purly raw without html
Marcin Kuzminski <marcin@python-works.com>
parents:
644
diff
changeset
|
241 response.content_type = 'text/plain' |
3765f0f479a2
fixed raw diff as purly raw without html
Marcin Kuzminski <marcin@python-works.com>
parents:
644
diff
changeset
|
242 return diff.raw_diff() |
662
373ee7031003
fixed annotation bug, added history to annotation.
Marcin Kuzminski <marcin@python-works.com>
parents:
649
diff
changeset
|
243 |
337
fa3835d34fc1
fixed bug when diff command was different than available options
Marcin Kuzminski <marcin@python-works.com>
parents:
335
diff
changeset
|
244 elif c.action == 'diff': |
1044
f3402cb92fdf
changed raw and download diffs to gitdiff
Marcin Kuzminski <marcin@python-works.com>
parents:
1043
diff
changeset
|
245 diff = differ.DiffProcessor(differ.get_udiff(node1, node2)) |
f3402cb92fdf
changed raw and download diffs to gitdiff
Marcin Kuzminski <marcin@python-works.com>
parents:
1043
diff
changeset
|
246 |
812
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
247 if node1.size > self.cut_off_limit or node2.size > self.cut_off_limit: |
544
d8778cde98f0
added limits to single file diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
248 c.cur_diff = _('Diff is to big to display') |
1043
6ec53c16c744
fixed binary file issues
Marcin Kuzminski <marcin@python-works.com>
parents:
1038
diff
changeset
|
249 elif node1.is_binary or node2.is_binary: |
6ec53c16c744
fixed binary file issues
Marcin Kuzminski <marcin@python-works.com>
parents:
1038
diff
changeset
|
250 c.cur_diff = _('Binary file') |
544
d8778cde98f0
added limits to single file diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
251 else: |
d8778cde98f0
added limits to single file diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
252 c.cur_diff = diff.as_html() |
337
fa3835d34fc1
fixed bug when diff command was different than available options
Marcin Kuzminski <marcin@python-works.com>
parents:
335
diff
changeset
|
253 else: |
1044
f3402cb92fdf
changed raw and download diffs to gitdiff
Marcin Kuzminski <marcin@python-works.com>
parents:
1043
diff
changeset
|
254 diff = differ.DiffProcessor(differ.get_udiff(node1, node2)) |
337
fa3835d34fc1
fixed bug when diff command was different than available options
Marcin Kuzminski <marcin@python-works.com>
parents:
335
diff
changeset
|
255 #default option |
812
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
774
diff
changeset
|
256 if node1.size > self.cut_off_limit or node2.size > self.cut_off_limit: |
544
d8778cde98f0
added limits to single file diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
257 c.cur_diff = _('Diff is to big to display') |
1043
6ec53c16c744
fixed binary file issues
Marcin Kuzminski <marcin@python-works.com>
parents:
1038
diff
changeset
|
258 elif node1.is_binary or node2.is_binary: |
6ec53c16c744
fixed binary file issues
Marcin Kuzminski <marcin@python-works.com>
parents:
1038
diff
changeset
|
259 c.cur_diff = _('Binary file') |
544
d8778cde98f0
added limits to single file diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
260 else: |
d8778cde98f0
added limits to single file diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
261 c.cur_diff = diff.as_html() |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
262 |
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
263 if not c.cur_diff: c.no_changes = True |
129
42d46deb124d
implemented simple diffs for history of files.
Marcin Kuzminski <marcin@python-works.com>
parents:
128
diff
changeset
|
264 return render('files/file_diff.html') |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
265 |
128
9deb6f1d5b90
Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
106
diff
changeset
|
266 def _get_history(self, repo, node, f_path): |
9deb6f1d5b90
Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
106
diff
changeset
|
267 if not node.kind is NodeKind.FILE: |
9deb6f1d5b90
Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
106
diff
changeset
|
268 return [] |
129
42d46deb124d
implemented simple diffs for history of files.
Marcin Kuzminski <marcin@python-works.com>
parents:
128
diff
changeset
|
269 changesets = node.history |
128
9deb6f1d5b90
Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
106
diff
changeset
|
270 hist_l = [] |
774
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
271 |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
272 changesets_group = ([], _("Changesets")) |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
273 branches_group = ([], _("Branches")) |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
274 tags_group = ([], _("Tags")) |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
275 |
128
9deb6f1d5b90
Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
106
diff
changeset
|
276 for chs in changesets: |
512
d945c95ba4ac
refactoring for new vcs implementation
Marcin Kuzminski <marcin@python-works.com>
parents:
485
diff
changeset
|
277 n_desc = 'r%s:%s' % (chs.revision, chs.short_id) |
774
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
278 changesets_group[0].append((chs.raw_id, n_desc,)) |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
279 |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
280 hist_l.append(changesets_group) |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
281 |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
282 for name, chs in c.rhodecode_repo.branches.items(): |
774
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
283 #chs = chs.split(':')[-1] |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
284 branches_group[0].append((chs, name),) |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
285 hist_l.append(branches_group) |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
286 |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1044
diff
changeset
|
287 for name, chs in c.rhodecode_repo.tags.items(): |
774
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
288 #chs = chs.split(':')[-1] |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
289 tags_group[0].append((chs, name),) |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
290 hist_l.append(tags_group) |
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
291 |
128
9deb6f1d5b90
Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
106
diff
changeset
|
292 return hist_l |
774
c47152c5fe01
added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
293 |