Ask Your Question
1

Merge conflict during patch submission

asked 2014-11-19 05:01:04 -0500

Ankur gravatar image

updated 2014-11-20 12:28:39 -0500

smaffulli gravatar image

Every time when I try to submit patch for below review- https://review.openstack.org/#/c/135230/

I got below mwssage from jenkins-

Merge Failed.

This change was unable to be automatically merged with the current state of the repository. Please rebase your change and upload a new patchset.

I followed below guide to resolve the issue- http://www.mediawiki.org/wiki/Gerrit/... section "Build failed due to merge conflict".

Below are command execution logs-

$ vi nova/tests/unit/virt/ironic/test_driver.py  --> made changes

$ pep8 nova/tests/unit/virt/ironic/test_driver.py   --> verified with pep8

$ flake8 nova/tests/unit/virt/ironic/test_driver.py  ---> verified eith flake8

$ git status  

On branch bug/1325906
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)

modified:   nova/tests/unit/virt/ironic/test_driver.py
no changes added to commit (use "git add" and/or "git commit -a")

$ git add nova/tests/unit/virt/ironic/test_driver.py

$ git status

On branch bug/1325906
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)

modified:   nova/tests/unit/virt/ironic/test_driver.py

$ git cherry-pick --continue

error: no cherry-pick or revert in progress
fatal: cherry-pick failed

$ git review -x 135554

Downloading refs/changes/54/135554/1 from gerrit
There was a problem applying changeset contents to the current branch.
The following command failed with exit code 128
git cherry-pick FETCH_HEAD
-----------------------
error: Your local changes would be overwritten by cherry-pick. 
hint: Commit your changes or stash them to proceed.
fatal: cherry-pick failed
-----------------------

$ git commit -a --amend 

[bug/1325906 10d8852] Moves node resource tests to a separate testcase
 2 files changed, 98 insertions(+), 92 deletions(-)

$ git push gerrit HEAD:refs/for/master/bug/1325906

Counting objects: 51, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (9/9), done.
Writing objects: 100% (9/9), 1.62 KiB | 0 bytes/s, done.
Total 9 (delta 7), reused 0 (delta 0)
remote: Resolving deltas: 100% (7/7)
remote: Processing changes: updated: 1, refs: 1, done    
To ssh://ankur@review.openstack.org:29418/openstack/nova.git
 * [new branch]      HEAD -> refs/for/master/bug/1325906

Please confirm if I should abandon the the existing review and create new? I have already done it once, so I don't want to make another abandon review.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2014-11-19 08:09:01 -0500

smaffulli gravatar image

If the merge conflict has not been resolved after the rebase then there is something weird going on. Make sure that you rebases successfully first. Keep editing the question adding more details about the branch you have in your local repository and the steps you're actually following. Copy and paste also the exact messages you have in your terminal.

edit flag offensive delete link more
1

answered 2014-11-19 08:20:40 -0500

updated 2014-11-20 10:37:44 -0500

[Edited based on subsequent discussion of this question.]

It looks like the child commit 135554 depending on 135230 was created in error (it consists only of irrelevant whitespace changes) and so I have abandoned it for you. I used this cherry-pick workflow to update your patch:

git clean -dfx
git reset --hard
git remote update
git checkout -B bug/1325906 --no-track origin/master
git review -x 135230
    [manually edit test-requirements.txt to update the testtools entry so that it matches HEAD]
git add test-requirements.txt
git cherry-pick --continue
git review

The subsequent transcript:

~/openstack/nova$ git clean -dfx
~/openstack/nova$ git reset --hard
HEAD is now at 3e2147e Moves node resource tests to a separate testcase
~/openstack/nova$ git remote update
Fetching origin
remote: Counting objects: 171, done.
remote: Compressing objects: 100% (98/98), done.
remote: Total 99 (delta 81), reused 12 (delta 1)
Unpacking objects: 100% (99/99), done.
From git://git.openstack.org/openstack/nova
   b7eff23..a6cde20  master     -> origin/master
Fetching gerrit
From ssh://review.openstack.org:29418/openstack/nova
   b7eff23..a6cde20  master     -> gerrit/master
~/openstack/nova$ git checkout -B bug/1325906 --no-track origin/master
Reset branch 'bug/1325906'
~/openstack/nova$ git review -x 135230
Downloading refs/changes/30/135230/5 from gerrit
Traceback (most recent call last):
  File "/usr/local/bin/git-review", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/git_review/cmd.py", line 1185, in main
    cherrypick_review()
  File "/usr/local/lib/python2.7/site-packages/git_review/cmd.py", line 958, in cherrypick_review
    print(run_command_exc(PatchSetGitCherrypickFailed, *cmd))
  File "/usr/local/lib/python2.7/site-packages/git_review/cmd.py", line 152, in run_command_exc
    raise klazz(rc, output, argv, env)
git_review.cmd.PatchSetGitCherrypickFailed: There was a problem applying changeset contents to the current branch.
The following command failed with exit code 1
    "git cherry-pick FETCH_HEAD"
-----------------------
error: could not apply 10d8852... Moves node resource tests to a separate testcase
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
-----------------------
~/openstack/nova$ git status
On branch bug/1325906
You are currently cherry-picking commit 10d8852.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:

        modified:   nova/tests/unit/virt/ironic/test_driver.py

Unmerged paths:
  (use "git add <file>..." to mark resolution)

        both modified:   test-requirements.txt

~/openstack/nova$ vi test-requirements.txt
~/openstack/nova$ git add test-requirements.txt
~/openstack/nova$ git cherry-pick --continue
[bug/1325906 16bdc9a] Moves node resource tests to a separate testcase
 Author: ankur <ankur.gupta@nectechnologies.in>
 2 files changed, 98 insertions(+), 92 deletions(-)
~/openstack/nova$ tox -r -e pep8
nova/tests/unit/virt/ironic/test_driver.py
pep8 create: /home/foo/openstack/nova/.tox/pep8
pep8 installdeps: -r/home/foo/openstack/nova/requirements.txt, -r/home/foo/openstack/nova/test-requirements.txt
pep8 develop-inst: /home/foo/openstack/nova
pep8 runtests: PYTHONHASHSEED='0'
pep8 runtests: commands[0] | flake8 nova/tests/unit/virt/ironic/test_driver.py
___________________________________ summary ____________________________________
  pep8: commands succeeded
  congratulations ...
(more)
edit flag offensive delete link more

Comments

Thanks a lot for your extended help !!

Ankur gravatar imageAnkur ( 2014-11-20 00:16:20 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2014-11-19 05:01:04 -0500

Seen: 1,955 times

Last updated: Nov 20 '14