@@ -251,85 +251,6 @@ def setup_llvmbot_git(git_dir="."):
251
251
config .
set_value (
"user" ,
"email" ,
"[email protected] " )
252
252
253
253
254
- def phab_api_call (phab_token : str , url : str , args : dict ) -> dict :
255
- """
256
- Make an API call to the Phabricator web service and return a dictionary
257
- containing the json response.
258
- """
259
- data = {"api.token" : phab_token }
260
- data .update (args )
261
- response = requests .post (url , data = data )
262
- return response .json ()
263
-
264
-
265
- def phab_login_to_github_login (
266
- phab_token : str , repo : github .Repository .Repository , phab_login : str
267
- ) -> Optional [str ]:
268
- """
269
- Tries to translate a Phabricator login to a github login by
270
- finding a commit made in Phabricator's Differential.
271
- The commit's SHA1 is then looked up in the github repo and
272
- the committer's login associated with that commit is returned.
273
-
274
- :param str phab_token: The Conduit API token to use for communication with Pabricator
275
- :param github.Repository.Repository repo: The github repo to use when looking for the SHA1 found in Differential
276
- :param str phab_login: The Phabricator login to be translated.
277
- """
278
-
279
- args = {
280
- "constraints[authors][0]" : phab_login ,
281
- # PHID for "LLVM Github Monorepo" repository
282
- "constraints[repositories][0]" : "PHID-REPO-f4scjekhnkmh7qilxlcy" ,
283
- "limit" : 1 ,
284
- }
285
- # API documentation: https://reviews.llvm.org/conduit/method/diffusion.commit.search/
286
- r = phab_api_call (
287
- phab_token , "https://reviews.llvm.org/api/diffusion.commit.search" , args
288
- )
289
- data = r ["result" ]["data" ]
290
- if len (data ) == 0 :
291
- # Can't find any commits associated with this user
292
- return None
293
-
294
- commit_sha = data [0 ]["fields" ]["identifier" ]
295
- committer = repo .get_commit (commit_sha ).committer
296
- if not committer :
297
- # This committer had an email address GitHub could not recognize, so
298
- # it can't link the user to a GitHub account.
299
- print (f"Warning: Can't find github account for { phab_login } " )
300
- return None
301
- return committer .login
302
-
303
-
304
- def phab_get_commit_approvers (phab_token : str , commit : github .Commit .Commit ) -> list :
305
- args = {"corpus" : commit .commit .message }
306
- # API documentation: https://reviews.llvm.org/conduit/method/differential.parsecommitmessage/
307
- r = phab_api_call (
308
- phab_token , "https://reviews.llvm.org/api/differential.parsecommitmessage" , args
309
- )
310
- review_id = r ["result" ]["revisionIDFieldInfo" ]["value" ]
311
- if not review_id :
312
- # No Phabricator revision for this commit
313
- return []
314
-
315
- args = {"constraints[ids][0]" : review_id , "attachments[reviewers]" : True }
316
- # API documentation: https://reviews.llvm.org/conduit/method/differential.revision.search/
317
- r = phab_api_call (
318
- phab_token , "https://reviews.llvm.org/api/differential.revision.search" , args
319
- )
320
- reviewers = r ["result" ]["data" ][0 ]["attachments" ]["reviewers" ]["reviewers" ]
321
- accepted = []
322
- for reviewer in reviewers :
323
- if reviewer ["status" ] != "accepted" :
324
- continue
325
- phid = reviewer ["reviewerPHID" ]
326
- args = {"constraints[phids][0]" : phid }
327
- # API documentation: https://reviews.llvm.org/conduit/method/user.search/
328
- r = phab_api_call (phab_token , "https://reviews.llvm.org/api/user.search" , args )
329
- accepted .append (r ["result" ]["data" ][0 ]["fields" ]["username" ])
330
- return accepted
331
-
332
-
333
254
def extract_commit_hash (arg : str ):
334
255
"""
335
256
Extract the commit hash from the argument passed to /action github
@@ -364,7 +285,6 @@ def __init__(
364
285
branch_repo_name : str ,
365
286
branch_repo_token : str ,
366
287
llvm_project_dir : str ,
367
- phab_token : str ,
368
288
) -> None :
369
289
self ._token = token
370
290
self ._repo_name = repo
@@ -375,7 +295,6 @@ def __init__(
375
295
else :
376
296
self ._branch_repo_token = self .token
377
297
self ._llvm_project_dir = llvm_project_dir
378
- self ._phab_token = phab_token
379
298
380
299
@property
381
300
def token (self ) -> str :
@@ -401,10 +320,6 @@ def branch_repo_token(self) -> str:
401
320
def llvm_project_dir (self ) -> str :
402
321
return self ._llvm_project_dir
403
322
404
- @property
405
- def phab_token (self ) -> str :
406
- return self ._phab_token
407
-
408
323
@property
409
324
def repo (self ) -> github .Repository .Repository :
410
325
return github .Github (self .token ).get_repo (self .repo_name )
@@ -708,11 +623,6 @@ def execute_command(self) -> bool:
708
623
release_workflow_parser .add_argument (
709
624
"--issue-number" , type = int , required = True , help = "The issue number to update"
710
625
)
711
- release_workflow_parser .add_argument (
712
- "--phab-token" ,
713
- type = str ,
714
- help = "Phabricator conduit API token. See https://reviews.llvm.org/settings/user/<USER>/page/apitokens/" ,
715
- )
716
626
release_workflow_parser .add_argument (
717
627
"--branch-repo-token" ,
718
628
type = str ,
@@ -759,7 +669,6 @@ def execute_command(self) -> bool:
759
669
args .branch_repo ,
760
670
args .branch_repo_token ,
761
671
args .llvm_project_dir ,
762
- args .phab_token ,
763
672
)
764
673
if not release_workflow .release_branch_for_issue :
765
674
release_workflow .issue_notify_no_milestone (sys .stdin .readlines ())
0 commit comments