[PATCH] D60664: [git-svn] Add a username option for puch command

Tamás Zolnai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 14 05:57:56 PDT 2019


ztamas created this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Useful when svn username differs from the local username.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D60664

Files:
  llvm/utils/git-svn/git-llvm


Index: llvm/utils/git-svn/git-llvm
===================================================================
--- llvm/utils/git-svn/git-llvm
+++ 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(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60664.195059.patch
Type: text/x-patch
Size: 1886 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190414/79a955c1/attachment.bin>


More information about the llvm-commits mailing list