Show More
@@ -594,6 +594,39 b' class PullrequestsController(BaseRepoCon' | |||
|
594 | 594 | return _org_pull_request_obj, pull_request_obj, \ |
|
595 | 595 | pull_request_display_obj, at_version |
|
596 | 596 | |
|
597 | def _get_diffset( | |
|
598 | self, source_repo, source_ref_id, target_ref_id, target_commit, | |
|
599 | source_commit, diff_limit, file_limit, display_inline_comments): | |
|
600 | vcs_diff = PullRequestModel().get_diff( | |
|
601 | source_repo, source_ref_id, target_ref_id) | |
|
602 | ||
|
603 | diff_processor = diffs.DiffProcessor( | |
|
604 | vcs_diff, format='newdiff', diff_limit=diff_limit, | |
|
605 | file_limit=file_limit, show_full_diff=c.fulldiff) | |
|
606 | ||
|
607 | _parsed = diff_processor.prepare() | |
|
608 | ||
|
609 | def _node_getter(commit): | |
|
610 | def get_node(fname): | |
|
611 | try: | |
|
612 | return commit.get_node(fname) | |
|
613 | except NodeDoesNotExistError: | |
|
614 | return None | |
|
615 | ||
|
616 | return get_node | |
|
617 | ||
|
618 | diffset = codeblocks.DiffSet( | |
|
619 | repo_name=c.repo_name, | |
|
620 | source_repo_name=c.source_repo.repo_name, | |
|
621 | source_node_getter=_node_getter(target_commit), | |
|
622 | target_node_getter=_node_getter(source_commit), | |
|
623 | comments=display_inline_comments | |
|
624 | ) | |
|
625 | diffset = diffset.render_patchset( | |
|
626 | _parsed, target_commit.raw_id, source_commit.raw_id) | |
|
627 | ||
|
628 | return diffset | |
|
629 | ||
|
597 | 630 | @LoginRequired() |
|
598 | 631 | @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', |
|
599 | 632 | 'repository.admin') |
@@ -799,34 +832,13 b' class PullrequestsController(BaseRepoCon' | |||
|
799 | 832 | |
|
800 | 833 | c.missing_commits = True |
|
801 | 834 | else: |
|
802 | vcs_diff = PullRequestModel().get_diff( | |
|
803 | commits_source_repo, source_ref_id, target_ref_id) | |
|
804 | ||
|
805 | diff_processor = diffs.DiffProcessor( | |
|
806 | vcs_diff, format='newdiff', diff_limit=diff_limit, | |
|
807 | file_limit=file_limit, show_full_diff=c.fulldiff) | |
|
808 | ||
|
809 | _parsed = diff_processor.prepare() | |
|
810 | c.limited_diff = isinstance(_parsed, diffs.LimitedDiffContainer) | |
|
811 | 835 | |
|
812 | def _node_getter(commit): | |
|
813 | def get_node(fname): | |
|
814 | try: | |
|
815 | return commit.get_node(fname) | |
|
816 | except NodeDoesNotExistError: | |
|
817 | return None | |
|
818 | ||
|
819 | return get_node | |
|
836 | c.diffset = self._get_diffset( | |
|
837 | commits_source_repo, source_ref_id, target_ref_id, | |
|
838 | target_commit, source_commit, | |
|
839 | diff_limit, file_limit, display_inline_comments) | |
|
820 | 840 | |
|
821 | diffset = codeblocks.DiffSet( | |
|
822 | repo_name=c.repo_name, | |
|
823 | source_repo_name=c.source_repo.repo_name, | |
|
824 | source_node_getter=_node_getter(target_commit), | |
|
825 | target_node_getter=_node_getter(source_commit), | |
|
826 | comments=display_inline_comments | |
|
827 | ) | |
|
828 | c.diffset = diffset.render_patchset( | |
|
829 | _parsed, target_commit.raw_id, source_commit.raw_id) | |
|
841 | c.limited_diff = c.diffset.limited_diff | |
|
830 | 842 | |
|
831 | 843 | # calculate removed files that are bound to comments |
|
832 | 844 | comment_deleted_files = [ |
General Comments 0
You need to be logged in to leave comments.
Login now