Commit 95ffb615 authored by tandrii@chromium.org's avatar tandrii@chromium.org

Revert of Use tracking remote name for gerrit upload. (patchset #1 id:1 of...

Revert of Use tracking remote name for gerrit upload. (patchset #1 id:1 of https://codereview.chromium.org/1830313002/ )

Reason for revert:
Argh, this has broken uploading track-ed branches.
Repro:

git new-branch base-feature
touch x1 && git add x1 && git commit -m "x1"
git cl upload
git new-branch --upstream_current dep-feature
touch y1 && git add y1 && git commit -m "y1"
git cl upload -v -v # fails.


the verbose output produces this:
---cut---
DEBUG:root:git push . 7079b1682431184375b62e7e81ce10a02171aa0d:refs/for/refs/heads/master
To .
 ! [rejected]        7079b1682431184375b62e7e81ce10a02171aa0d -> refs/for/refs/heads/master (non-fast-forward)
error: failed to push some refs to '.'
---cut---

Original issue's description:
> Use tracking remote name for gerrit upload.
> 
> This patch replaces the hard-coded remote name 'origin' with the
> one obtained by git-remote.
> 
> Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=299491

TBR=iannucci@chromium.org,ukai@chromium.org,alokp@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.

Review URL: https://codereview.chromium.org/1835923002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@299509 0039d316-1c4b-4281-b951-d872f2087c98
parent 39b24c3a
......@@ -2465,6 +2465,10 @@ 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='')
......@@ -2526,7 +2530,7 @@ def GerritUpload(options, args, cl, change):
DownloadGerritHook(False)
change_desc.set_description(AddChangeIdToCommitMessage(options, args))
ref_to_push = 'HEAD'
parent = '%s/%s' % (remote, branch)
parent = '%s/%s' % (gerrit_remote, branch)
change_id = git_footers.get_footer_change_id(change_desc.description)[0]
commits = RunGitSilent(['rev-list', '%s..%s' % (parent,
......@@ -2557,7 +2561,7 @@ def GerritUpload(options, args, cl, change):
if receive_options:
git_command.append('--receive-pack=git receive-pack %s' %
' '.join(receive_options))
git_command += [remote, ref_to_push + ':refs/for/' + branch]
git_command += [gerrit_remote, ref_to_push + ':refs/for/' + branch]
push_stdout = gclient_utils.CheckCallAndFilter(
['git'] + git_command,
print_stdout=True,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment