0

I have a question about whether should push cherrypicked update to gerrit.

My code needs some other code in order to build, and those code is already pushed to gerrit but not merged. I cherrypicked that push and put my code on the top of it. And my code build successfully. Then I only pushed my code to gerrit, and this caused gerrit build failure, I am sure I did not miss any file from my code, what is the reason? Can someone help on this?

ratzip
  • 1,571
  • 7
  • 28
  • 53

1 Answers1

1

The commit you upload should have the unmerged commit as its parent. Not a cherry-picked copy of the unmerged commit but that exact commit. When you upload your commit, it'll have its parent commit listed as a dependency and you won't be able to submit your change until the parent has been submitted.

This is how you can create and check out a new topic branch based on a uploaded but not merged commit (patch set 1 of change 8):

git fetch git://git.example.com/name-of-git refs/changes/08/8/1
git checkout -b mytopic FETCH_HEAD

The exact git fetch command can be obtained from Gerrit's change screen. Make your changes, commit, and push to Gerrit like you'd usually do.

Magnus Bäck
  • 11,381
  • 3
  • 47
  • 59
  • thank you, it really help, but I did not upload cherry-picked unmerged commit which my code depends on, I uploaded only my code, is this the reason why it builds failed in gerrit? – ratzip Oct 08 '14 at 13:47
  • Yes. The tool that downloads new changes from Gerrit and attempts to build the code has no knowledge of the dependency you're talking about since it checks out the exact commit you upload. – Magnus Bäck Oct 08 '14 at 14:22