@@ -1537,34 +1537,56 @@ def det_account_branch_for_pr(pr_id, github_user=None):
15371537
15381538
15391539@only_if_module_is_available ('git' , pkgname = 'GitPython' )
1540- def update_pr ( pr_id , paths , ecs , commit_msg = None ):
1540+ def update_branch ( branch_name , paths , ecs , github_account = None , commit_msg = None ):
15411541 """
1542- Update specified pull request using specified files
1542+ Update specified branch in GitHub using specified files
15431543
1544- :param pr_id: ID of pull request to update
15451544 :param paths: paths to categorized lists of files (easyconfigs, files to delete, patches)
1545+ :param github_account: GitHub account where branch is located
15461546 :param ecs: list of parsed easyconfigs, incl. for dependencies (if robot is enabled)
15471547 :param commit_msg: commit message to use
15481548 """
1549+ if commit_msg is None :
1550+ commit_msg = build_option ('pr_commit_msg' )
15491551
15501552 if commit_msg is None :
15511553 raise EasyBuildError ("A meaningful commit message must be specified via --pr-commit-msg when using --update-pr" )
15521554
1553- pr_target_account = build_option ('pr_target_account' )
1554- pr_target_repo = build_option ('pr_target_repo' )
1555-
1556- account , branch = det_account_branch_for_pr (pr_id )
1555+ if github_account is None :
1556+ github_account = build_option ('github_user' ) or build_option ('github_org' )
15571557
1558- _ , _ , _ , _ , diff_stat = _easyconfigs_pr_common (paths , ecs , start_branch = branch , pr_branch = branch ,
1559- start_account = account , commit_msg = commit_msg )
1558+ _ , _ , _ , _ , diff_stat = _easyconfigs_pr_common (paths , ecs , start_branch = branch_name , pr_branch = branch_name ,
1559+ start_account = github_account , commit_msg = commit_msg )
15601560
15611561 print_msg ("Overview of changes:\n %s\n " % diff_stat , log = _log , prefix = False )
15621562
1563- full_repo = '%s/%s' % (pr_target_account , pr_target_repo )
1564- msg = "Updated %s PR #%s by pushing to branch %s/%s " % (full_repo , pr_id , account , branch )
1563+ full_repo = '%s/%s' % (github_account , build_option ( ' pr_target_repo' ) )
1564+ msg = "pushed updated branch '%s' to %s " % (branch_name , full_repo )
15651565 if build_option ('dry_run' ) or build_option ('extended_dry_run' ):
15661566 msg += " [DRY RUN]"
1567- print_msg (msg , log = _log , prefix = False )
1567+ print_msg (msg , log = _log )
1568+
1569+
1570+ @only_if_module_is_available ('git' , pkgname = 'GitPython' )
1571+ def update_pr (pr_id , paths , ecs , commit_msg = None ):
1572+ """
1573+ Update specified pull request using specified files
1574+
1575+ :param pr_id: ID of pull request to update
1576+ :param paths: paths to categorized lists of files (easyconfigs, files to delete, patches)
1577+ :param ecs: list of parsed easyconfigs, incl. for dependencies (if robot is enabled)
1578+ :param commit_msg: commit message to use
1579+ """
1580+
1581+ github_account , branch_name = det_account_branch_for_pr (pr_id )
1582+
1583+ update_branch (branch_name , paths , ecs , github_account = github_account , commit_msg = commit_msg )
1584+
1585+ full_repo = '%s/%s' % (build_option ('pr_target_account' ), build_option ('pr_target_repo' ))
1586+ msg = "updated https://github.com/%s/pull/%s" % (full_repo , pr_id )
1587+ if build_option ('dry_run' ) or build_option ('extended_dry_run' ):
1588+ msg += " [DRY RUN]"
1589+ print_msg (msg , log = _log )
15681590
15691591
15701592def check_github ():
0 commit comments