Uploading a change based on someone else's change?

163 views
Skip to first unread message

Julia Tuttle

unread,
Jan 24, 2018, 3:56:58 PM1/24/18
to chromium-dev
Hi,

I'm trying to upload a change to Gerrit that's based on someone else's change. Here's what I've done so far:

1. Make a new local branch and use "git cl patch --force" to get the someone else's CL.
2. Confirm in .git/config that the local branch is properly labeled with the Gerrit ID.
3. Rebase my existing work on top of the new branch and resolve conflicts.
4. Upload the change and run trybots.

When I do this, all the trybots fail with "patch failure". If I use "git cl patch" without "--force", or if I rebase the parent branch onto master, I can build my work branch locally but "git cl upload" won't let me upload because the parent branch is not uploaded.

What am I missing here?

Thanks,

Julie

dan...@chromium.org

unread,
Jan 24, 2018, 3:59:35 PM1/24/18
to julia...@chromium.org, chromium-dev
Gerrit has a "download" link in the top right of the CL file-list that gives you urls that you can use to check out the branch you want to work on top of. In rietveld this was just a way to get a .diff file, so it's easy to ignore with it's name not suggesting anything more.

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CADyrwZRVECKxdwTJhmH8Rd7xaSiO4DprqLFfL0UebuMx1KM%2BMA%40mail.gmail.com.

Ken Rockot

unread,
Jan 24, 2018, 3:59:54 PM1/24/18
to julia...@chromium.org, chromium-dev
Have you actually set your local working branch's upstream to the your local someone-else's-CL branch before upload? If you do that gerrit should do the right thing.

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+unsubscribe@chromium.org.

Ian Clelland

unread,
Jan 24, 2018, 3:59:54 PM1/24/18
to julia...@chromium.org, chromium-dev
Have you set the parent of the branch with your change to be the branch with the other person's change? I'll usually do something like

git checkout my-branch
git branch --set-upstream-to=parent-branch
git cl upload

(I think that other people have fancy shorthand to do the same thing, but that works for me)


--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.

Ken Rockot

unread,
Jan 24, 2018, 4:00:26 PM1/24/18
to Ian Clelland, julia...@chromium.org, chromium-dev
Shorthand is git branch -u parent

To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+unsubscribe@chromium.org.

Julia Tuttle

unread,
Jan 24, 2018, 4:02:09 PM1/24/18
to Ken Rockot, chromium-dev
On Wed, Jan 24, 2018 at 3:59 PM Ken Rockot <roc...@google.com> wrote:
Have you actually set your local working branch's upstream to the your local someone-else's-CL branch before upload? If you do that gerrit should do the right thing.

*checks* Yup! It is set as both "base-upstream" and "merge" in the relevant section of .git/config.

Julia Tuttle

unread,
Jan 24, 2018, 4:04:27 PM1/24/18
to dan...@chromium.org, chromium-dev
On Wed, Jan 24, 2018 at 3:58 PM <dan...@chromium.org> wrote:
Gerrit has a "download" link in the top right of the CL file-list that gives you urls that you can use to check out the branch you want to work on top of. In rietveld this was just a way to get a .diff file, so it's easy to ignore with it's name not suggesting anything more.

Tried that, it got me to the same commit that "git cl patch --force" did.

dan...@chromium.org

