From 0442cdcd3dcd9dcfb7b21562dfa47eba7f1f4727 Mon Sep 17 00:00:00 2001 From: mhoecke1 Date: Mon, 26 Aug 2024 16:07:21 -0400 Subject: [PATCH] adding config value for old Bitbucket Server diff functionality --- pr_agent/git_providers/bitbucket_server_provider.py | 4 +++- pr_agent/settings/configuration.toml | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pr_agent/git_providers/bitbucket_server_provider.py b/pr_agent/git_providers/bitbucket_server_provider.py index d256a808a..67e4cbaeb 100644 --- a/pr_agent/git_providers/bitbucket_server_provider.py +++ b/pr_agent/git_providers/bitbucket_server_provider.py @@ -156,8 +156,10 @@ def get_diff_files(self) -> list[FilePatchInfo]: guaranteed_common_ancestor = source_commits_list[-1]['parents'][0]['id'] destination_commits = list(self.bitbucket_client.get_commits(self.workspace_slug, self.repo_slug, guaranteed_common_ancestor, self.pr.toRef['latestCommit'])) - base_sha = self.get_best_common_ancestor(source_commits_list, destination_commits, guaranteed_common_ancestor) + base_sha = self.pr.toRef['latestCommit'] head_sha = self.pr.fromRef['latestCommit'] + if not get_settings().bitbucket_server.get("legacy_diff_calculation", False): + base_sha = self.get_best_common_ancestor(source_commits_list, destination_commits, guaranteed_common_ancestor) diff_files = [] original_file_content_str = "" diff --git a/pr_agent/settings/configuration.toml b/pr_agent/settings/configuration.toml index b128aca08..108ae4e2d 100644 --- a/pr_agent/settings/configuration.toml +++ b/pr_agent/settings/configuration.toml @@ -263,6 +263,7 @@ pr_commands = [ "/review --pr_reviewer.num_code_suggestions=0", "/improve --pr_code_suggestions.commitable_code_suggestions=true --pr_code_suggestions.suggestions_score_threshold=7", ] +legacy_diff_calculation = false [litellm] # use_client = false