Show More
@@ -378,9 +378,8 b' class DiffSet(object):' | |||
|
378 | 378 | source_node_getter=lambda filename: None, |
|
379 | 379 | target_node_getter=lambda filename: None, |
|
380 | 380 | source_nodes=None, target_nodes=None, |
|
381 |
|
|
|
382 | # use fast highlighting | |
|
383 | comments=None, | |
|
381 | # files over this size will use fast highlighting | |
|
382 | max_file_size_limit=150 * 1024, | |
|
384 | 383 | ): |
|
385 | 384 | |
|
386 | 385 | self.highlight_mode = highlight_mode |
@@ -391,8 +390,6 b' class DiffSet(object):' | |||
|
391 | 390 | self.target_nodes = target_nodes or {} |
|
392 | 391 | self.repo_name = repo_name |
|
393 | 392 | self.source_repo_name = source_repo_name or repo_name |
|
394 | self.comments = comments or {} | |
|
395 | self.comments_store = self.comments.copy() | |
|
396 | 393 | self.max_file_size_limit = max_file_size_limit |
|
397 | 394 | |
|
398 | 395 | def render_patchset(self, patchset, source_ref=None, target_ref=None): |
@@ -518,20 +515,6 b' class DiffSet(object):' | |||
|
518 | 515 | hunkbit.target_file_path = target_file_path |
|
519 | 516 | filediff.hunks.append(hunkbit) |
|
520 | 517 | |
|
521 | left_comments = {} | |
|
522 | if source_file_path in self.comments_store: | |
|
523 | for lineno, comments in self.comments_store[source_file_path].items(): | |
|
524 | left_comments[lineno] = comments | |
|
525 | ||
|
526 | if target_file_path in self.comments_store: | |
|
527 | for lineno, comments in self.comments_store[target_file_path].items(): | |
|
528 | left_comments[lineno] = comments | |
|
529 | ||
|
530 | # left comments are one that we couldn't place in diff lines. | |
|
531 | # could be outdated, or the diff changed and this line is no | |
|
532 | # longer available | |
|
533 | filediff.left_comments = left_comments | |
|
534 | ||
|
535 | 518 | return filediff |
|
536 | 519 | |
|
537 | 520 | def parse_hunk(self, hunk, source_file, target_file): |
@@ -28,7 +28,7 b'' | |||
|
28 | 28 | |
|
29 | 29 | <div class="meta"> |
|
30 | 30 | <div class="comment-type-label"> |
|
31 | <div class="comment-label ${comment.comment_type or 'note'}" id="comment-label-${comment.comment_id}"> | |
|
31 | <div class="comment-label ${comment.comment_type or 'note'}" id="comment-label-${comment.comment_id}" title="line: ${comment.line_no}"> | |
|
32 | 32 | % if comment.comment_type == 'todo': |
|
33 | 33 | % if comment.resolved: |
|
34 | 34 | <div class="resolved tooltip" title="${_('Resolved by comment #{}').format(comment.resolved.comment_id)}"> |
@@ -223,10 +223,22 b' collapse_all = len(diffset.files) > coll' | |||
|
223 | 223 | %endif |
|
224 | 224 | %endfor |
|
225 | 225 |
|
|
226 | <% unmatched_comments = (inline_comments or {}).get(filediff.patch['filename'], {}) %> | |
|
227 | ||
|
226 | 228 | ## outdated comments that do not fit into currently displayed lines |
|
227 |
% for lineno, comments in |
|
|
229 | % for lineno, comments in unmatched_comments.items(): | |
|
228 | 230 | |
|
229 | 231 | %if c.diffmode == 'unified': |
|
232 | % if loop.index == 0: | |
|
233 | <tr class="cb-hunk"> | |
|
234 | <td colspan="3"></td> | |
|
235 | <td> | |
|
236 | <div> | |
|
237 | ${_('Unmatched inline comments below')} | |
|
238 | </div> | |
|
239 | </td> | |
|
240 | </tr> | |
|
241 | % endif | |
|
230 | 242 | <tr class="cb-line"> |
|
231 | 243 | <td class="cb-data cb-context"></td> |
|
232 | 244 | <td class="cb-lineno cb-context"></td> |
@@ -236,6 +248,16 b' collapse_all = len(diffset.files) > coll' | |||
|
236 | 248 | </td> |
|
237 | 249 | </tr> |
|
238 | 250 | %elif c.diffmode == 'sideside': |
|
251 | % if loop.index == 0: | |
|
252 | <tr class="cb-hunk"> | |
|
253 | <td colspan="2"></td> | |
|
254 | <td class="cb-line" colspan="6"> | |
|
255 | <div> | |
|
256 | ${_('Unmatched comments below')} | |
|
257 | </div> | |
|
258 | </td> | |
|
259 | </tr> | |
|
260 | % endif | |
|
239 | 261 | <tr class="cb-line"> |
|
240 | 262 | <td class="cb-data cb-context"></td> |
|
241 | 263 | <td class="cb-lineno cb-context"></td> |
@@ -512,18 +534,20 b' from rhodecode.lib.diffs import NEW_FILE' | |||
|
512 | 534 | </%def> |
|
513 | 535 | |
|
514 | 536 | <%! |
|
515 | def get_comments_for(comments, filename, line_version, line_number): | |
|
537 | def get_comments_for(diff_type, comments, filename, line_version, line_number): | |
|
516 | 538 | if hasattr(filename, 'unicode_path'): |
|
517 | 539 | filename = filename.unicode_path |
|
518 | 540 | |
|
519 | 541 | if not isinstance(filename, basestring): |
|
520 | 542 | return None |
|
521 | 543 | |
|
522 | line_key = '{}{}'.format(line_version, line_number) | |
|
544 | line_key = '{}{}'.format(line_version, line_number) ## e.g o37, n12 | |
|
545 | ||
|
523 | 546 | if comments and filename in comments: |
|
524 | 547 | file_comments = comments[filename] |
|
525 | 548 | if line_key in file_comments: |
|
526 |
|
|
|
549 | data = file_comments.pop(line_key) | |
|
550 | return data | |
|
527 | 551 | %> |
|
528 | 552 | |
|
529 | 553 | <%def name="render_hunk_lines_sideside(hunk, use_comments=False, inline_comments=None)"> |
@@ -542,16 +566,17 b' def get_comments_for(comments, filename,' | |||
|
542 | 566 | data-line-no="${line.original.lineno}" |
|
543 | 567 | > |
|
544 | 568 | <div> |
|
545 | <% loc = None %> | |
|
569 | ||
|
570 | <% line_old_comments = None %> | |
|
546 | 571 | %if line.original.get_comment_args: |
|
547 | <% loc = get_comments_for(inline_comments, *line.original.get_comment_args) %> | |
|
572 | <% line_old_comments = get_comments_for('side-by-side', inline_comments, *line.original.get_comment_args) %> | |
|
548 | 573 | %endif |
|
549 | %if loc: | |
|
550 | <% has_outdated = any([x.outdated for x in loc]) %> | |
|
574 | %if line_old_comments: | |
|
575 | <% has_outdated = any([x.outdated for x in line_old_comments]) %> | |
|
551 | 576 | % if has_outdated: |
|
552 | <i title="${_('comments including outdated')}:${len(loc)}" class="icon-comment_toggle" onclick="return Rhodecode.comments.toggleLineComments(this)"></i> | |
|
577 | <i title="${_('comments including outdated')}:${len(line_old_comments)}" class="icon-comment_toggle" onclick="return Rhodecode.comments.toggleLineComments(this)"></i> | |
|
553 | 578 | % else: |
|
554 | <i title="${_('comments')}: ${len(loc)}" class="icon-comment" onclick="return Rhodecode.comments.toggleLineComments(this)"></i> | |
|
579 | <i title="${_('comments')}: ${len(line_old_comments)}" class="icon-comment" onclick="return Rhodecode.comments.toggleLineComments(this)"></i> | |
|
555 | 580 | % endif |
|
556 | 581 | %endif |
|
557 | 582 | </div> |
@@ -574,8 +599,8 b' def get_comments_for(comments, filename,' | |||
|
574 | 599 | %endif |
|
575 | 600 | <span class="cb-code">${line.original.action} ${line.original.content or '' | n}</span> |
|
576 | 601 | |
|
577 | %if use_comments and line.original.lineno and loc: | |
|
578 | ${inline_comments_container(loc, inline_comments)} | |
|
602 | %if use_comments and line.original.lineno and line_old_comments: | |
|
603 | ${inline_comments_container(line_old_comments, inline_comments)} | |
|
579 | 604 | %endif |
|
580 | 605 | |
|
581 | 606 | </td> |
@@ -585,16 +610,16 b' def get_comments_for(comments, filename,' | |||
|
585 | 610 | <div> |
|
586 | 611 | |
|
587 | 612 | %if line.modified.get_comment_args: |
|
588 |
<% l |
|
|
613 | <% line_new_comments = get_comments_for('side-by-side', inline_comments, *line.modified.get_comment_args) %> | |
|
589 | 614 | %else: |
|
590 |
<% l |
|
|
615 | <% line_new_comments = None%> | |
|
591 | 616 | %endif |
|
592 |
%if l |
|
|
593 |
<% has_outdated = any([x.outdated for x in l |
|
|
617 | %if line_new_comments: | |
|
618 | <% has_outdated = any([x.outdated for x in line_new_comments]) %> | |
|
594 | 619 | % if has_outdated: |
|
595 |
<i title="${_('comments including outdated')}:${len(l |
|
|
620 | <i title="${_('comments including outdated')}:${len(line_new_comments)}" class="icon-comment_toggle" onclick="return Rhodecode.comments.toggleLineComments(this)"></i> | |
|
596 | 621 | % else: |
|
597 |
<i title="${_('comments')}: ${len(l |
|
|
622 | <i title="${_('comments')}: ${len(line_new_comments)}" class="icon-comment" onclick="return Rhodecode.comments.toggleLineComments(this)"></i> | |
|
598 | 623 | % endif |
|
599 | 624 | %endif |
|
600 | 625 | </div> |
@@ -616,8 +641,8 b' def get_comments_for(comments, filename,' | |||
|
616 | 641 | ${render_add_comment_button()} |
|
617 | 642 | %endif |
|
618 | 643 | <span class="cb-code">${line.modified.action} ${line.modified.content or '' | n}</span> |
|
619 |
%if use_comments and line.modified.lineno and l |
|
|
620 |
${inline_comments_container(l |
|
|
644 | %if use_comments and line.modified.lineno and line_new_comments: | |
|
645 | ${inline_comments_container(line_new_comments, inline_comments)} | |
|
621 | 646 | %endif |
|
622 | 647 | </td> |
|
623 | 648 | </tr> |
@@ -639,7 +664,7 b' def get_comments_for(comments, filename,' | |||
|
639 | 664 | <div> |
|
640 | 665 | |
|
641 | 666 | %if comments_args: |
|
642 | <% comments = get_comments_for(inline_comments, *comments_args) %> | |
|
667 | <% comments = get_comments_for('unified', inline_comments, *comments_args) %> | |
|
643 | 668 | %else: |
|
644 | 669 | <% comments = None%> |
|
645 | 670 | %endif |
General Comments 0
You need to be logged in to leave comments.
Login now