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 @@ -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)