Skip to content

Commit

Permalink
Migrate conda_smithy.github to pygit2
Browse files Browse the repository at this point in the history
  • Loading branch information
mgorny committed Nov 13, 2024
1 parent a23beb3 commit f31439f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions conda_smithy/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from random import choice

import github
from git import Repo
import pygit2
from github import Github
from github.GithubException import GithubException
from github.Organization import Organization
Expand Down Expand Up @@ -191,18 +191,18 @@ def create_github_repo(args):
print("Github repository already exists.")

# Now add this new repo as a remote on the local clone.
repo = Repo(args.feedstock_directory)
repo = pygit2.Repository(args.feedstock_directory)
remote_name = args.remote_name.strip()
if remote_name:
if remote_name in [remote.name for remote in repo.remotes]:
if remote_name in repo.remotes.names():
existing_remote = repo.remotes[remote_name]
if existing_remote.url != gh_repo.ssh_url:
print(
f"Remote {remote_name} already exists, and doesn't point to {gh_repo.ssh_url} "
f"(it points to {existing_remote.url})."
)
else:
repo.create_remote(remote_name, gh_repo.ssh_url)
repo.remotes.create(remote_name, gh_repo.ssh_url)

if args.extra_admin_users is not None:
for user in args.extra_admin_users:
Expand Down

0 comments on commit f31439f

Please sign in to comment.