unread,
Jan 24, 2018, 4:06:37 PM1/24/18
to Julia Tuttle, chromium-dev
In my experience, doing this instead of git cl patch gets me in a state that git cl upload will work from though. If not then maybe something else is going on :(
 

Julia Tuttle

unread,
Jan 24, 2018, 4:07:24 PM1/24/18
to dan...@chromium.org, chromium-dev

When you do that, what do you do with the commit it checks out? Do you make that into a separate branch and then write your code in one on top of that?

Julia Tuttle

unread,
Jan 24, 2018, 4:09:41 PM1/24/18
to dan...@chromium.org, chromium-dev
On Wed, Jan 24, 2018, 16:08 <dan...@chromium.org> wrote:
On Wed, Jan 24, 2018 at 4:06 PM, Julia Tuttle <julia...@chromium.org> wrote:

When you do that, what do you do with the commit it checks out? Do you make that into a separate branch and then write your code in one on top of that?

Yes I make it a branch locally, and checkout another branch on top of it, with the first as its parent via git branch -u

That's what I did, and it's still not working.

dan...@chromium.org

unread,
Jan 24, 2018, 4:09:41 PM1/24/18
to Julia Tuttle, chromium-dev
On Wed, Jan 24, 2018 at 4:06 PM, Julia Tuttle <julia...@chromium.org> wrote:

When you do that, what do you do with the commit it checks out? Do you make that into a separate branch and then write your code in one on top of that?

Yes I make it a branch locally, and checkout another branch on top of it, with the first as its parent via git branch -u

 

Marijn Kruisselbrink

unread,
Jan 24, 2018, 4:20:20 PM1/24/18
to julia...@chromium.org, Dana Jansens, chromium-dev
Could it be that it's the other persons change you're trying to base your patch on that is outdated and need rebasing itself? I.e. did you look at the patch failures to see if they are in your code or in the other change?

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.

Julia Tuttle

unread,
Jan 24, 2018, 4:23:14 PM1/24/18
to Marijn Kruisselbrink, Dana Jansens, chromium-dev
It looks like Gerrit is rebasing their change and then my change onto master. Their change applies cleanly, but mine doesn't.

If I do that rebase locally and resolve the conflicts, then the patches are fine but "git cl upload" won't upload them because I'm not uploading against the old version of their patch. Let me see if I can... do that rebase, undo it, and then use the fixed version anyway.

Marijn Kruisselbrink

unread,
Jan 24, 2018, 4:26:19 PM1/24/18
to Julia Tuttle, Dana Jansens, chromium-dev
You can always rebase their change first (either locally and pushing the rebase to their change, or by using the "Rebase" button in gerrit), and then rebasing your change on top of that...

Xiaocheng Hu

unread,
Jan 24, 2018, 4:27:58 PM1/24/18
to julia...@chromium.org, Marijn Kruisselbrink, Dana Jansens, chromium-dev
I did that before and it worked:

1. Download someone else's patch (say, crrev.com/c/123456) a local branch (say, LocalCopy) with git pull (not sure if this matters)
2. In LocalCopy, git cl issue 123456 && git cl upload and ignore any warning, which covers CL123456 with a rebase from your own local branch.
3. git checkout -b YourOwnChange && git branch --set-upstream-to=LocalCopy
4. Do your own change and git cl upload as usual

The drawback is that when CL123456 got landed, the "author" line in the commit message is me instead of the original author so I ended up stealing a patch...


Julia Tuttle

unread,
Jan 24, 2018, 4:31:00 PM1/24/18
to Xiaocheng Hu, Marijn Kruisselbrink, Dana Jansens, chromium-dev
Yeah, I don't want to modify their patch. It sounds like this actually isn't possible with Gerrit.

Jan Wilken Dörrie

unread,
Jan 24, 2018, 5:14:53 PM1/24/18
to julia...@chromium.org, Xiaocheng Hu, Marijn Kruisselbrink, Dana Jansens, chromium-dev
I might be wrong, but I think depot tools provide some scripts to achieve what you want. I just created a sample CL based on someone else's unsubmitted work here, and it passes the try jobs: https://crrev.com/c/883286

I did the following:
1. git cl patch -b someone_elses_work -f 123456
2. git new-branch --upstream_current my_branch
3. Commit my changes and follow up with `git cl upload && git cl try`

In case you already have an existing local branch with your work you should be able to do

1. git cl patch -b someone_elses_work -f 123456
2. git checkout my_branch
3. git reparent-branch someone_elses_work

to track their changes via rebasing.


Julia Tuttle

unread,
Jan 24, 2018, 5:34:09 PM1/24/18
to Jan Wilken Dörrie, Xiaocheng Hu, Marijn Kruisselbrink, Dana Jansens, chromium-dev
The problem with mine is that it won't apply against the version of master that the other person's change was based on, and git cl upload won't let me upload a rebased version because that involves rebasing their change too.

Tommy Nyquist

unread,
Jan 24, 2018, 5:45:45 PM1/24/18
to julia...@chromium.org, Jan Wilken Dörrie, Xiaocheng Hu, Marijn Kruisselbrink, Dana Jansens, chromium-dev
Could you rebase your branch to the same point as their CL, and sync the rest of the chromium repository using 'gclient sync -r src@HEAD'? Or do you need the changes that arrived later for your CL to work?

Reply all
Reply to author
Forward
0 new messages