Show More
@@ -1,7 +1,7 b'' | |||
|
1 | 1 | <%namespace name="commentblock" file="/changeset/changeset_file_comment.mako"/> |
|
2 | 2 | |
|
3 | <%def name="diff_line_anchor(filename, line, type)"><% | |
|
4 |
return '%s_%s_%i' % (h.safe |
|
|
3 | <%def name="diff_line_anchor(commit, filename, line, type)"><% | |
|
4 | return '%s_%s_%i' % (h.md5_safe(commit+filename), type, line) | |
|
5 | 5 | %></%def> |
|
6 | 6 | |
|
7 | 7 | <%def name="action_class(action)"> |
@@ -174,7 +174,7 b' collapse_all = len(diffset.files) > coll' | |||
|
174 | 174 | ## new/deleted/empty content case |
|
175 | 175 | % if not filediff.hunks: |
|
176 | 176 | ## Comment container, on "fakes" hunk that contains all data to render comments |
|
177 | ${render_hunk_lines(c.user_session_attrs["diffmode"], filediff.hunk_ops, use_comments=use_comments, inline_comments=inline_comments)} | |
|
177 | ${render_hunk_lines(filediff, c.user_session_attrs["diffmode"], filediff.hunk_ops, use_comments=use_comments, inline_comments=inline_comments)} | |
|
178 | 178 | % endif |
|
179 | 179 | |
|
180 | 180 | %if filediff.limited_diff: |
@@ -214,7 +214,7 b' collapse_all = len(diffset.files) > coll' | |||
|
214 | 214 | ${hunk.section_header} |
|
215 | 215 | </td> |
|
216 | 216 | </tr> |
|
217 | ${render_hunk_lines(c.user_session_attrs["diffmode"], hunk, use_comments=use_comments, inline_comments=inline_comments)} | |
|
217 | ${render_hunk_lines(filediff, c.user_session_attrs["diffmode"], hunk, use_comments=use_comments, inline_comments=inline_comments)} | |
|
218 | 218 | % endfor |
|
219 | 219 | |
|
220 | 220 | <% unmatched_comments = (inline_comments or {}).get(filediff.patch['filename'], {}) %> |
@@ -549,15 +549,15 b' def get_comments_for(diff_type, comments' | |||
|
549 | 549 | return data |
|
550 | 550 | %> |
|
551 | 551 | |
|
552 | <%def name="render_hunk_lines_sideside(hunk, use_comments=False, inline_comments=None)"> | |
|
553 | ||
|
552 | <%def name="render_hunk_lines_sideside(filediff, hunk, use_comments=False, inline_comments=None)"> | |
|
554 | 553 | %for i, line in enumerate(hunk.sideside): |
|
555 | 554 | <% |
|
556 | 555 | old_line_anchor, new_line_anchor = None, None |
|
556 | ||
|
557 | 557 | if line.original.lineno: |
|
558 | old_line_anchor = diff_line_anchor(hunk.source_file_path, line.original.lineno, 'o') | |
|
558 | old_line_anchor = diff_line_anchor(filediff.raw_id, hunk.source_file_path, line.original.lineno, 'o') | |
|
559 | 559 | if line.modified.lineno: |
|
560 | new_line_anchor = diff_line_anchor(hunk.target_file_path, line.modified.lineno, 'n') | |
|
560 | new_line_anchor = diff_line_anchor(filediff.raw_id, hunk.target_file_path, line.modified.lineno, 'n') | |
|
561 | 561 | %> |
|
562 | 562 | |
|
563 | 563 | <tr class="cb-line"> |
@@ -649,14 +649,15 b' def get_comments_for(diff_type, comments' | |||
|
649 | 649 | </%def> |
|
650 | 650 | |
|
651 | 651 | |
|
652 | <%def name="render_hunk_lines_unified(hunk, use_comments=False, inline_comments=None)"> | |
|
652 | <%def name="render_hunk_lines_unified(filediff, hunk, use_comments=False, inline_comments=None)"> | |
|
653 | 653 | %for old_line_no, new_line_no, action, content, comments_args in hunk.unified: |
|
654 | ||
|
654 | 655 | <% |
|
655 | 656 | old_line_anchor, new_line_anchor = None, None |
|
656 | 657 | if old_line_no: |
|
657 | old_line_anchor = diff_line_anchor(hunk.source_file_path, old_line_no, 'o') | |
|
658 | old_line_anchor = diff_line_anchor(filediff.raw_id, hunk.source_file_path, old_line_no, 'o') | |
|
658 | 659 | if new_line_no: |
|
659 | new_line_anchor = diff_line_anchor(hunk.target_file_path, new_line_no, 'n') | |
|
660 | new_line_anchor = diff_line_anchor(filediff.raw_id, hunk.target_file_path, new_line_no, 'n') | |
|
660 | 661 | %> |
|
661 | 662 | <tr class="cb-line"> |
|
662 | 663 | <td class="cb-data ${action_class(action)}"> |
@@ -714,11 +715,11 b' def get_comments_for(diff_type, comments' | |||
|
714 | 715 | </%def> |
|
715 | 716 | |
|
716 | 717 | |
|
717 | <%def name="render_hunk_lines(diff_mode, hunk, use_comments, inline_comments)"> | |
|
718 | <%def name="render_hunk_lines(filediff, diff_mode, hunk, use_comments, inline_comments)"> | |
|
718 | 719 | % if diff_mode == 'unified': |
|
719 | ${render_hunk_lines_unified(hunk, use_comments=use_comments, inline_comments=inline_comments)} | |
|
720 | ${render_hunk_lines_unified(filediff, hunk, use_comments=use_comments, inline_comments=inline_comments)} | |
|
720 | 721 | % elif diff_mode == 'sideside': |
|
721 | ${render_hunk_lines_sideside(hunk, use_comments=use_comments, inline_comments=inline_comments)} | |
|
722 | ${render_hunk_lines_sideside(filediff, hunk, use_comments=use_comments, inline_comments=inline_comments)} | |
|
722 | 723 | % else: |
|
723 | 724 | <tr class="cb-line"> |
|
724 | 725 | <td>unknown diff mode</td> |
General Comments 0
You need to be logged in to leave comments.
Login now