Show More
@@ -4,7 +4,7 b'' | |||||
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | changelog controller for rhodecode |
|
6 | changelog 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> | |
@@ -49,6 +49,7 b' class ChangelogController(BaseRepoContro' | |||||
49 | 'repository.admin') |
|
49 | 'repository.admin') | |
50 | def __before__(self): |
|
50 | def __before__(self): | |
51 | super(ChangelogController, self).__before__() |
|
51 | super(ChangelogController, self).__before__() | |
|
52 | c.affected_files_cut_off = 60 | |||
52 |
|
53 | |||
53 | def index(self): |
|
54 | def index(self): | |
54 | limit = 100 |
|
55 | limit = 100 |
@@ -52,6 +52,7 b' class ChangesetController(BaseRepoContro' | |||||
52 | 'repository.admin') |
|
52 | 'repository.admin') | |
53 | def __before__(self): |
|
53 | def __before__(self): | |
54 | super(ChangesetController, self).__before__() |
|
54 | super(ChangesetController, self).__before__() | |
|
55 | c.affected_files_cut_off = 60 | |||
55 |
|
56 | |||
56 | def index(self, revision): |
|
57 | def index(self, revision): | |
57 |
|
58 | |||
@@ -66,7 +67,7 b' class ChangesetController(BaseRepoContro' | |||||
66 |
|
67 | |||
67 | #get ranges of revisions if preset |
|
68 | #get ranges of revisions if preset | |
68 | rev_range = revision.split('...')[:2] |
|
69 | rev_range = revision.split('...')[:2] | |
69 | range_limit = 50 |
|
70 | ||
70 | try: |
|
71 | try: | |
71 | if len(rev_range) == 2: |
|
72 | if len(rev_range) == 2: | |
72 | rev_start = rev_range[0] |
|
73 | rev_start = rev_range[0] | |
@@ -86,7 +87,7 b' class ChangesetController(BaseRepoContro' | |||||
86 | c.changes = OrderedDict() |
|
87 | c.changes = OrderedDict() | |
87 | c.sum_added = 0 |
|
88 | c.sum_added = 0 | |
88 | c.sum_removed = 0 |
|
89 | c.sum_removed = 0 | |
89 |
|
90 | c.cut_off = False | ||
90 |
|
91 | |||
91 | for changeset in c.cs_ranges: |
|
92 | for changeset in c.cs_ranges: | |
92 | c.changes[changeset.raw_id] = [] |
|
93 | c.changes[changeset.raw_id] = [] | |
@@ -112,6 +113,8 b' class ChangesetController(BaseRepoContro' | |||||
112 | else: |
|
113 | else: | |
113 | diff = wrap_to_table(_('Changeset is to big and was cut' |
|
114 | diff = wrap_to_table(_('Changeset is to big and was cut' | |
114 | ' off, see raw changeset instead')) |
|
115 | ' off, see raw changeset instead')) | |
|
116 | c.cut_off = True | |||
|
117 | break | |||
115 |
|
118 | |||
116 | cs1 = None |
|
119 | cs1 = None | |
117 | cs2 = node.last_changeset.raw_id |
|
120 | cs2 = node.last_changeset.raw_id | |
@@ -120,35 +123,38 b' class ChangesetController(BaseRepoContro' | |||||
120 | #================================================================== |
|
123 | #================================================================== | |
121 | # CHANGED FILES |
|
124 | # CHANGED FILES | |
122 | #================================================================== |
|
125 | #================================================================== | |
123 | for node in changeset.changed: |
|
126 | if not c.cut_off: | |
124 | try: |
|
127 | for node in changeset.changed: | |
125 | filenode_old = changeset_parent.get_node(node.path) |
|
128 | try: | |
126 | except ChangesetError: |
|
129 | filenode_old = changeset_parent.get_node(node.path) | |
127 | filenode_old = FileNode(node.path, '', EmptyChangeset()) |
|
130 | except ChangesetError: | |
|
131 | filenode_old = FileNode(node.path, '', EmptyChangeset()) | |||
128 |
|
132 | |||
129 | if filenode_old.is_binary or node.is_binary: |
|
133 | if filenode_old.is_binary or node.is_binary: | |
130 | diff = wrap_to_table(_('binary file')) |
|
134 | diff = wrap_to_table(_('binary file')) | |
131 | else: |
|
135 | else: | |
132 |
|
136 | |||
133 | if c.sum_removed < self.cut_off_limit: |
|
137 | if c.sum_removed < self.cut_off_limit: | |
134 | f_gitdiff = differ.get_gitdiff(filenode_old, node) |
|
138 | f_gitdiff = differ.get_gitdiff(filenode_old, node) | |
135 | diff = differ.DiffProcessor(f_gitdiff, format='gitdiff').as_html() |
|
139 | diff = differ.DiffProcessor(f_gitdiff, format='gitdiff').as_html() | |
136 | if diff: |
|
140 | if diff: | |
137 | c.sum_removed += len(diff) |
|
141 | c.sum_removed += len(diff) | |
138 | else: |
|
142 | else: | |
139 | diff = wrap_to_table(_('Changeset is to big and was cut' |
|
143 | diff = wrap_to_table(_('Changeset is to big and was cut' | |
140 | ' off, see raw changeset instead')) |
|
144 | ' off, see raw changeset instead')) | |
|
145 | c.cut_off = True | |||
|
146 | break | |||
141 |
|
147 | |||
142 |
|
148 | cs1 = filenode_old.last_changeset.raw_id | ||
143 |
|
|
149 | cs2 = node.last_changeset.raw_id | |
144 | cs2 = node.last_changeset.raw_id |
|
150 | c.changes[changeset.raw_id].append(('changed', node, diff, cs1, cs2)) | |
145 | c.changes[changeset.raw_id].append(('changed', node, diff, cs1, cs2)) |
|
|||
146 |
|
151 | |||
147 | #================================================================== |
|
152 | #================================================================== | |
148 | # REMOVED FILES |
|
153 | # REMOVED FILES | |
149 | #================================================================== |
|
154 | #================================================================== | |
150 | for node in changeset.removed: |
|
155 | if not c.cut_off: | |
151 | c.changes[changeset.raw_id].append(('removed', node, None, None, None)) |
|
156 | for node in changeset.removed: | |
|
157 | c.changes[changeset.raw_id].append(('removed', node, None, None, None)) | |||
152 |
|
158 | |||
153 | if len(c.cs_ranges) == 1: |
|
159 | if len(c.cs_ranges) == 1: | |
154 | c.changeset = c.cs_ranges[0] |
|
160 | c.changeset = c.cs_ranges[0] | |
@@ -180,7 +186,7 b' class ChangesetController(BaseRepoContro' | |||||
180 | diff = _('binary file') + '\n' |
|
186 | diff = _('binary file') + '\n' | |
181 | else: |
|
187 | else: | |
182 | f_gitdiff = differ.get_gitdiff(filenode_old, node) |
|
188 | f_gitdiff = differ.get_gitdiff(filenode_old, node) | |
183 | diff = differ.DiffProcessor(f_gitdiff).raw_diff() |
|
189 | diff = differ.DiffProcessor(f_gitdiff, format='gitdiff').raw_diff() | |
184 |
|
190 | |||
185 | cs1 = None |
|
191 | cs1 = None | |
186 | cs2 = node.last_changeset.raw_id |
|
192 | cs2 = node.last_changeset.raw_id | |
@@ -192,7 +198,7 b' class ChangesetController(BaseRepoContro' | |||||
192 | diff = _('binary file') |
|
198 | diff = _('binary file') | |
193 | else: |
|
199 | else: | |
194 | f_gitdiff = differ.get_gitdiff(filenode_old, node) |
|
200 | f_gitdiff = differ.get_gitdiff(filenode_old, node) | |
195 | diff = differ.DiffProcessor(f_gitdiff).raw_diff() |
|
201 | diff = differ.DiffProcessor(f_gitdiff, format='gitdiff').raw_diff() | |
196 |
|
202 | |||
197 | cs1 = filenode_old.last_changeset.raw_id |
|
203 | cs1 = filenode_old.last_changeset.raw_id | |
198 | cs2 = node.last_changeset.raw_id |
|
204 | cs2 = node.last_changeset.raw_id |
@@ -62,12 +62,14 b'' | |||||
62 | </div> |
|
62 | </div> | |
63 | <div class="right"> |
|
63 | <div class="right"> | |
64 | <div class="changes"> |
|
64 | <div class="changes"> | |
65 |
% if len(cs.affected_files) <= |
|
65 | % if len(cs.affected_files) <= c.affected_files_cut_off: | |
66 | <span class="removed tooltip" title="<b>${_('removed')}</b>${h.changed_tooltip(cs.removed)}">${len(cs.removed)}</span> |
|
66 | <span class="removed tooltip" title="<b>${_('removed')}</b>${h.changed_tooltip(cs.removed)}">${len(cs.removed)}</span> | |
67 | <span class="changed tooltip" title="<b>${_('changed')}</b>${h.changed_tooltip(cs.changed)}">${len(cs.changed)}</span> |
|
67 | <span class="changed tooltip" title="<b>${_('changed')}</b>${h.changed_tooltip(cs.changed)}">${len(cs.changed)}</span> | |
68 | <span class="added tooltip" title="<b>${_('added')}</b>${h.changed_tooltip(cs.added)}">${len(cs.added)}</span> |
|
68 | <span class="added tooltip" title="<b>${_('added')}</b>${h.changed_tooltip(cs.added)}">${len(cs.added)}</span> | |
69 | % else: |
|
69 | % else: | |
70 |
|
|
70 | <span class="removed tooltip" title="${_('affected %s files') % len(cs.affected_files)}">!</span> | |
|
71 | <span class="changed tooltip" title="${_('affected %s files') % len(cs.affected_files)}">!</span> | |||
|
72 | <span class="added tooltip" title="${_('affected %s files') % len(cs.affected_files)}">!</span> | |||
71 | % endif |
|
73 | % endif | |
72 | </div> |
|
74 | </div> | |
73 | %if len(cs.parents)>1: |
|
75 | %if len(cs.parents)>1: |
@@ -1,3 +1,5 b'' | |||||
|
1 | ## -*- coding: utf-8 -*- | |||
|
2 | ||||
1 | <%inherit file="/base/base.html"/> |
|
3 | <%inherit file="/base/base.html"/> | |
2 |
|
4 | |||
3 | <%def name="title()"> |
|
5 | <%def name="title()"> | |
@@ -49,9 +51,15 b'' | |||||
49 | </div> |
|
51 | </div> | |
50 | <div class="right"> |
|
52 | <div class="right"> | |
51 | <div class="changes"> |
|
53 | <div class="changes"> | |
|
54 | % if len(c.changeset.affected_files) <= c.affected_files_cut_off: | |||
52 | <span class="removed" title="${_('removed')}">${len(c.changeset.removed)}</span> |
|
55 | <span class="removed" title="${_('removed')}">${len(c.changeset.removed)}</span> | |
53 | <span class="changed" title="${_('changed')}">${len(c.changeset.changed)}</span> |
|
56 | <span class="changed" title="${_('changed')}">${len(c.changeset.changed)}</span> | |
54 | <span class="added" title="${_('added')}">${len(c.changeset.added)}</span> |
|
57 | <span class="added" title="${_('added')}">${len(c.changeset.added)}</span> | |
|
58 | % else: | |||
|
59 | <span class="removed" title="${_('affected %s files') % len(c.changeset.affected_files)}">!</span> | |||
|
60 | <span class="changed" title="${_('affected %s files') % len(c.changeset.affected_files)}">!</span> | |||
|
61 | <span class="added" title="${_('affected %s files') % len(c.changeset.affected_files)}">!</span> | |||
|
62 | % endif | |||
55 | </div> |
|
63 | </div> | |
56 | %if len(c.changeset.parents)>1: |
|
64 | %if len(c.changeset.parents)>1: | |
57 | <div class="merge"> |
|
65 | <div class="merge"> | |
@@ -78,11 +86,14 b'' | |||||
78 | </span> |
|
86 | </span> | |
79 | </div> |
|
87 | </div> | |
80 | </div> |
|
88 | </div> | |
81 | <span style="font-size:1.1em;font-weight: bold">${_('Files affected')}</span> |
|
89 | <span style="font-size:1.1em;font-weight: bold">${_('Files affected (%s)' % len(c.changeset.affected_files))}</span> | |
82 | <div class="cs_files"> |
|
90 | <div class="cs_files"> | |
83 | %for change,filenode,diff,cs1,cs2 in c.changes: |
|
91 | %for change,filenode,diff,cs1,cs2 in c.changes: | |
84 | <div class="cs_${change}">${h.link_to(filenode.path.decode('utf-8','replace'),h.url.current(anchor=h.repo_name_slug('C%s' % filenode.path.decode('utf-8','replace'))))}</div> |
|
92 | <div class="cs_${change}">${h.link_to(filenode.path.decode('utf-8','replace'),h.url.current(anchor=h.repo_name_slug('C%s' % filenode.path.decode('utf-8','replace'))))}</div> | |
85 | %endfor |
|
93 | %endfor | |
|
94 | % if c.cut_off: | |||
|
95 | ${_('Changeset was to big and was cut off...')} | |||
|
96 | % endif | |||
86 | </div> |
|
97 | </div> | |
87 | </div> |
|
98 | </div> | |
88 |
|
99 |
General Comments 0
You need to be logged in to leave comments.
Login now