gitlab_migration/gitlab_migration.py
def update_local_repo(path, old_base_url, target_base_url, target_group, set_as_origin):
    '''
    this will update a local repo with a new origin, saving the old origin with the remote name "old"
    
    target_base_url *must* include everything up to the group name. eg: `https://<url>/` or `git@<url>:`
    '''
    repo = Repo(path)
    old_remote = repo.remotes.origin
    if old_base_url not in old_remote.url:
        print(f'SKIPPING: Old base URL not present in origin URL for {path}')
        return

    new_url = _get_new_repo_url(old_remote.url, target_base_url, target_group)
    if set_as_origin:
        if "old" in [r.name for r in repo.remotes]:
            print(f"SKIPPING: A remote named 'old' already exists for {_get_repo_name_from_url(old_remote.url)}")
        else:
            repo.create_remote("old", url=old_remote.url)
        repo.delete_remote(old_remote)
        repo.create_remote('origin', url=new_url)
    else:
        repo.create_remote('new', url=new_url)

    this will update a local repo with a new origin, saving the old origin with the remote name "old"
    
    target_base_url *must* include everything up to the group name. eg: `https://<url>/` or `git@<url>:`
    
this will update a local repo with a new origin, saving the old origin with the remote name "old"
target_base_url *must* include everything up to the group name.
this will update a local repo with a new origin saving the old origin with the remote name " old " target_base_url * must * include everything up to the group name .
def update_local_repo(path, old_base_url, target_base_url, target_group, set_as_origin):
    repo = Repo(path)
    old_remote = repo.remotes.origin
    if old_base_url not in old_remote.url:
        print(f'SKIPPING: Old base URL not present in origin URL for {path}')
        return
    new_url = _get_new_repo_url(old_remote.url, target_base_url, target_group)
    if set_as_origin:
        if "old" in [r.name for r in repo.remotes]:
            print(f"SKIPPING: A remote named 'old' already exists for {_get_repo_name_from_url(old_remote.url)}")
        else:
            repo.create_remote("old", url=old_remote.url)
        repo.delete_remote(old_remote)
        repo.create_remote('origin', url=new_url)
    else:
        repo.create_remote('new', url=new_url)
def update_local_repo ( path , old_base_url , target_base_url , target_group , set_as_origin ) : repo = Repo ( path ) old_remote = repo . remotes . origin if old_base_url not in old_remote . url : print ( f'SKIPPING: Old base URL not present in origin URL for {path}' ) return new_url = _get_new_repo_url ( old_remote . url , target_base_url , target_group ) if set_as_origin : if "old" in [ r . name for r in repo . remotes ] : print ( f"SKIPPING: A remote named 'old' already exists for {_get_repo_name_from_url(old_remote.url)}" ) else : repo . create_remote ( "old" , url = old_remote . url ) repo . delete_remote ( old_remote ) repo . create_remote ( 'origin' , url = new_url ) else : repo . create_remote ( 'new' , url = new_url )
this will update a local repo with a new origin, saving the old origin with the remote name "old"
target_base_url *must* include everything up to the group name.
this will update a local repo with a new origin saving the old origin with the remote name " old " target_base_url * must * include everything up to the group name .
'''
    this will update a local repo with a new origin, saving the old origin with the remote name "old"
    
    target_base_url *must* include everything up to the group name. eg: `https://<url>/` or `git@<url>:`
    '''
path
old_base_url
target_base_url
target_group
set_as_origin