@@ -130,20 +130,40 @@ def get_diff(self, use_original_base=False) -> dict | None:
130130 if bases_match and self ._adjusted_base_diff is not NOT_RESOLVED :
131131 self ._original_base_diff = self ._adjusted_base_diff
132132 elif patch_coverage_base_commitid is not None :
133- pull_diff = async_to_sync (self .repository_service .get_compare )(
134- patch_coverage_base_commitid , head .commitid , with_commits = False
135- )
136- self ._original_base_diff = pull_diff ["diff" ]
133+ try :
134+ pull_diff = async_to_sync (self .repository_service .get_compare )(
135+ patch_coverage_base_commitid , head .commitid , with_commits = False
136+ )
137+ self ._original_base_diff = pull_diff ["diff" ]
138+ except TorngitClientGeneralError :
139+ log .warning (
140+ "Unable to fetch original base diff from Git provider" ,
141+ extra = {
142+ "patch_coverage_base_commitid" : patch_coverage_base_commitid ,
143+ "head_commitid" : head .commitid ,
144+ },
145+ )
146+ self ._original_base_diff = None
137147 else :
138148 return None
139149 elif populate_adjusted_base_diff :
140150 if bases_match and self ._original_base_diff is not NOT_RESOLVED :
141151 self ._adjusted_base_diff = self ._original_base_diff
142152 elif base is not None :
143- pull_diff = async_to_sync (self .repository_service .get_compare )(
144- base .commitid , head .commitid , with_commits = False
145- )
146- self ._adjusted_base_diff = pull_diff ["diff" ]
153+ try :
154+ pull_diff = async_to_sync (self .repository_service .get_compare )(
155+ base .commitid , head .commitid , with_commits = False
156+ )
157+ self ._adjusted_base_diff = pull_diff ["diff" ]
158+ except TorngitClientGeneralError :
159+ log .warning (
160+ "Unable to fetch adjusted base diff from Git provider" ,
161+ extra = {
162+ "base_commitid" : base .commitid ,
163+ "head_commitid" : head .commitid ,
164+ },
165+ )
166+ self ._adjusted_base_diff = None
147167 else :
148168 return None
149169
0 commit comments