trying to upgrade the giteapy version, bleh
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
|
||||
|
||||
import giteapy
|
||||
# import giteapy
|
||||
import giteapy.giteapy
|
||||
import logging
|
||||
import sys
|
||||
|
||||
@ -103,13 +104,22 @@ class Migrator:
|
||||
|
||||
def migrate_entire_org(
|
||||
self,
|
||||
source_org: str,
|
||||
destination_org: str, destination_repo_name: str, destination_topics: list
|
||||
interactive: bool = True,
|
||||
source_org: str = None, source_topics: list[str] = None,
|
||||
destination_org: str = None, destination_repo_name: str = None, destination_topics: list = None
|
||||
):
|
||||
assert source_org is not None, "Source org must be specified"
|
||||
assert destination_org is not None, "Destination org must be specified"
|
||||
assert destination_repo_name is not None, "Destination repo name must be specified"
|
||||
assert destination_topics is not None, "Destination topics must be specified"
|
||||
|
||||
api_source, api_destination = self._get_org_apis()
|
||||
api_source: giteapy.OrganizationApi
|
||||
api_destination: giteapy.OrganizationApi
|
||||
|
||||
source_repos = api_source.org_list_repos(source_org)
|
||||
api_source_repos = self._get_repo_api(hostname=self.__source_host, port=self.__source_port, token=self.__source_token)
|
||||
|
||||
source_repos = api_source.org_list_repos(source_org, page=0, limit=1000000)
|
||||
self.__logger.info(f"Found {len(source_repos)} repos on source:")
|
||||
for repo in source_repos:
|
||||
repo: giteapy.Repository
|
||||
@ -124,10 +134,27 @@ class Migrator:
|
||||
|
||||
repo: giteapy.Repository
|
||||
|
||||
repo_topics = api_source_repos.repo_list_topics(owner=repo.owner.login, repo=repo.name)
|
||||
repo_topics = repo_topics.topics
|
||||
self.__logger.error(f"Repo topics: {repo_topics}")
|
||||
|
||||
if self._check_source_repo_topics(repo=repo, topics=source_topics) is False:
|
||||
repos_ignore.append(repo)
|
||||
self.__logger.info(
|
||||
f"Ignoring repo because it doesn't have all required tags."
|
||||
f"\n> Repo: {repo.full_name}"
|
||||
f"\n> Has: {repo_topics}"
|
||||
f"\n> Needs: {source_topics}"
|
||||
)
|
||||
continue
|
||||
|
||||
while True:
|
||||
|
||||
response = input(f"Migrate repo #{repo.id} \"{repo.full_name}\" ? (Y)es, (N)o, (G)o right now, (Q)uit ==> ")
|
||||
response = response.lower()
|
||||
if interactive:
|
||||
response = input(f"Migrate repo #{repo.id} \"{repo.full_name}\" ? (Y)es, (N)o, (G)o right now, (Q)uit ==> ")
|
||||
response = response.lower()
|
||||
else:
|
||||
response = "y"
|
||||
|
||||
valid_input = True
|
||||
if response == "y":
|
||||
@ -192,6 +219,10 @@ class Migrator:
|
||||
else:
|
||||
self.__logger.info("Confirmation not received; Won't do anything.")
|
||||
|
||||
def _check_source_repo_topics(self, repo: giteapy.Repository, topics: list[str]) -> bool:
|
||||
|
||||
return False
|
||||
|
||||
def _migrate_repos(
|
||||
self,
|
||||
destination_org_name: str,
|
||||
|
Reference in New Issue
Block a user