gitlab_migration/gitlab_migration.py
def migrate_repo(url, target_base_url, target_group, token):
    '''
    this will clone a repo from one remote and push it to another. 
    
    target_base_url *must* include everything up to the group name. eg: `https://<url>/` or `git@<url>:`
    '''
    try:
        _create_repo(url, target_base_url, target_group, token)
    except Exception as e:
        print(f"CREATE REPO ERROR! SKIPPING! {e}")
        return

    tmpdir = tempfile.mkdtemp()
    repo = Repo.clone_from(url, tmpdir)
    new_remote = repo.create_remote('new', 
        url=_get_new_repo_url(url, target_base_url, target_group))

    try:
        print('Pushing...')
        new_remote.push()
    except Exception as e:
        print(f"PUSH ERROR! SKIPPING REPO! {e}")

    shutil.rmtree(tmpdir)

    this will clone a repo from one remote and push it to another. 
    
    target_base_url *must* include everything up to the group name. eg: `https://<url>/` or `git@<url>:`
    
this will clone a repo from one remote and push it to another.
target_base_url *must* include everything up to the group name.
this will clone a repo from one remote and push it to another . target_base_url * must * include everything up to the group name .
def migrate_repo(url, target_base_url, target_group, token):
    try:
        _create_repo(url, target_base_url, target_group, token)
    except Exception as e:
        print(f"CREATE REPO ERROR! SKIPPING! {e}")
        return
    tmpdir = tempfile.mkdtemp()
    repo = Repo.clone_from(url, tmpdir)
    new_remote = repo.create_remote('new', 
        url=_get_new_repo_url(url, target_base_url, target_group))
    try:
        print('Pushing...')
        new_remote.push()
    except Exception as e:
        print(f"PUSH ERROR! SKIPPING REPO! {e}")
    shutil.rmtree(tmpdir)
def migrate_repo ( url , target_base_url , target_group , token ) : try : _create_repo ( url , target_base_url , target_group , token ) except Exception as e : print ( f"CREATE REPO ERROR! SKIPPING! {e}" ) return tmpdir = tempfile . mkdtemp ( ) repo = Repo . clone_from ( url , tmpdir ) new_remote = repo . create_remote ( 'new' , url = _get_new_repo_url ( url , target_base_url , target_group ) ) try : print ( 'Pushing...' ) new_remote . push ( ) except Exception as e : print ( f"PUSH ERROR! SKIPPING REPO! {e}" ) shutil . rmtree ( tmpdir )
this will clone a repo from one remote and push it to another.
this will clone a repo from one remote and push it to another .
'''
    this will clone a repo from one remote and push it to another. 
    
    target_base_url *must* include everything up to the group name. eg: `https://<url>/` or `git@<url>:`
    '''
url
target_base_url
target_group
token