[PATCH] D69362: [git-llvm] Allow pushing commits over ssh.

Artem Belevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 23 17:08:30 PDT 2019


tra created this revision.
tra added a reviewer: jyknight.
Herald added subscribers: sanjoy.google, bixia.
Herald added a project: LLVM.

- Added -s option to allow pushing commits over ssh.
- Set default branch to 'master'.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69362

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
@@ -204,10 +204,10 @@
     return 'https://{}'.format(GIT_URL)
 
 
-def get_push_url(user='', token='', ssh=False):
+def get_push_url(user='', token=''):
 
-    if ssh:
-        return 'ssh://{}'.format(GIT_URL)
+    if token is None:
+        return 'ssh://git@{}'.format(GIT_URL)
 
     return 'https://{}@{}'.format(token, GIT_URL)
 
@@ -264,7 +264,10 @@
     # FIXME: I'm really trying to avoid prompting twice for the password, the only
     # way I can see to do that is require an authentication token instead of a
     # password, because you can embedded authentication tokens into the URL.
-    github_token = getpass.getpass("Auth token for https://github.com':")
+    if args.use_ssh:
+      github_token = None
+    else:
+      github_token = getpass.getpass("Auth token for https://github.com':")
     g = github.Github(github_token)
     for r in revs:
         git_push_one_rev(r, dry_run, args.branch, g, github_token)
@@ -308,8 +311,14 @@
         metavar='GIT_BRANCH',
         type=str,
         nargs='?',
-        help="branch to push (default: everything not in the branch's "
-        'upstream)')
+        default='master',
+        help="branch to push to (default: master)")
+    parser_push.add_argument(
+        '-s',
+        '--ssh',
+        dest='use_ssh',
+        action='store_true',
+        help='Use SSH to push commits.')
     parser_push.set_defaults(func=cmd_push)
 
     args = p.parse_args(argv)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69362.226194.patch
Type: text/x-patch
Size: 1609 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191024/8f90c19f/attachment.bin>


More information about the llvm-commits mailing list