diff --git a/README.md b/README.md index ab44d91..15c37d9 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ usage: migrate_gitlab_to_gogs.py [-h] --source_namespace SOURCE_NAMESPACE [--add_to_private] [--add_to_organization organization_name] --source_repo SOURCE_REPO --target_repo - TARGET_REPO + TARGET_REPO [--no_confirm] optional arguments: -h, --help show this help message and exit @@ -40,6 +40,7 @@ optional arguments: --target_repo TARGET_REPO URL to your gogs / gitea repo in the format http://mygogs.com/ + --no_confirm Skip user confirmation of each single step ``` ## Requirements diff --git a/migrate_gitlab_to_gogs.py b/migrate_gitlab_to_gogs.py index 4726a34..b6bfd2d 100755 --- a/migrate_gitlab_to_gogs.py +++ b/migrate_gitlab_to_gogs.py @@ -19,6 +19,10 @@ parser.add_argument('--source_repo', parser.add_argument('--target_repo', help='URL to your gogs / gitea repo in the format http://mygogs.com/', required=True) +parser.add_argument('--no_confirm', + help='Skip user confirmation of each single step', + action='store_true') + args = parser.parse_args() assert args.add_to_private or args.add_to_organization is not None, 'Please set either add_to_private or provide a target oranization name!' @@ -30,7 +34,9 @@ if args.add_to_private: else: print('to the organisation %s'%args.add_to_organization, end='') print(' as private repositories.') -input('Hit any key to continue!') + +if not args.no_confirm: + input('Hit any key to continue!') gogs_url = args.target_repo + "/api/v1" gitlab_url = args.source_repo + '/api/v4' @@ -90,8 +96,9 @@ print('\n\nFinished preparations. We are about to migrate the following projects print('\n'.join([p['path_with_namespace'] for p in filtered_projects])) -if 'yes' != input('Do you want to continue? (please answer yes or no) '): - print('\nYou decided to cancel...') +if not args.no_confirm: + if 'yes' != input('Do you want to continue? (please answer yes or no) '): + print('\nYou decided to cancel...') for i in range(len(filtered_projects)): @@ -101,8 +108,10 @@ for i in range(len(filtered_projects)): dst_name = src_name.replace(' ','-') print('\n\nMigrating project %s to project %s now.'%(src_url,dst_name)) - if 'yes' != input('Do you want to continue? (please answer yes or no) '): - print('\nYou decided to cancel...') + + if not args.no_confirm: + if 'yes' != input('Do you want to continue? (please answer yes or no) '): + print('\nYou decided to cancel...') # Create repo if args.add_to_private: @@ -133,6 +142,7 @@ for i in range(len(filtered_projects)): print('\n\nFinished migration. New project URL is %s'%dst_info['html_url']) print('Please open the URL and check if everything is fine.') - input('Hit any key to continue!') + if not args.no_confirm: + input('Hit any key to continue!') print('\n\nEverything finished!\n')