File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -190,19 +190,29 @@ def list_diff_issues(self, diff_id):
190
190
191
191
def list_diff_issues_v2 (self , diff_id , mode ):
192
192
"""
193
- List issues for a given dif
193
+ List issues for a given diff, applying specific filters.
194
+ Returns:
195
+ * The ID of the previous diff if it exists (always null for `known` mode).
196
+ * A list of issues (dict serializing ID and hash) corresponding to the filter.
194
197
"""
195
198
assert mode in ("known" , "unresolved" , "closed" )
196
199
try :
197
- return list ( self .paginate (f"/v2/diff/{ diff_id } /issues/{ mode } " ) )
200
+ data = self .get (f"/v2/diff/{ diff_id } /issues/{ mode } " )
198
201
except HTTPError as e :
199
202
if e .response .status_code != 404 :
200
203
logger .warning (
201
- f"Cound not list { mode } issues from the bot: { e } . Skipping"
204
+ f"Could not list { mode } issues from the bot: { e } . Skipping"
202
205
)
203
206
else :
204
207
logger .info (f"Diff not found in code review backend: { diff_id } " )
205
- return []
208
+ return None , []
209
+ return data ["previous_diff_id" ], data ["issues" ]
210
+
211
+ def get (self , url ):
212
+ auth = (self .username , self .password )
213
+ resp = requests .get (url , auth = auth , headers = GetAppUserAgent ())
214
+ resp .raise_for_status ()
215
+ return resp .json ()
206
216
207
217
def paginate (self , url_path ):
208
218
"""
You can’t perform that action at this time.
0 commit comments