From 52eb5933a8f583b16b75c730ee9c243c2d860191 Mon Sep 17 00:00:00 2001 From: "alokp@chromium.org" Date: Fri, 25 Mar 2016 04:35:53 +0000 Subject: [PATCH] Use tracking remote name for gerrit upload. This patch replaces the hard-coded remote name 'origin' with the one obtained by git-remote. Review URL: https://codereview.chromium.org/1830313002 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@299491 0039d316-1c4b-4281-b951-d872f2087c98 --- git_cl.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/git_cl.py b/git_cl.py index 59e412123..912601020 100755 --- a/git_cl.py +++ b/git_cl.py @@ -2203,10 +2203,6 @@ def GenerateGerritChangeId(message): def GerritUpload(options, args, cl, change): """upload the current branch to gerrit.""" - # We assume the remote called "origin" is the one we want. - # It is probably not worthwhile to support different workflows. - gerrit_remote = 'origin' - remote, remote_branch = cl.GetRemoteBranch() branch = GetTargetRef(remote, remote_branch, options.target_branch, pending_prefix='') @@ -2268,7 +2264,7 @@ def GerritUpload(options, args, cl, change): DownloadGerritHook(False) change_desc.set_description(AddChangeIdToCommitMessage(options, args)) ref_to_push = 'HEAD' - parent = '%s/%s' % (gerrit_remote, branch) + parent = '%s/%s' % (remote, branch) change_id = git_footers.get_footer_change_id(change_desc.description)[0] commits = RunGitSilent(['rev-list', '%s..%s' % (parent, @@ -2299,7 +2295,7 @@ def GerritUpload(options, args, cl, change): if receive_options: git_command.append('--receive-pack=git receive-pack %s' % ' '.join(receive_options)) - git_command += [gerrit_remote, ref_to_push + ':refs/for/' + branch] + git_command += [remote, ref_to_push + ':refs/for/' + branch] push_stdout = gclient_utils.CheckCallAndFilter( ['git'] + git_command, print_stdout=True,