Index: llvm/utils/git-svn/git-llvm =================================================================== --- llvm/utils/git-svn/git-llvm +++ llvm/utils/git-svn/git-llvm @@ -99,6 +99,21 @@ sys.exit(1) +def ask_confirm(prompt): + # Python 2/3 compatibility + try: + read_input = raw_input + except NameError: + read_input = input + + while True: + query = read_input('%s (y/N): ' % (prompt)) + if query.lower() not in ['y','n', '']: + print('Expect y or n!') + continue + return query.lower() == 'y' + + def split_first_path_component(d): # Assuming we have a git path, it'll use slashes even on windows...I hope. if '/' in d: @@ -427,6 +442,12 @@ 's' if len(revs) != 1 else '', '\n'.join(' ' + git('show', '--oneline', '--quiet', c) for c in revs))) + + # Ask confirmation if multiple commits are about to be pushed + if len(revs) != 1: + if not ask_confirm("Are you sure you want to create %d commits?" % len(revs)): + die("Aborting") + for r in revs: clean_svn(svn_root) svn_push_one_rev(svn_root, r, git_to_svn_mapping, dry_run)