Skip to content

Commit

Permalink
bug-fix_azuredevops-new-file
Browse files Browse the repository at this point in the history
  • Loading branch information
CoryBall committed Oct 8, 2024
1 parent 4b05a3e commit a476e85
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions pr_agent/git_providers/azuredevops_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,19 +336,22 @@ def get_diff_files(self) -> list[FilePatchInfo]:
version = GitVersionDescriptor(
version=base_sha.commit_id, version_type="commit"
)
try:
original_file_content_str = self.azure_devops_client.get_item(
repository_id=self.repo_slug,
path=file,
project=self.workspace_slug,
version_descriptor=version,
download=False,
include_content=True,
)
original_file_content_str = original_file_content_str.content
except Exception as error:
get_logger().error(f"Failed to retrieve original file content of {file} at version {version}", error=error)
if edit_type == EDIT_TYPE.ADDED:
original_file_content_str = ""
else:
try:
original_file_content_str = self.azure_devops_client.get_item(
repository_id=self.repo_slug,
path=file,
project=self.workspace_slug,
version_descriptor=version,
download=False,
include_content=True,
)
original_file_content_str = original_file_content_str.content
except Exception as error:
get_logger().error(f"Failed to retrieve original file content of {file} at version {version}", error=error)
original_file_content_str = ""

patch = load_large_diff(
file, new_file_content_str, original_file_content_str, show_warning=False
Expand Down

0 comments on commit a476e85

Please sign in to comment.