Skip to content

Commit 29dbabe

Browse files
committed
use https:// URL for easybuilders remote in sync_pr_with_develop
1 parent 0608feb commit 29dbabe

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

easybuild/tools/github.py

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -814,10 +814,21 @@ def _easyconfigs_pr_common(paths, ecs, start_branch=None, pr_branch=None, start_
814814
return file_info, deleted_paths, git_repo, pr_branch, diff_stat
815815

816816

817-
def create_remote(git_repo, account, repo):
818-
"""Create remote in specified git working directory for specified account & repository."""
817+
def create_remote(git_repo, account, repo, https=False):
818+
"""
819+
Create remote in specified git working directory for specified account & repository.
820+
821+
:param git_repo: git.Repo instance to use (after init_repo & setup_repo)
822+
:param account: GitHub account name
823+
:param repo: repository name
824+
:param https: use https:// URL rather than git@
825+
"""
826+
827+
if https:
828+
github_url = 'https://github.com/%s/%s.git' % (account, repo)
829+
else:
830+
github_url = '[email protected]:%s/%s.git' % (account, repo)
819831

820-
github_url = '[email protected]:%s/%s.git' % (account, repo)
821832
salt = ''.join(random.choice(ascii_letters) for _ in range(5))
822833
remote_name = 'github_%s_%s' % (account, salt)
823834

@@ -830,7 +841,14 @@ def create_remote(git_repo, account, repo):
830841

831842

832843
def push_branch_to_github(git_repo, target_account, target_repo, branch):
833-
"""Push specified branch to GitHub from specified git repository."""
844+
"""
845+
Push specified branch to GitHub from specified git repository.
846+
847+
:param git_repo: git.Repo instance to use (after init_repo & setup_repo)
848+
:param target_account: GitHub account name
849+
:param target_repo: repository name
850+
:param branch: name of branch to push
851+
"""
834852

835853
# push to GitHub
836854
remote = create_remote(git_repo, target_account, target_repo)
@@ -1815,7 +1833,7 @@ def reviews_url(gh):
18151833

18161834

18171835
def sync_pr_with_develop(pr_id):
1818-
"""Sync pull request with current develop branch."""
1836+
"""Sync pull request with specified ID with current develop branch."""
18191837
github_user = build_option('github_user')
18201838
if github_user is None:
18211839
raise EasyBuildError("GitHub user must be specified to use --sync-pr-with-develop")
@@ -1835,7 +1853,7 @@ def sync_pr_with_develop(pr_id):
18351853
# pull in latest version of 'develop' branch from central repository
18361854
msg = "pulling latest version of '%s' branch from %s/%s..." % (target_account, target_repo, GITHUB_DEVELOP_BRANCH)
18371855
print_msg(msg, log=_log)
1838-
easybuilders_remote = create_remote(git_repo, target_account, target_repo)
1856+
easybuilders_remote = create_remote(git_repo, target_account, target_repo, https=True)
18391857
pull_out = git_repo.git.pull(easybuilders_remote.name, GITHUB_DEVELOP_BRANCH)
18401858
_log.debug("Output of 'git pull %s %s': %s", easybuilders_remote.name, GITHUB_DEVELOP_BRANCH, pull_out)
18411859

0 commit comments

Comments
 (0)