diff --git a/llvm/utils/git-svn/git-llvm b/llvm/utils/git-svn/git-llvm --- a/llvm/utils/git-svn/git-llvm +++ b/llvm/utils/git-svn/git-llvm @@ -293,7 +293,7 @@ head, tail = os.path.split(head) return parts -def svn_push_one_rev(svn_repo, rev, dry_run): +def svn_push_one_rev(svn_repo, rev, dry_run, user_name): files = git('diff-tree', '--no-commit-id', '--name-only', '-r', rev).split('\n') if not files: @@ -369,6 +369,9 @@ commit_args = ['commit', '-m', commit_msg] if '--force-interactive' in svn(svn_repo, 'commit', '--help'): commit_args.append('--force-interactive') + if user_name: + commit_args.append('--username') + commit_args.append(user_name) log(svn(svn_repo, *commit_args)) log('Committed %s to svn.' % rev) else: @@ -397,6 +400,7 @@ rev_range = args.rev_range dry_run = args.dry_run + user_name = args.user_name revs = get_revs_to_push(rev_range) log('Pushing %d commit%s:\n%s' % (len(revs), 's' if len(revs) != 1 @@ -404,7 +408,7 @@ for c in revs))) for r in revs: clean_svn(svn_root) - svn_push_one_rev(svn_root, r, dry_run) + svn_push_one_rev(svn_root, r, dry_run, user_name) def lookup_llvm_svn_id(git_commit_hash): @@ -522,6 +526,12 @@ help="revs to push (default: everything not in the branch's " 'upstream, or not in origin/master if the branch lacks ' 'an explicit upstream)') + parser_push.add_argument( + '--username', + type=str, + dest='user_name', + help='User can specify the user name explicitly if it\'s different ' + 'from the local user name.') parser_push.set_defaults(func=cmd_push) parser_revert = subcommands.add_parser(