%def name="diff_line_anchor(filename, line, type)"><%
return '%s_%s_%i' % (h.safeid(filename), type, line)
%>%def>
<%def name="action_class(action)"><%
return {
'-': 'cb-deletion',
'+': 'cb-addition',
' ': 'cb-context',
}.get(action, 'cb-empty')
%>%def>
<%def name="op_class(op_id)"><%
return {
DEL_FILENODE: 'deletion', # file deleted
BIN_FILENODE: 'warning' # binary diff hidden
}.get(op_id, 'addition')
%>%def>
<%def name="link_for(**kw)"><%
new_args = request.GET.mixed()
new_args.update(kw)
return h.url('', **new_args)
%>%def>
<%def name="render_diffset(diffset, commit=None,
# collapse all file diff entries when there are more than this amount of files in the diff
collapse_when_files_over=20,
# collapse lines in the diff when more than this amount of lines changed in the file diff
lines_changed_limit=500,
# add a ruler at to the output
ruler_at_chars=0,
# show inline comments
use_comments=False,
# disable new comments
disable_new_comments=False,
# special file-comments that were deleted in previous versions
# it's used for showing outdated comments for deleted files in a PR
deleted_files_comments=None
)">
%if use_comments:
${(_('Comments parsed using %s syntax with %s support.') % (
('%s' % (h.url('%s_help' % c.visual.default_renderer), c.visual.default_renderer.upper())),
('@mention' % _('Use @username inside this text to send notification to this RhodeCode user'))
)
)|n
}
%endif
%endfor
## outdated comments that do not fit into currently displayed lines
% for lineno, comments in filediff.left_comments.items():
%if c.diffmode == 'unified':
${inline_comments_container(comments)}
%elif c.diffmode == 'sideside':
${inline_comments_container(comments)}
%endif
% endfor
%endfor
## outdated comments that are made for a file that has been deleted
% for filename, comments_dict in (deleted_files_comments or {}).items():
% if c.diffmode == 'unified':
%endif
${_('File was deleted in this version, and outdated comments were made on it')}
%for comment in comments:
${commentblock.comment_block(comment, inline=True)}
%endfor
% if comments and comments[-1].outdated:
${_('Add another comment')}
% else:
${_('Add another comment')}
% endif
%def>
<%def name="render_hunk_lines_sideside(hunk, use_comments=False)">
%for i, line in enumerate(hunk.sideside):
<%
old_line_anchor, new_line_anchor = None, None
if line.original.lineno:
old_line_anchor = diff_line_anchor(hunk.filediff.source_file_path, line.original.lineno, 'o')
if line.modified.lineno:
new_line_anchor = diff_line_anchor(hunk.filediff.target_file_path, line.modified.lineno, 'n')
%>
%if use_comments and line.original.lineno:
${render_add_comment_button()}
%endif
${line.original.action} ${line.original.content or '' | n}
%if use_comments and line.original.lineno and line.original.comments:
${inline_comments_container(line.original.comments)}
%endif
%if use_comments and line.modified.lineno:
${render_add_comment_button()}
%endif
${line.modified.action} ${line.modified.content or '' | n}
%if use_comments and line.modified.lineno and line.modified.comments:
${inline_comments_container(line.modified.comments)}
%endif