##// END OF EJS Templates
implements #308 rewrote diffs to enable displaying full diff on each file...
marcink -
r1789:17caf4ef beta
parent child Browse files
Show More
@@ -46,6 +46,7 b' from rhodecode.lib import diffs'
46 from rhodecode.model.db import ChangesetComment
46 from rhodecode.model.db import ChangesetComment
47 from rhodecode.model.comment import ChangesetCommentsModel
47 from rhodecode.model.comment import ChangesetCommentsModel
48 from rhodecode.model.meta import Session
48 from rhodecode.model.meta import Session
49 from rhodecode.lib.diffs import wrapped_diff
49
50
50 log = logging.getLogger(__name__)
51 log = logging.getLogger(__name__)
51
52
@@ -145,15 +146,6 b' def _context_url(fileid=None):'
145 return h.link_to(lbl, h.url.current(**params))
146 return h.link_to(lbl, h.url.current(**params))
146
147
147
148
148 def wrap_to_table(str_):
149 return '''<table class="code-difftable">
150 <tr class="line no-comment">
151 <td class="lineno new"></td>
152 <td class="code no-comment"><pre>%s</pre></td>
153 </tr>
154 </table>''' % str_
155
156
157 class ChangesetController(BaseRepoController):
149 class ChangesetController(BaseRepoController):
158
150
159 @LoginRequired()
151 @LoginRequired()
@@ -192,10 +184,11 b' class ChangesetController(BaseRepoContro'
192 return redirect(url('home'))
184 return redirect(url('home'))
193
185
194 c.changes = OrderedDict()
186 c.changes = OrderedDict()
195 c.sum_added = 0
187
196 c.sum_removed = 0
188 c.lines_added = 0 # count of lines added
197 c.lines_added = 0
189 c.lines_deleted = 0 # count of lines removes
198 c.lines_deleted = 0
190
191 cumulative_diff = 0
199 c.cut_off = False # defines if cut off limit is reached
192 c.cut_off = False # defines if cut off limit is reached
200
193
201 c.comments = []
194 c.comments = []
@@ -220,37 +213,19 b' class ChangesetController(BaseRepoContro'
220 # ADDED FILES
213 # ADDED FILES
221 #==================================================================
214 #==================================================================
222 for node in changeset.added:
215 for node in changeset.added:
223
224 filenode_old = FileNode(node.path, '', EmptyChangeset())
225 if filenode_old.is_binary or node.is_binary:
226 diff = wrap_to_table(_('binary file'))
227 st = (0, 0)
228 else:
229 # in this case node.size is good parameter since those are
230 # added nodes and their size defines how many changes were
231 # made
232 c.sum_added += node.size
233 fid = h.FID(revision, node.path)
216 fid = h.FID(revision, node.path)
234 line_context_lcl = get_line_ctx(fid, request.GET)
217 line_context_lcl = get_line_ctx(fid, request.GET)
235 ignore_whitespace_lcl = get_ignore_ws(fid, request.GET)
218 ign_whitespace_lcl = get_ignore_ws(fid, request.GET)
236 if c.sum_added < self.cut_off_limit:
219 lim = self.cut_off_limit
237 f_gitdiff = diffs.get_gitdiff(filenode_old, node,
220 if cumulative_diff > self.cut_off_limit:
238 ignore_whitespace=ignore_whitespace_lcl,
221 lim = -1
239 context=line_context_lcl)
222 size, cs1, cs2, diff, st = wrapped_diff(filenode_old=None,
240 d = diffs.DiffProcessor(f_gitdiff, format='gitdiff')
223 filenode_new=node,
241
224 cut_off_limit=lim,
242 st = d.stat()
225 ignore_whitespace=ign_whitespace_lcl,
243 diff = d.as_html(enable_comments=enable_comments)
226 line_context=line_context_lcl,
244
227 enable_comments=enable_comments)
245 else:
228 cumulative_diff += size
246 diff = wrap_to_table(_('Changeset is to big and '
247 'was cut off, see raw '
248 'changeset instead'))
249 c.cut_off = True
250 break
251
252 cs1 = None
253 cs2 = node.last_changeset.raw_id
254 c.lines_added += st[0]
229 c.lines_added += st[0]
255 c.lines_deleted += st[1]
230 c.lines_deleted += st[1]
256 c.changes[changeset.raw_id].append(('added', node, diff,
231 c.changes[changeset.raw_id].append(('added', node, diff,
@@ -259,48 +234,26 b' class ChangesetController(BaseRepoContro'
259 #==================================================================
234 #==================================================================
260 # CHANGED FILES
235 # CHANGED FILES
261 #==================================================================
236 #==================================================================
262 if not c.cut_off:
263 for node in changeset.changed:
237 for node in changeset.changed:
264 try:
238 try:
265 filenode_old = changeset_parent.get_node(node.path)
239 filenode_old = changeset_parent.get_node(node.path)
266 except ChangesetError:
240 except ChangesetError:
267 log.warning('Unable to fetch parent node for diff')
241 log.warning('Unable to fetch parent node for diff')
268 filenode_old = FileNode(node.path, '',
242 filenode_old = FileNode(node.path, '', EmptyChangeset())
269 EmptyChangeset())
270
243
271 if filenode_old.is_binary or node.is_binary:
272 diff = wrap_to_table(_('binary file'))
273 st = (0, 0)
274 else:
275
276 if c.sum_removed < self.cut_off_limit:
277 fid = h.FID(revision, node.path)
244 fid = h.FID(revision, node.path)
278 line_context_lcl = get_line_ctx(fid, request.GET)
245 line_context_lcl = get_line_ctx(fid, request.GET)
279 ignore_whitespace_lcl = get_ignore_ws(fid, request.GET,)
246 ign_whitespace_lcl = get_ignore_ws(fid, request.GET)
280 f_gitdiff = diffs.get_gitdiff(filenode_old, node,
247 lim = self.cut_off_limit
281 ignore_whitespace=ignore_whitespace_lcl,
248 if cumulative_diff > self.cut_off_limit:
282 context=line_context_lcl)
249 lim = -1
283 d = diffs.DiffProcessor(f_gitdiff,
250 size, cs1, cs2, diff, st = wrapped_diff(filenode_old=filenode_old,
284 format='gitdiff')
251 filenode_new=node,
285 st = d.stat()
252 cut_off_limit=lim,
286 if (st[0] + st[1]) * 256 > self.cut_off_limit:
253 ignore_whitespace=ign_whitespace_lcl,
287 diff = wrap_to_table(_('Diff is to big '
254 line_context=line_context_lcl,
288 'and was cut off, see '
255 enable_comments=enable_comments)
289 'raw diff instead'))
256 cumulative_diff += size
290 else:
291 diff = d.as_html(enable_comments=enable_comments)
292
293 if diff:
294 c.sum_removed += len(diff)
295 else:
296 diff = wrap_to_table(_('Changeset is to big and '
297 'was cut off, see raw '
298 'changeset instead'))
299 c.cut_off = True
300 break
301
302 cs1 = filenode_old.last_changeset.raw_id
303 cs2 = node.last_changeset.raw_id
304 c.lines_added += st[0]
257 c.lines_added += st[0]
305 c.lines_deleted += st[1]
258 c.lines_deleted += st[1]
306 c.changes[changeset.raw_id].append(('changed', node, diff,
259 c.changes[changeset.raw_id].append(('changed', node, diff,
@@ -309,7 +262,6 b' class ChangesetController(BaseRepoContro'
309 #==================================================================
262 #==================================================================
310 # REMOVED FILES
263 # REMOVED FILES
311 #==================================================================
264 #==================================================================
312 if not c.cut_off:
313 for node in changeset.removed:
265 for node in changeset.removed:
314 c.changes[changeset.raw_id].append(('removed', node, None,
266 c.changes[changeset.raw_id].append(('removed', node, None,
315 None, None, (0, 0)))
267 None, None, (0, 0)))
@@ -27,19 +27,18 b' import os'
27 import logging
27 import logging
28 import traceback
28 import traceback
29
29
30 from os.path import join as jn
30 from pylons import request, response, tmpl_context as c, url
31
32 from pylons import request, response, session, tmpl_context as c, url
33 from pylons.i18n.translation import _
31 from pylons.i18n.translation import _
34 from pylons.controllers.util import redirect
32 from pylons.controllers.util import redirect
35 from pylons.decorators import jsonify
33 from pylons.decorators import jsonify
36
34
37 from vcs.conf import settings
35 from vcs.conf import settings
38 from vcs.exceptions import RepositoryError, ChangesetDoesNotExistError, \
36 from vcs.exceptions import RepositoryError, ChangesetDoesNotExistError, \
39 EmptyRepositoryError, ImproperArchiveTypeError, VCSError, NodeAlreadyExistsError
37 EmptyRepositoryError, ImproperArchiveTypeError, VCSError, \
40 from vcs.nodes import FileNode, NodeKind
38 NodeAlreadyExistsError
39 from vcs.nodes import FileNode
41
40
42
41 from rhodecode.lib.compat import OrderedDict
43 from rhodecode.lib import convert_line_endings, detect_mode, safe_str
42 from rhodecode.lib import convert_line_endings, detect_mode, safe_str
44 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
43 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
45 from rhodecode.lib.base import BaseRepoController, render
44 from rhodecode.lib.base import BaseRepoController, render
@@ -47,6 +46,9 b' from rhodecode.lib.utils import EmptyCha'
47 from rhodecode.lib import diffs
46 from rhodecode.lib import diffs
48 import rhodecode.lib.helpers as h
47 import rhodecode.lib.helpers as h
49 from rhodecode.model.repo import RepoModel
48 from rhodecode.model.repo import RepoModel
49 from rhodecode.controllers.changeset import anchor_url, _ignorews_url,\
50 _context_url, get_line_ctx, get_ignore_ws
51 from rhodecode.lib.diffs import wrapped_diff
50
52
51 log = logging.getLogger(__name__)
53 log = logging.getLogger(__name__)
52
54
@@ -105,7 +107,6 b' class FilesController(BaseRepoController'
105
107
106 return file_node
108 return file_node
107
109
108
109 def __get_paths(self, changeset, starting_path):
110 def __get_paths(self, changeset, starting_path):
110 """recursive walk in root dir and return a set of all path in that dir
111 """recursive walk in root dir and return a set of all path in that dir
111 based on repository walk function
112 based on repository walk function
@@ -128,7 +129,7 b' class FilesController(BaseRepoController'
128 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
129 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
129 'repository.admin')
130 'repository.admin')
130 def index(self, repo_name, revision, f_path):
131 def index(self, repo_name, revision, f_path):
131 #reditect to given revision from form if given
132 # redirect to given revision from form if given
132 post_revision = request.POST.get('at_rev', None)
133 post_revision = request.POST.get('at_rev', None)
133 if post_revision:
134 if post_revision:
134 cs = self.__get_cs_or_redirect(post_revision, repo_name)
135 cs = self.__get_cs_or_redirect(post_revision, repo_name)
@@ -407,13 +408,17 b' class FilesController(BaseRepoController'
407 def diff(self, repo_name, f_path):
408 def diff(self, repo_name, f_path):
408 ignore_whitespace = request.GET.get('ignorews') == '1'
409 ignore_whitespace = request.GET.get('ignorews') == '1'
409 line_context = request.GET.get('context', 3)
410 line_context = request.GET.get('context', 3)
410 diff1 = request.GET.get('diff1')
411 diff1 = request.GET.get('diff1', '')
411 diff2 = request.GET.get('diff2')
412 diff2 = request.GET.get('diff2', '')
412 c.action = request.GET.get('diff')
413 c.action = request.GET.get('diff')
413 c.no_changes = diff1 == diff2
414 c.no_changes = diff1 == diff2
414 c.f_path = f_path
415 c.f_path = f_path
415 c.big_diff = False
416 c.big_diff = False
416
417 c.anchor_url = anchor_url
418 c.ignorews_url = _ignorews_url
419 c.context_url = _context_url
420 c.changes = OrderedDict()
421 c.changes[diff2] = []
417 try:
422 try:
418 if diff1 not in ['', None, 'None', '0' * 12, '0' * 40]:
423 if diff1 not in ['', None, 'None', '0' * 12, '0' * 40]:
419 c.changeset_1 = c.rhodecode_repo.get_changeset(diff1)
424 c.changeset_1 = c.rhodecode_repo.get_changeset(diff1)
@@ -429,8 +434,8 b' class FilesController(BaseRepoController'
429 c.changeset_2 = EmptyChangeset(repo=c.rhodecode_repo)
434 c.changeset_2 = EmptyChangeset(repo=c.rhodecode_repo)
430 node2 = FileNode('.', '', changeset=c.changeset_2)
435 node2 = FileNode('.', '', changeset=c.changeset_2)
431 except RepositoryError:
436 except RepositoryError:
432 return redirect(url('files_home',
437 return redirect(url('files_home', repo_name=c.repo_name,
433 repo_name=c.repo_name, f_path=f_path))
438 f_path=f_path))
434
439
435 if c.action == 'download':
440 if c.action == 'download':
436 _diff = diffs.get_gitdiff(node1, node2,
441 _diff = diffs.get_gitdiff(node1, node2,
@@ -452,38 +457,21 b' class FilesController(BaseRepoController'
452 response.content_type = 'text/plain'
457 response.content_type = 'text/plain'
453 return diff.raw_diff()
458 return diff.raw_diff()
454
459
455 elif c.action == 'diff':
456 if node1.is_binary or node2.is_binary:
457 c.cur_diff = _('Binary file')
458 elif node1.size > self.cut_off_limit or \
459 node2.size > self.cut_off_limit:
460 c.cur_diff = ''
461 c.big_diff = True
462 else:
460 else:
463 _diff = diffs.get_gitdiff(node1, node2,
461 fid = h.FID(diff2, node2.path)
464 ignore_whitespace=ignore_whitespace,
462 line_context_lcl = get_line_ctx(fid, request.GET)
465 context=line_context)
463 ign_whitespace_lcl = get_ignore_ws(fid, request.GET)
466 diff = diffs.DiffProcessor(_diff,format='gitdiff')
467 c.cur_diff = diff.as_html()
468 else:
469
464
470 #default option
465 lim = request.GET.get('fulldiff') or self.cut_off_limit
471 if node1.is_binary or node2.is_binary:
466 _, cs1, cs2, diff, st = wrapped_diff(filenode_old=node1,
472 c.cur_diff = _('Binary file')
467 filenode_new=node2,
473 elif node1.size > self.cut_off_limit or \
468 cut_off_limit=lim,
474 node2.size > self.cut_off_limit:
469 ignore_whitespace=ign_whitespace_lcl,
475 c.cur_diff = ''
470 line_context=line_context_lcl,
476 c.big_diff = True
471 enable_comments=False)
477
472
478 else:
473 c.changes = [('', node2, diff, cs1, cs2, st,)]
479 _diff = diffs.get_gitdiff(node1, node2,
480 ignore_whitespace=ignore_whitespace,
481 context=line_context)
482 diff = diffs.DiffProcessor(_diff,format='gitdiff')
483 c.cur_diff = diff.as_html()
484
474
485 if not c.cur_diff and not c.big_diff:
486 c.no_changes = True
487 return render('files/file_diff.html')
475 return render('files/file_diff.html')
488
476
489 def _get_node_history(self, cs, f_path):
477 def _get_node_history(self, cs, f_path):
@@ -501,12 +489,10 b' class FilesController(BaseRepoController'
501 hist_l.append(changesets_group)
489 hist_l.append(changesets_group)
502
490
503 for name, chs in c.rhodecode_repo.branches.items():
491 for name, chs in c.rhodecode_repo.branches.items():
504 #chs = chs.split(':')[-1]
505 branches_group[0].append((chs, name),)
492 branches_group[0].append((chs, name),)
506 hist_l.append(branches_group)
493 hist_l.append(branches_group)
507
494
508 for name, chs in c.rhodecode_repo.tags.items():
495 for name, chs in c.rhodecode_repo.tags.items():
509 #chs = chs.split(':')[-1]
510 tags_group[0].append((chs, name),)
496 tags_group[0].append((chs, name),)
511 hist_l.append(tags_group)
497 hist_l.append(tags_group)
512
498
@@ -27,12 +27,66 b''
27
27
28 import re
28 import re
29 import difflib
29 import difflib
30 import markupsafe
31 from itertools import tee, imap
30
32
31 from itertools import tee, imap
33 from pylons.i18n.translation import _
32
34
33 from vcs.exceptions import VCSError
35 from vcs.exceptions import VCSError
34 from vcs.nodes import FileNode
36 from vcs.nodes import FileNode
35 import markupsafe
37
38 from rhodecode.lib.utils import EmptyChangeset
39
40
41 def wrap_to_table(str_):
42 return '''<table class="code-difftable">
43 <tr class="line no-comment">
44 <td class="lineno new"></td>
45 <td class="code no-comment"><pre>%s</pre></td>
46 </tr>
47 </table>''' % str_
48
49
50 def wrapped_diff(filenode_old, filenode_new, cut_off_limit=None,
51 ignore_whitespace=True, line_context=3,
52 enable_comments=False):
53 """
54 returns a wrapped diff into a table, checks for cut_off_limit and presents
55 proper message
56 """
57
58 if filenode_old is None:
59 filenode_old = FileNode(filenode_new.path, '', EmptyChangeset())
60
61 if filenode_old.is_binary or filenode_new.is_binary:
62 diff = wrap_to_table(_('binary file'))
63 stats = (0, 0)
64 size = 0
65
66 elif cut_off_limit != -1 and (cut_off_limit is None or
67 (filenode_old.size < cut_off_limit and filenode_new.size < cut_off_limit)):
68
69 f_gitdiff = get_gitdiff(filenode_old, filenode_new,
70 ignore_whitespace=ignore_whitespace,
71 context=line_context)
72 diff_processor = DiffProcessor(f_gitdiff, format='gitdiff')
73
74 diff = diff_processor.as_html(enable_comments=enable_comments)
75 stats = diff_processor.stat()
76 size = len(diff or '')
77 else:
78 diff = wrap_to_table(_('Changeset was to big and was cut off, use '
79 'diff menu to display this diff'))
80 stats = (0, 0)
81 size = 0
82
83 if not diff:
84 diff = wrap_to_table(_('No changes detected'))
85
86 cs1 = filenode_old.last_changeset.raw_id
87 cs2 = filenode_new.last_changeset.raw_id
88
89 return size, cs1, cs2, diff, stats
36
90
37
91
38 def get_gitdiff(filenode_old, filenode_new, ignore_whitespace=True, context=3):
92 def get_gitdiff(filenode_old, filenode_new, ignore_whitespace=True, context=3):
@@ -371,34 +425,40 b' class DiffProcessor(object):'
371 """
425 """
372
426
373 if condition:
427 if condition:
374 return '''<a href="%(url)s">%(label)s</a>''' % {'url': url,
428 return '''<a href="%(url)s">%(label)s</a>''' % {
375 'label': label}
429 'url': url,
430 'label': label
431 }
376 else:
432 else:
377 return label
433 return label
378 diff_lines = self.prepare()
434 diff_lines = self.prepare()
379 _html_empty = True
435 _html_empty = True
380 _html = []
436 _html = []
381 _html.append('''<table class="%(table_class)s">\n''' \
437 _html.append('''<table class="%(table_class)s">\n''' % {
382 % {'table_class': table_class})
438 'table_class': table_class
439 })
383 for diff in diff_lines:
440 for diff in diff_lines:
384 for line in diff['chunks']:
441 for line in diff['chunks']:
385 _html_empty = False
442 _html_empty = False
386 for change in line:
443 for change in line:
387 _html.append('''<tr class="%(line_class)s %(action)s">\n''' \
444 _html.append('''<tr class="%(lc)s %(action)s">\n''' % {
388 % {'line_class': line_class,
445 'lc': line_class,
389 'action': change['action']})
446 'action': change['action']
447 })
390 anchor_old_id = ''
448 anchor_old_id = ''
391 anchor_new_id = ''
449 anchor_new_id = ''
392 anchor_old = "%(filename)s_o%(oldline_no)s" % \
450 anchor_old = "%(filename)s_o%(oldline_no)s" % {
393 {'filename': self._safe_id(diff['filename']),
451 'filename': self._safe_id(diff['filename']),
394 'oldline_no': change['old_lineno']}
452 'oldline_no': change['old_lineno']
395 anchor_new = "%(filename)s_n%(oldline_no)s" % \
453 }
396 {'filename': self._safe_id(diff['filename']),
454 anchor_new = "%(filename)s_n%(oldline_no)s" % {
397 'oldline_no': change['new_lineno']}
455 'filename': self._safe_id(diff['filename']),
398 cond_old = change['old_lineno'] != '...' and \
456 'oldline_no': change['new_lineno']
399 change['old_lineno']
457 }
400 cond_new = change['new_lineno'] != '...' and \
458 cond_old = (change['old_lineno'] != '...' and
401 change['new_lineno']
459 change['old_lineno'])
460 cond_new = (change['new_lineno'] != '...' and
461 change['new_lineno'])
402 if cond_old:
462 if cond_old:
403 anchor_old_id = 'id="%s"' % anchor_old
463 anchor_old_id = 'id="%s"' % anchor_old
404 if cond_new:
464 if cond_new:
@@ -406,37 +466,41 b' class DiffProcessor(object):'
406 ###########################################################
466 ###########################################################
407 # OLD LINE NUMBER
467 # OLD LINE NUMBER
408 ###########################################################
468 ###########################################################
409 _html.append('''\t<td %(a_id)s class="%(old_lineno_cls)s">''' \
469 _html.append('''\t<td %(a_id)s class="%(olc)s">''' % {
410 % {'a_id': anchor_old_id,
470 'a_id': anchor_old_id,
411 'old_lineno_cls': old_lineno_class})
471 'olc': old_lineno_class
472 })
412
473
413 _html.append('''%(link)s''' \
474 _html.append('''%(link)s''' % {
414 % {'link':
475 'link': _link_to_if(True, change['old_lineno'],
415 _link_to_if(cond_old, change['old_lineno'], '#%s' \
476 '#%s' % anchor_old)
416 % anchor_old)})
477 })
417 _html.append('''</td>\n''')
478 _html.append('''</td>\n''')
418 ###########################################################
479 ###########################################################
419 # NEW LINE NUMBER
480 # NEW LINE NUMBER
420 ###########################################################
481 ###########################################################
421
482
422 _html.append('''\t<td %(a_id)s class="%(new_lineno_cls)s">''' \
483 _html.append('''\t<td %(a_id)s class="%(nlc)s">''' % {
423 % {'a_id': anchor_new_id,
484 'a_id': anchor_new_id,
424 'new_lineno_cls': new_lineno_class})
485 'nlc': new_lineno_class
486 })
425
487
426 _html.append('''%(link)s''' \
488 _html.append('''%(link)s''' % {
427 % {'link':
489 'link': _link_to_if(True, change['new_lineno'],
428 _link_to_if(cond_new, change['new_lineno'], '#%s' \
490 '#%s' % anchor_new)
429 % anchor_new)})
491 })
430 _html.append('''</td>\n''')
492 _html.append('''</td>\n''')
431 ###########################################################
493 ###########################################################
432 # CODE
494 # CODE
433 ###########################################################
495 ###########################################################
434 comments = '' if enable_comments else 'no-comment'
496 comments = '' if enable_comments else 'no-comment'
435 _html.append('''\t<td class="%(code_class)s %(in-comments)s">''' \
497 _html.append('''\t<td class="%(cc)s %(inc)s">''' % {
436 % {'code_class': code_class,
498 'cc': code_class,
437 'in-comments': comments})
499 'inc': comments
438 _html.append('''\n\t\t<pre>%(code)s</pre>\n''' \
500 })
439 % {'code': change['line']})
501 _html.append('''\n\t\t<pre>%(code)s</pre>\n''' % {
502 'code': change['line']
503 })
440 _html.append('''\t</td>''')
504 _html.append('''\t</td>''')
441 _html.append('''\n</tr>\n''')
505 _html.append('''\n</tr>\n''')
442 _html.append('''</table>''')
506 _html.append('''</table>''')
@@ -40,6 +40,7 b' from rhodecode.lib.utils import repo_nam'
40 from rhodecode.lib import str2bool, safe_unicode, safe_str, get_changeset_safe
40 from rhodecode.lib import str2bool, safe_unicode, safe_str, get_changeset_safe
41 from rhodecode.lib.markup_renderer import MarkupRenderer
41 from rhodecode.lib.markup_renderer import MarkupRenderer
42
42
43
43 def _reset(name, value=None, id=NotGiven, type="reset", **attrs):
44 def _reset(name, value=None, id=NotGiven, type="reset", **attrs):
44 """
45 """
45 Reset button
46 Reset button
@@ -122,7 +122,6 b' class ChangesetCommentsModel(BaseModel):'
122
122
123 return comment
123 return comment
124
124
125
126 def get_comments(self, repo_id, revision):
125 def get_comments(self, repo_id, revision):
127 return ChangesetComment.query()\
126 return ChangesetComment.query()\
128 .filter(ChangesetComment.repo_id == repo_id)\
127 .filter(ChangesetComment.repo_id == repo_id)\
@@ -19,7 +19,7 b''
19 <img class="diff-menu-activate" style="margin-bottom:-6px;cursor: pointer" alt="diff-menu" src="${h.url('/images/icons/script_gear.png')}" />
19 <img class="diff-menu-activate" style="margin-bottom:-6px;cursor: pointer" alt="diff-menu" src="${h.url('/images/icons/script_gear.png')}" />
20 <div class="diff-menu" style="display:none">
20 <div class="diff-menu" style="display:none">
21 <ul>
21 <ul>
22 <li>${h.link_to(_('diff'),h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode.path),diff2=cs2,diff1=cs1,diff='diff'))}</li>
22 <li>${h.link_to(_('diff'),h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode.path),diff2=cs2,diff1=cs1,diff='diff',fulldiff=1))}</li>
23 <li>${h.link_to(_('raw diff'),h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode.path),diff2=cs2,diff1=cs1,diff='raw'))}</li>
23 <li>${h.link_to(_('raw diff'),h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode.path),diff2=cs2,diff1=cs1,diff='raw'))}</li>
24 <li>${h.link_to(_('download diff'),h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode.path),diff2=cs2,diff1=cs1,diff='download'))}</li>
24 <li>${h.link_to(_('download diff'),h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode.path),diff2=cs2,diff1=cs1,diff='download'))}</li>
25 <li>${c.ignorews_url(h.FID(filenode.changeset.raw_id,filenode.path))}</li>
25 <li>${c.ignorews_url(h.FID(filenode.changeset.raw_id,filenode.path))}</li>
@@ -37,11 +37,7 b''
37 </div>
37 </div>
38 <div class="code-body">
38 <div class="code-body">
39 <div class="full_f_path" path="${h.safe_unicode(filenode.path)}"></div>
39 <div class="full_f_path" path="${h.safe_unicode(filenode.path)}"></div>
40 %if diff:
41 ${diff|n}
40 ${diff|n}
42 %else:
43 ${_('No changes in this file')}
44 %endif
45 </div>
41 </div>
46 </div>
42 </div>
47 %endif
43 %endif
@@ -21,33 +21,29 b''
21 <div class="title">
21 <div class="title">
22 ${self.breadcrumbs()}
22 ${self.breadcrumbs()}
23 </div>
23 </div>
24 <div class="table">
24 <div>
25 <div id="body" class="diffblock">
25 ## diff block
26 <div class="code-header">
26 <%namespace name="diff_block" file="/changeset/diff_block.html"/>
27 <div class="changeset_header">
27 ${diff_block.diff_block(c.changes)}
28 <span class="changeset_file">${h.link_to(c.f_path,h.url('files_home',repo_name=c.repo_name,
29 revision=c.changeset_2.raw_id,f_path=c.f_path))}</span>
30 &raquo; <span>${h.link_to(_('diff'),
31 h.url.current(diff2=c.changeset_2.raw_id,diff1=c.changeset_1.raw_id,diff='diff'))}</span>
32 &raquo; <span>${h.link_to(_('raw diff'),
33 h.url.current(diff2=c.changeset_2.raw_id,diff1=c.changeset_1.raw_id,diff='raw'))}</span>
34 &raquo; <span>${h.link_to(_('download diff'),
35 h.url.current(diff2=c.changeset_2.raw_id,diff1=c.changeset_1.raw_id,diff='download'))}</span>
36 </div>
28 </div>
37 </div>
29 </div>
38 <div class="code-body">
30 <script>
39 %if c.no_changes:
31 YUE.onDOMReady(function(){
40 ${_('No changes')}
32
41 %elif c.big_diff:
33 YUE.on(YUQ('.diff-menu-activate'),'click',function(e){
42 ${_('Diff is to big to display')} ${h.link_to(_('raw diff'),
34 var act = e.currentTarget.nextElementSibling;
43 h.url.current(diff2=c.changeset_2.raw_id,diff1=c.changeset_1.raw_id,diff='raw'))}
35
44 %else:
36 if(YUD.hasClass(act,'active')){
45 ${c.cur_diff|n}
37 YUD.removeClass(act,'active');
46 %endif
38 YUD.setStyle(act,'display','none');
47 </div>
39 }else{
48 </div>
40 YUD.addClass(act,'active');
49 </div>
41 YUD.setStyle(act,'display','');
50 </div>
42 }
43 });
44
45 })
46 </script>
51 </%def>
47 </%def>
52
48
53 No newline at end of file
49
@@ -59,7 +59,7 b''
59 <div class="commit">${_('Editing file')}: ${c.file.path}</div>
59 <div class="commit">${_('Editing file')}: ${c.file.path}</div>
60 </div>
60 </div>
61 <pre id="editor_pre"></pre>
61 <pre id="editor_pre"></pre>
62 <textarea id="editor" name="content" style="display:none">${c.file.content|n}</textarea>
62 <textarea id="editor" name="content" style="display:none">${h.escape(c.file.content)|n}</textarea>
63 <div style="padding: 10px;color:#666666">${_('commit message')}</div>
63 <div style="padding: 10px;color:#666666">${_('commit message')}</div>
64 <textarea id="commit" name="message" style="height: 60px;width: 99%;margin-left:4px"></textarea>
64 <textarea id="commit" name="message" style="height: 60px;width: 99%;margin-left:4px"></textarea>
65 </div>
65 </div>
@@ -12,7 +12,6 b''
12 </dd>
12 </dd>
13 </dl>
13 </dl>
14
14
15
16 <div id="body" class="codeblock">
15 <div id="body" class="codeblock">
17 <div class="code-header">
16 <div class="code-header">
18 <div class="stats">
17 <div class="stats">
General Comments 0
You need to be logged in to leave comments. Login now