def move_wildme(ibeis_rman, fmt):
    wildme_user = 'WildbookOrg'
    wildme_remote = 'wildme'
    for repo in ibeis_rman.repos:
        try:
            gitrepo = repo.as_gitpython()
        except Exception:
            repo.change_url_format(fmt)
            print('repo {!r} does not exist yet'.format(repo))
            continue
        wildme_url = repo._new_remote_url(host='github.com', user=wildme_user, fmt=fmt)
        remotes = repo.remotes
        message = ('Checking %s for move to wildme' % (repo,))
        print(message)
        incorrect_version = repo._ensure_remote_exists(wildme_remote, wildme_url)
        if ('origin' in remotes):
            try:
                origin = remotes['origin']
                origin_protocol = origin['url'].split(':')[0]
                origin_user = origin['username']
                if ((origin_user != wildme_user) or (origin_protocol != fmt) or incorrect_version):
                    if (origin_user not in remotes):
                        origin_url = origin['url']
                        print(('  * Create remote %r: %r' % (origin_user, origin_url)))
                        gitrepo.create_remote(origin_user, origin_url)
                    gitorigin = gitrepo.remote('origin')
                    print(('  * Change origin url to %r' % (wildme_url,)))
                    gitorigin.set_url(wildme_url)
            except:
                print(('\tWARNING: COULD NOT MIGRATE REPO = %r' % (repo,)))
        repo.change_url_format(fmt)
def move_wildme(ibeis_rman, fmt):
    wildme_user = 'WildbookOrg'
    wildme_remote = 'wildme'
    for repo in ibeis_rman.repos:
        try:
            gitrepo = repo.as_gitpython()
        except Exception:
            repo.change_url_format(fmt)
            print('repo {!r} does not exist yet'.format(repo))
            continue
        wildme_url = repo._new_remote_url(host='github.com', user=wildme_user, fmt=fmt)
        remotes = repo.remotes
        message = ('Checking %s for move to wildme' % (repo,))
        print(message)
        incorrect_version = repo._ensure_remote_exists(wildme_remote, wildme_url)
        if ('origin' in remotes):
            try:
                origin = remotes['origin']
                origin_protocol = origin['url'].split(':')[0]
                origin_user = origin['username']
                if ((origin_user != wildme_user) or (origin_protocol != fmt) or incorrect_version):
                    if (origin_user not in remotes):
                        origin_url = origin['url']
                        print(('  * Create remote %r: %r' % (origin_user, origin_url)))
                        gitrepo.create_remote(origin_user, origin_url)
                    gitorigin = gitrepo.remote('origin')
                    print(('  * Change origin url to %r' % (wildme_url,)))
                    gitorigin.set_url(wildme_url)
            except:
                print(('\tWARNING: COULD NOT MIGRATE REPO = %r' % (repo,)))
        repo.change_url_format(fmt)