Mercurial > kallithea
annotate rhodecode/controllers/changeset.py @ 1249:13b507b73190 beta
fixes issue #166, made clone-uri use the pylons build in url generators, that way it's more safe.
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 12 Apr 2011 19:48:02 +0200 |
parents | 50e41777675d |
children | 0a2a10a1912f |
rev | line source |
---|---|
812
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
691
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:
691
diff
changeset
|
2 """ |
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
3 rhodecode.controllers.changeset |
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
5 |
1203
6832ef664673
source code cleanup: remove trailing white space, normalize file endings
Marcin Kuzminski <marcin@python-works.com>
parents:
1131
diff
changeset
|
6 changeset controller for pylons showoing changes beetween |
977
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
7 revisions |
1203
6832ef664673
source code cleanup: remove trailing white space, normalize file endings
Marcin Kuzminski <marcin@python-works.com>
parents:
1131
diff
changeset
|
8 |
812
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
9 :created_on: Apr 25, 2010 |
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
10 :author: marcink |
1203
6832ef664673
source code cleanup: remove trailing white space, normalize file endings
Marcin Kuzminski <marcin@python-works.com>
parents:
1131
diff
changeset
|
11 :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:
691
diff
changeset
|
12 :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:
691
diff
changeset
|
13 """ |
1206
a671db5bdd58
fixed license issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
14 # This program is free software: you can redistribute it and/or modify |
a671db5bdd58
fixed license issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
15 # it under the terms of the GNU General Public License as published by |
a671db5bdd58
fixed license issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
16 # the Free Software Foundation, either version 3 of the License, or |
a671db5bdd58
fixed license issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
17 # (at your option) any later version. |
1203
6832ef664673
source code cleanup: remove trailing white space, normalize file endings
Marcin Kuzminski <marcin@python-works.com>
parents:
1131
diff
changeset
|
18 # |
252
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
19 # 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
|
20 # 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
|
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
22 # GNU General Public License for more details. |
1203
6832ef664673
source code cleanup: remove trailing white space, normalize file endings
Marcin Kuzminski <marcin@python-works.com>
parents:
1131
diff
changeset
|
23 # |
252
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
24 # You should have received a copy of the GNU General Public License |
1206
a671db5bdd58
fixed license issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
25 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
812
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
26 import logging |
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
27 import traceback |
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
28 |
466
183cee110578
first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents:
318
diff
changeset
|
29 from pylons import tmpl_context as c, url, request, response |
543
a99e23e6c1e8
fixes #13 large initial commits and changesets are cut of now to not freeze the application.
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
30 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:
285
diff
changeset
|
31 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:
691
diff
changeset
|
32 |
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
33 import rhodecode.lib.helpers as h |
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:
1038
diff
changeset
|
35 from rhodecode.lib.base import BaseRepoController, render |
649
3765f0f479a2
fixed raw diff as purly raw without html
Marcin Kuzminski <marcin@python-works.com>
parents:
648
diff
changeset
|
36 from rhodecode.lib.utils import EmptyChangeset |
812
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
37 |
978
6d2239363c81
#93 fixed errors on new revranges generation
Marcin Kuzminski <marcin@python-works.com>
parents:
977
diff
changeset
|
38 from vcs.exceptions import RepositoryError, ChangesetError, \ |
6d2239363c81
#93 fixed errors on new revranges generation
Marcin Kuzminski <marcin@python-works.com>
parents:
977
diff
changeset
|
39 ChangesetDoesNotExistError |
318
fdf9f6ee5217
Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
285
diff
changeset
|
40 from vcs.nodes import FileNode |
fdf9f6ee5217
Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
285
diff
changeset
|
41 from vcs.utils import diffs as differ |
977
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
42 from vcs.utils.ordered_dict import OrderedDict |
193
50a39f923f31
Added file annotation template. Bumped version to 0.6.8. Changelog and changeset are now cleaned with js, it's still very beta.
Marcin Kuzminski <marcin@python-works.com>
parents:
103
diff
changeset
|
43 |
103
665b344927f4
Added changeset controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
44 log = logging.getLogger(__name__) |
665b344927f4
Added changeset controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
45 |
1212 | 46 |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1038
diff
changeset
|
47 class ChangesetController(BaseRepoController): |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
48 |
193
50a39f923f31
Added file annotation template. Bumped version to 0.6.8. Changelog and changeset are now cleaned with js, it's still very beta.
Marcin Kuzminski <marcin@python-works.com>
parents:
103
diff
changeset
|
49 @LoginRequired() |
318
fdf9f6ee5217
Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
285
diff
changeset
|
50 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
51 'repository.admin') |
103
665b344927f4
Added changeset controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
52 def __before__(self): |
193
50a39f923f31
Added file annotation template. Bumped version to 0.6.8. Changelog and changeset are now cleaned with js, it's still very beta.
Marcin Kuzminski <marcin@python-works.com>
parents:
103
diff
changeset
|
53 super(ChangesetController, self).__before__() |
1130
1cecc7db3106
fixed some limits in changesets and changelogs
Marcin Kuzminski <marcin@python-works.com>
parents:
1125
diff
changeset
|
54 c.affected_files_cut_off = 60 |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
55 |
193
50a39f923f31
Added file annotation template. Bumped version to 0.6.8. Changelog and changeset are now cleaned with js, it's still very beta.
Marcin Kuzminski <marcin@python-works.com>
parents:
103
diff
changeset
|
56 def index(self, revision): |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
57 |
543
a99e23e6c1e8
fixes #13 large initial commits and changesets are cut of now to not freeze the application.
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
58 def wrap_to_table(str): |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
59 |
543
a99e23e6c1e8
fixes #13 large initial commits and changesets are cut of now to not freeze the application.
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
60 return '''<table class="code-difftable"> |
a99e23e6c1e8
fixes #13 large initial commits and changesets are cut of now to not freeze the application.
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
61 <tr class="line"> |
a99e23e6c1e8
fixes #13 large initial commits and changesets are cut of now to not freeze the application.
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
62 <td class="lineno new"></td> |
a99e23e6c1e8
fixes #13 large initial commits and changesets are cut of now to not freeze the application.
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
63 <td class="code"><pre>%s</pre></td> |
a99e23e6c1e8
fixes #13 large initial commits and changesets are cut of now to not freeze the application.
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
64 </tr> |
a99e23e6c1e8
fixes #13 large initial commits and changesets are cut of now to not freeze the application.
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
65 </table>''' % str |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
66 |
977
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
67 #get ranges of revisions if preset |
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
68 rev_range = revision.split('...')[:2] |
1126
e654898120b6
sorted tags by date in tag view
Marcin Kuzminski <marcin@python-works.com>
parents:
1125
diff
changeset
|
69 |
543
a99e23e6c1e8
fixes #13 large initial commits and changesets are cut of now to not freeze the application.
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
70 try: |
977
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
71 if len(rev_range) == 2: |
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
72 rev_start = rev_range[0] |
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
73 rev_end = rev_range[1] |
1107
7bb902022d86
small simplification in changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1082
diff
changeset
|
74 rev_ranges = c.rhodecode_repo.get_changesets(start=rev_start, |
7bb902022d86
small simplification in changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1082
diff
changeset
|
75 end=rev_end) |
977
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
76 else: |
1108
899c19b0865c
reverted removed list casting
Marcin Kuzminski <marcin@python-works.com>
parents:
1107
diff
changeset
|
77 rev_ranges = [c.rhodecode_repo.get_changeset(revision)] |
983
57a2b792a3a1
fixed error for single changeset
Marcin Kuzminski <marcin@python-works.com>
parents:
978
diff
changeset
|
78 |
57a2b792a3a1
fixed error for single changeset
Marcin Kuzminski <marcin@python-works.com>
parents:
978
diff
changeset
|
79 c.cs_ranges = list(rev_ranges) |
57a2b792a3a1
fixed error for single changeset
Marcin Kuzminski <marcin@python-works.com>
parents:
978
diff
changeset
|
80 |
978
6d2239363c81
#93 fixed errors on new revranges generation
Marcin Kuzminski <marcin@python-works.com>
parents:
977
diff
changeset
|
81 except (RepositoryError, ChangesetDoesNotExistError, Exception), e: |
543
a99e23e6c1e8
fixes #13 large initial commits and changesets are cut of now to not freeze the application.
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
82 log.error(traceback.format_exc()) |
644
c8bd0e6cc3da
some changes for #45.
Marcin Kuzminski <marcin@python-works.com>
parents:
636
diff
changeset
|
83 h.flash(str(e), category='warning') |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
84 return redirect(url('home')) |
977
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
85 |
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
86 c.changes = OrderedDict() |
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
87 c.sum_added = 0 |
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
88 c.sum_removed = 0 |
1130
1cecc7db3106
fixed some limits in changesets and changelogs
Marcin Kuzminski <marcin@python-works.com>
parents:
1125
diff
changeset
|
89 c.cut_off = False |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
90 |
977
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
91 for changeset in c.cs_ranges: |
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
92 c.changes[changeset.raw_id] = [] |
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
93 try: |
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
94 changeset_parent = changeset.parents[0] |
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
95 except IndexError: |
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
96 changeset_parent = None |
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
97 |
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
98 #================================================================== |
544
d8778cde98f0
added limits to single file diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
543
diff
changeset
|
99 # ADDED FILES |
977
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
100 #================================================================== |
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
101 for node in changeset.added: |
566
7fcc539e20b1
large initial commits fixup
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
102 filenode_old = FileNode(node.path, '', EmptyChangeset()) |
543
a99e23e6c1e8
fixes #13 large initial commits and changesets are cut of now to not freeze the application.
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
103 if filenode_old.is_binary or node.is_binary: |
a99e23e6c1e8
fixes #13 large initial commits and changesets are cut of now to not freeze the application.
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
104 diff = wrap_to_table(_('binary file')) |
a99e23e6c1e8
fixes #13 large initial commits and changesets are cut of now to not freeze the application.
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
105 else: |
544
d8778cde98f0
added limits to single file diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
543
diff
changeset
|
106 c.sum_added += node.size |
812
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
107 if c.sum_added < self.cut_off_limit: |
1125
ce4287e3e3c9
changed all instances of udiff into gitdiff, for vcs issue #49
Marcin Kuzminski <marcin@python-works.com>
parents:
1108
diff
changeset
|
108 f_gitdiff = differ.get_gitdiff(filenode_old, node) |
1212 | 109 diff = differ.DiffProcessor(f_gitdiff, |
110 format='gitdiff').as_html() | |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
111 |
543
a99e23e6c1e8
fixes #13 large initial commits and changesets are cut of now to not freeze the application.
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
112 else: |
1212 | 113 diff = wrap_to_table(_('Changeset is to big and ' |
114 'was cut off, see raw ' | |
115 'changeset instead')) | |
1130
1cecc7db3106
fixed some limits in changesets and changelogs
Marcin Kuzminski <marcin@python-works.com>
parents:
1125
diff
changeset
|
116 c.cut_off = True |
1cecc7db3106
fixed some limits in changesets and changelogs
Marcin Kuzminski <marcin@python-works.com>
parents:
1125
diff
changeset
|
117 break |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
118 |
543
a99e23e6c1e8
fixes #13 large initial commits and changesets are cut of now to not freeze the application.
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
119 cs1 = None |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
120 cs2 = node.last_changeset.raw_id |
1212 | 121 c.changes[changeset.raw_id].append(('added', node, |
122 diff, cs1, cs2)) | |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
123 |
977
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
124 #================================================================== |
544
d8778cde98f0
added limits to single file diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
543
diff
changeset
|
125 # CHANGED FILES |
977
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
126 #================================================================== |
1130
1cecc7db3106
fixed some limits in changesets and changelogs
Marcin Kuzminski <marcin@python-works.com>
parents:
1125
diff
changeset
|
127 if not c.cut_off: |
1cecc7db3106
fixed some limits in changesets and changelogs
Marcin Kuzminski <marcin@python-works.com>
parents:
1125
diff
changeset
|
128 for node in changeset.changed: |
1cecc7db3106
fixed some limits in changesets and changelogs
Marcin Kuzminski <marcin@python-works.com>
parents:
1125
diff
changeset
|
129 try: |
1cecc7db3106
fixed some limits in changesets and changelogs
Marcin Kuzminski <marcin@python-works.com>
parents:
1125
diff
changeset
|
130 filenode_old = changeset_parent.get_node(node.path) |
1cecc7db3106
fixed some limits in changesets and changelogs
Marcin Kuzminski <marcin@python-works.com>
parents:
1125
diff
changeset
|
131 except ChangesetError: |
1212 | 132 filenode_old = FileNode(node.path, '', |
133 EmptyChangeset()) | |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
134 |
1130
1cecc7db3106
fixed some limits in changesets and changelogs
Marcin Kuzminski <marcin@python-works.com>
parents:
1125
diff
changeset
|
135 if filenode_old.is_binary or node.is_binary: |
1cecc7db3106
fixed some limits in changesets and changelogs
Marcin Kuzminski <marcin@python-works.com>
parents:
1125
diff
changeset
|
136 diff = wrap_to_table(_('binary file')) |
1cecc7db3106
fixed some limits in changesets and changelogs
Marcin Kuzminski <marcin@python-works.com>
parents:
1125
diff
changeset
|
137 else: |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
138 |
1130
1cecc7db3106
fixed some limits in changesets and changelogs
Marcin Kuzminski <marcin@python-works.com>
parents:
1125
diff
changeset
|
139 if c.sum_removed < self.cut_off_limit: |
1cecc7db3106
fixed some limits in changesets and changelogs
Marcin Kuzminski <marcin@python-works.com>
parents:
1125
diff
changeset
|
140 f_gitdiff = differ.get_gitdiff(filenode_old, node) |
1212 | 141 diff = differ.DiffProcessor(f_gitdiff, |
142 format='gitdiff')\ | |
143 .as_html() | |
1130
1cecc7db3106
fixed some limits in changesets and changelogs
Marcin Kuzminski <marcin@python-works.com>
parents:
1125
diff
changeset
|
144 if diff: |
1cecc7db3106
fixed some limits in changesets and changelogs
Marcin Kuzminski <marcin@python-works.com>
parents:
1125
diff
changeset
|
145 c.sum_removed += len(diff) |
1cecc7db3106
fixed some limits in changesets and changelogs
Marcin Kuzminski <marcin@python-works.com>
parents:
1125
diff
changeset
|
146 else: |
1212 | 147 diff = wrap_to_table(_('Changeset is to big and ' |
148 'was cut off, see raw ' | |
149 'changeset instead')) | |
1130
1cecc7db3106
fixed some limits in changesets and changelogs
Marcin Kuzminski <marcin@python-works.com>
parents:
1125
diff
changeset
|
150 c.cut_off = True |
1cecc7db3106
fixed some limits in changesets and changelogs
Marcin Kuzminski <marcin@python-works.com>
parents:
1125
diff
changeset
|
151 break |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
152 |
1130
1cecc7db3106
fixed some limits in changesets and changelogs
Marcin Kuzminski <marcin@python-works.com>
parents:
1125
diff
changeset
|
153 cs1 = filenode_old.last_changeset.raw_id |
1cecc7db3106
fixed some limits in changesets and changelogs
Marcin Kuzminski <marcin@python-works.com>
parents:
1125
diff
changeset
|
154 cs2 = node.last_changeset.raw_id |
1212 | 155 c.changes[changeset.raw_id].append(('changed', node, |
156 diff, cs1, cs2)) | |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
157 |
977
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
158 #================================================================== |
1203
6832ef664673
source code cleanup: remove trailing white space, normalize file endings
Marcin Kuzminski <marcin@python-works.com>
parents:
1131
diff
changeset
|
159 # REMOVED FILES |
977
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
160 #================================================================== |
1130
1cecc7db3106
fixed some limits in changesets and changelogs
Marcin Kuzminski <marcin@python-works.com>
parents:
1125
diff
changeset
|
161 if not c.cut_off: |
1cecc7db3106
fixed some limits in changesets and changelogs
Marcin Kuzminski <marcin@python-works.com>
parents:
1125
diff
changeset
|
162 for node in changeset.removed: |
1212 | 163 c.changes[changeset.raw_id].append(('removed', node, None, |
164 None, None)) | |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
165 |
977
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
166 if len(c.cs_ranges) == 1: |
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
167 c.changeset = c.cs_ranges[0] |
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
168 c.changes = c.changes[c.changeset.raw_id] |
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
169 |
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
170 return render('changeset/changeset.html') |
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
171 else: |
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
172 return render('changeset/changeset_range.html') |
543
a99e23e6c1e8
fixes #13 large initial commits and changesets are cut of now to not freeze the application.
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
173 |
a99e23e6c1e8
fixes #13 large initial commits and changesets are cut of now to not freeze the application.
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
174 def raw_changeset(self, revision): |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
175 |
543
a99e23e6c1e8
fixes #13 large initial commits and changesets are cut of now to not freeze the application.
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
176 method = request.GET.get('diff', 'show') |
285
42f5c36820ef
few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
273
diff
changeset
|
177 try: |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1038
diff
changeset
|
178 c.scm_type = c.rhodecode_repo.alias |
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1038
diff
changeset
|
179 c.changeset = c.rhodecode_repo.get_changeset(revision) |
285
42f5c36820ef
few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
273
diff
changeset
|
180 except RepositoryError: |
42f5c36820ef
few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
273
diff
changeset
|
181 log.error(traceback.format_exc()) |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
182 return redirect(url('home')) |
285
42f5c36820ef
few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
273
diff
changeset
|
183 else: |
42f5c36820ef
few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
273
diff
changeset
|
184 try: |
977
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
185 c.changeset_parent = c.changeset.parents[0] |
285
42f5c36820ef
few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
273
diff
changeset
|
186 except IndexError: |
977
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
187 c.changeset_parent = None |
285
42f5c36820ef
few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
273
diff
changeset
|
188 c.changes = [] |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
189 |
285
42f5c36820ef
few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
273
diff
changeset
|
190 for node in c.changeset.added: |
42f5c36820ef
few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
273
diff
changeset
|
191 filenode_old = FileNode(node.path, '') |
42f5c36820ef
few validation bugfixes/ new repo changesets, first commit changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
273
diff
changeset
|
192 if filenode_old.is_binary or node.is_binary: |
812
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
193 diff = _('binary file') + '\n' |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
194 else: |
1125
ce4287e3e3c9
changed all instances of udiff into gitdiff, for vcs issue #49
Marcin Kuzminski <marcin@python-works.com>
parents:
1108
diff
changeset
|
195 f_gitdiff = differ.get_gitdiff(filenode_old, node) |
1212 | 196 diff = differ.DiffProcessor(f_gitdiff, |
197 format='gitdiff').raw_diff() | |
466
183cee110578
first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents:
318
diff
changeset
|
198 |
183cee110578
first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents:
318
diff
changeset
|
199 cs1 = None |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
200 cs2 = node.last_changeset.raw_id |
466
183cee110578
first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents:
318
diff
changeset
|
201 c.changes.append(('added', node, diff, cs1, cs2)) |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
202 |
466
183cee110578
first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents:
318
diff
changeset
|
203 for node in c.changeset.changed: |
977
28524453bb76
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
204 filenode_old = c.changeset_parent.get_node(node.path) |
466
183cee110578
first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents:
318
diff
changeset
|
205 if filenode_old.is_binary or node.is_binary: |
543
a99e23e6c1e8
fixes #13 large initial commits and changesets are cut of now to not freeze the application.
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
206 diff = _('binary file') |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
207 else: |
1125
ce4287e3e3c9
changed all instances of udiff into gitdiff, for vcs issue #49
Marcin Kuzminski <marcin@python-works.com>
parents:
1108
diff
changeset
|
208 f_gitdiff = differ.get_gitdiff(filenode_old, node) |
1212 | 209 diff = differ.DiffProcessor(f_gitdiff, |
210 format='gitdiff').raw_diff() | |
466
183cee110578
first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents:
318
diff
changeset
|
211 |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
212 cs1 = filenode_old.last_changeset.raw_id |
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
213 cs2 = node.last_changeset.raw_id |
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
214 c.changes.append(('changed', node, diff, cs1, cs2)) |
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
215 |
466
183cee110578
first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents:
318
diff
changeset
|
216 response.content_type = 'text/plain' |
812
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
217 |
468
9dd372c7166c
added menu for changeset raw diff and download diff
Marcin Kuzminski <marcin@python-works.com>
parents:
466
diff
changeset
|
218 if method == 'download': |
1212 | 219 response.content_disposition = 'attachment; filename=%s.patch' \ |
220 % revision | |
812
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
221 |
466
183cee110578
first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents:
318
diff
changeset
|
222 parent = True if len(c.changeset.parents) > 0 else False |
1212 | 223 c.parent_tmpl = 'Parent %s' \ |
224 % c.changeset.parents[0].raw_id if parent else '' | |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
225 |
466
183cee110578
first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents:
318
diff
changeset
|
226 c.diffs = '' |
183cee110578
first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents:
318
diff
changeset
|
227 for x in c.changes: |
183cee110578
first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents:
318
diff
changeset
|
228 c.diffs += x[2] |
812
30ad41c76fae
fixes #79 cut off limit was added into .ini config files
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
229 |
466
183cee110578
first implementation of #34 changeset raw diff based on udiff from python
Marcin Kuzminski <marcin@python-works.com>
parents:
318
diff
changeset
|
230 return render('changeset/raw_changeset.html') |