mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-12-15 12:25:18 +00:00
Azure Devops: Set file content as empty string when error
This commit is contained in:
parent
8d075b76ae
commit
4479c5f11b
1 changed files with 15 additions and 9 deletions
|
|
@ -100,14 +100,17 @@ class AzureDevopsProvider:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
version = GitVersionDescriptor(version=head_sha.commit_id, version_type='commit')
|
version = GitVersionDescriptor(version=head_sha.commit_id, version_type='commit')
|
||||||
new_file_content_str = self.azure_devops_client.get_item(repository_id=self.repo_slug,
|
try:
|
||||||
path=file,
|
new_file_content_str = self.azure_devops_client.get_item(repository_id=self.repo_slug,
|
||||||
project=self.workspace_slug,
|
path=file,
|
||||||
version_descriptor=version,
|
project=self.workspace_slug,
|
||||||
download=False,
|
version_descriptor=version,
|
||||||
include_content=True)
|
download=False,
|
||||||
|
include_content=True)
|
||||||
|
|
||||||
new_file_content_str = new_file_content_str.content
|
new_file_content_str = new_file_content_str.content
|
||||||
|
except Exception as e:
|
||||||
|
new_file_content_str = ""
|
||||||
|
|
||||||
edit_type = EDIT_TYPE.MODIFIED
|
edit_type = EDIT_TYPE.MODIFIED
|
||||||
if diff_types[file] == 'add':
|
if diff_types[file] == 'add':
|
||||||
|
|
@ -118,13 +121,16 @@ class AzureDevopsProvider:
|
||||||
edit_type = EDIT_TYPE.RENAMED
|
edit_type = EDIT_TYPE.RENAMED
|
||||||
|
|
||||||
version = GitVersionDescriptor(version=base_sha.commit_id, version_type='commit')
|
version = GitVersionDescriptor(version=base_sha.commit_id, version_type='commit')
|
||||||
original_file_content_str = self.azure_devops_client.get_item(repository_id=self.repo_slug,
|
try:
|
||||||
|
original_file_content_str = self.azure_devops_client.get_item(repository_id=self.repo_slug,
|
||||||
path=file,
|
path=file,
|
||||||
project=self.workspace_slug,
|
project=self.workspace_slug,
|
||||||
version_descriptor=version,
|
version_descriptor=version,
|
||||||
download=False,
|
download=False,
|
||||||
include_content=True)
|
include_content=True)
|
||||||
original_file_content_str = original_file_content_str.content
|
original_file_content_str = original_file_content_str.content
|
||||||
|
except Exception as e:
|
||||||
|
original_file_content_str = ""
|
||||||
|
|
||||||
patch = load_large_diff(file, new_file_content_str, original_file_content_str)
|
patch = load_large_diff(file, new_file_content_str, original_file_content_str)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue