# HG changeset patch # User Milka Kuzminski # Date 2020-12-04 21:44:35 # Node ID 16e47051c0a96e62b5951713e61f88d2a307c711 # Parent 8ef51af36d407922edd9ed0205544fe46e5c2367 diffs: fixed diff rendering when a common ancestor was a different commit than the source of changes. diff --git a/rhodecode/apps/repository/views/repo_pull_requests.py b/rhodecode/apps/repository/views/repo_pull_requests.py --- a/rhodecode/apps/repository/views/repo_pull_requests.py +++ b/rhodecode/apps/repository/views/repo_pull_requests.py @@ -221,9 +221,13 @@ class RepoPullRequestsView(RepoAppView, target_commit, source_commit, diff_limit, file_limit, fulldiff, hide_whitespace_changes, diff_context, use_ancestor=True): + target_commit_final = target_commit + source_commit_final = source_commit + if use_ancestor: # we might want to not use it for versions target_ref_id = ancestor_commit.raw_id + target_commit_final = ancestor_commit vcs_diff = PullRequestModel().get_diff( source_repo, source_ref_id, target_ref_id, @@ -238,11 +242,11 @@ class RepoPullRequestsView(RepoAppView, diffset = codeblocks.DiffSet( repo_name=self.db_repo_name, source_repo_name=source_repo_name, - source_node_getter=codeblocks.diffset_node_getter(target_commit), - target_node_getter=codeblocks.diffset_node_getter(source_commit), + source_node_getter=codeblocks.diffset_node_getter(target_commit_final), + target_node_getter=codeblocks.diffset_node_getter(source_commit_final), ) diffset = self.path_filter.render_patchset_filtered( - diffset, _parsed, target_commit.raw_id, source_commit.raw_id) + diffset, _parsed, target_ref_id, source_ref_id) return diffset