Skip to content

Commit 0b9092a

Browse files
committed
Add new function name and deprecates old one
1 parent 48ba4c4 commit 0b9092a

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

easybuild/tools/github.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2173,7 +2173,7 @@ def new_pr(paths, ecs, title=None, descr=None, commit_msg=None):
21732173
pr_metadata=(file_info, deleted_paths, diff_stat), commit_msg=commit_msg)
21742174

21752175

2176-
def det_account_branch_for_pr(pr_id, github_user=None, pr_target_repo=None):
2176+
def det_account_repo_branch_for_pr(pr_id, github_user=None, pr_target_repo=None):
21772177
"""Determine account & branch corresponding to pull request with specified id."""
21782178

21792179
if github_user is None:
@@ -2198,6 +2198,14 @@ def det_account_branch_for_pr(pr_id, github_user=None, pr_target_repo=None):
21982198
return account, repo, branch
21992199

22002200

2201+
def det_account_branch_for_pr(pr_id, github_user=None, pr_target_repo=None):
2202+
"""Deprecated version of `det_account_repo_branch_for_pr`"""
2203+
_log.deprecated("`det_account_branch_for_pr` is deprecated, use `det_account_repo_branch_for_pr` instead", "6.0")
2204+
account, _, branch = det_account_repo_branch_for_pr(pr_id, github_user=github_user, pr_target_repo=pr_target_repo)
2205+
2206+
return account, branch
2207+
2208+
22012209
def det_pr_target_repo(paths):
22022210
"""Determine target repository for pull request from given cagetorized list of files
22032211
@@ -2292,7 +2300,7 @@ def update_pr(pr_id, paths, ecs, commit_msg=None):
22922300
exit_code=EasyBuildExit.OPTION_ERROR
22932301
)
22942302

2295-
github_account, _, branch_name = det_account_branch_for_pr(pr_id, pr_target_repo=pr_target_repo)
2303+
github_account, _, branch_name = det_account_repo_branch_for_pr(pr_id, pr_target_repo=pr_target_repo)
22962304

22972305
update_branch(branch_name, paths, ecs, github_account=github_account, commit_msg=commit_msg)
22982306

@@ -2884,7 +2892,7 @@ def sync_pr_with_develop(pr_id):
28842892
target_account = build_option('pr_target_account')
28852893
target_repo = build_option('pr_target_repo') or GITHUB_EASYCONFIGS_REPO
28862894

2887-
pr_account, pr_repo, pr_branch = det_account_branch_for_pr(pr_id)
2895+
pr_account, pr_repo, pr_branch = det_account_repo_branch_for_pr(pr_id)
28882896

28892897
# initialize repository
28902898
git_working_dir = tempfile.mkdtemp(prefix='git-working-dir')

test/framework/github.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,7 @@ def test_github_create_delete_gist(self):
11161116
gist_id = gist_url.split('/')[-1]
11171117
gh.delete_gist(gist_id, github_user=GITHUB_TEST_ACCOUNT, github_token=self.github_token)
11181118

1119-
def test_github_det_account_branch_for_pr(self):
1119+
def test_github_det_account_repo_branch_for_pr(self):
11201120
"""Test det_account_branch_for_pr."""
11211121
if self.skip_github_tests:
11221122
print("Skipping test_det_account_branch_for_pr, no GitHub token available?")
@@ -1129,7 +1129,7 @@ def test_github_det_account_branch_for_pr(self):
11291129

11301130
# see https://github.com/easybuilders/easybuild-easyconfigs/pull/9149
11311131
self.mock_stdout(True)
1132-
account, repo, branch = gh.det_account_branch_for_pr(9149, github_user=GITHUB_TEST_ACCOUNT)
1132+
account, repo, branch = gh.det_account_repo_branch_for_pr(9149, github_user=GITHUB_TEST_ACCOUNT)
11331133
self.mock_stdout(False)
11341134
self.assertEqual(account, 'boegel')
11351135
self.assertEqual(repo, 'easybuild-easyconfigs')
@@ -1142,7 +1142,7 @@ def test_github_det_account_branch_for_pr(self):
11421142

11431143
# see https://github.com/easybuilders/easybuild-framework/pull/3069
11441144
self.mock_stdout(True)
1145-
account, repo, branch = gh.det_account_branch_for_pr(3069, github_user=GITHUB_TEST_ACCOUNT)
1145+
account, repo, branch = gh.det_account_repo_branch_for_pr(3069, github_user=GITHUB_TEST_ACCOUNT)
11461146
self.mock_stdout(False)
11471147
self.assertEqual(account, 'migueldiascosta')
11481148
self.assertEqual(repo, 'easybuild-framework')

0 commit comments

Comments
 (0)