diff options
author | Valentin Churavy <v.churavy@gmail.com> | 2019-12-16 04:35:14 -0500 |
---|---|---|
committer | Valentin Churavy <v.churavy@gmail.com> | 2019-12-16 16:51:43 -0500 |
commit | 38dd2d50924a3795d1ad61c7c0873632255f324a (patch) | |
tree | 5681f02256e08d88a9083c7bbf9df4f97db0e2eb /llvm/utils/git-svn/git-llvm | |
parent | f933878991a9b00f3fcf96066678a8816da0a764 (diff) | |
download | bcm5719-llvm-38dd2d50924a3795d1ad61c7c0873632255f324a.tar.gz bcm5719-llvm-38dd2d50924a3795d1ad61c7c0873632255f324a.zip |
git-llvm: Add option to push to Github with SSH
Summary:
For users with 2FA Github password challenge can be rather cumbersome
and I personally use key based authentication through SSH. This fixes
the SSH feature that was present and exposes it as a command line
option.
Reviewers: tstellar
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71534
Diffstat (limited to 'llvm/utils/git-svn/git-llvm')
-rwxr-xr-x | llvm/utils/git-svn/git-llvm | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/llvm/utils/git-svn/git-llvm b/llvm/utils/git-svn/git-llvm index 5ebfcf1bde2..bc60e02aae3 100755 --- a/llvm/utils/git-svn/git-llvm +++ b/llvm/utils/git-svn/git-llvm @@ -206,7 +206,7 @@ def get_fetch_url(): def get_push_url(user='', ssh=False): if ssh: - return 'ssh://{}'.format(GIT_URL) + return 'ssh://git@{}'.format(GIT_URL) return 'https://{}'.format(GIT_URL) @@ -221,7 +221,7 @@ def get_revs_to_push(branch): return commits -def git_push_one_rev(rev, dry_run, branch): +def git_push_one_rev(rev, dry_run, branch, ssh): # Check if this a merge commit by counting the number of parent commits. # More than 1 parent commmit means this is a merge. num_parents = len(git('show', '--no-patch', '--format="%P"', rev).split()) @@ -237,7 +237,7 @@ def git_push_one_rev(rev, dry_run, branch): return # Second push to actually push the commit - git('push', get_push_url(), '{}:{}'.format(rev, branch), print_raw_stderr=True) + git('push', get_push_url(ssh=ssh), '{}:{}'.format(rev, branch), print_raw_stderr=True) def cmd_push(args): @@ -261,7 +261,7 @@ def cmd_push(args): die("Aborting") for r in revs: - git_push_one_rev(r, dry_run, args.branch) + git_push_one_rev(r, dry_run, args.branch, args.ssh) if __name__ == '__main__': @@ -293,6 +293,13 @@ if __name__ == '__main__': 'repo, so probably will not work well if you try to commit more ' 'than one rev.') parser_push.add_argument( + '-s', + '--ssh', + dest='ssh', + action='store_true', + help='Use the SSH protocol for authentication, ' + 'instead of HTTPS with username and password.') + parser_push.add_argument( '-f', '--force', action='store_true', |