Gerrit不接受新创建的变更/分支 [英] Gerrit doesn't accept newly created change/branch

查看:1657
本文介绍了Gerrit不接受新创建的变更/分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚创建了一个新的改变,我想把它推向Gerrit。我做了(我希望)通常的方式,即创建新的分支,做魔术,提交。现在,我想推动对Gerrit的改变。所以...

$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ g $ git checkout 82-changes-and-fixes-to-files-view
git push origin HEAD:refs / for / 82-changes-and-fixes-to-files-view

,紧缩)

 ! [远程拒绝] HEAD  - > refs / for / 82-changes-and-fixes-to-files-view(branch 82-changes-and-fixes-to-files-view not found)

分支未找到?嗯......我想到了一些东西,那些文档通过Gerrit UI在推送更改之前说了一些手动创建分支的内容。我对吗?无论如何,我正在这样做。我通过UI创建了一个分支,并将其命名为 82-changes-and-fixes-to-files-view )和相应的修订版本,取自 git status 2b25fe7612f1563a78c9dc2d1574ae3dcfe9d5a1 )。并且,再次...

  git push origin HEAD:refs / for / 82-changes-and-fixes-to-files - 查看

(crunch,cruch)

 ! [远程拒绝] HEAD  - > refs / for / 82-changes-and-fixes-to-files-view(no new changes)

Eee ...我错过了什么? Gerrit如何声称没有变化,如果我真的还没有推送任何代码(当然,没有这样的变化,当然,以上名称,在Gerrit UI中打开和合并更改)?

解决方案

总是使用当前HEAD的最后一个提交ID ,而不是提交给分支的提交ID。使用分支的最后一个提交ID是错误的。为什么 - 这超出了我的想象。



所以,正确的路径是:
$ b $ ol

  • 使用UI创建分支并给HEAD修改。
  • 将更改(该分支)推送到Gerrit,不要忘记正确的参考。

  • 访问页面,Gerrit向您提供的URL是您推送的结果,并检查您的更改或等待其他人对其进行检查。
  • 或者,您可以简单地点击创建分支并将初始版本字段为空,Gerrit将自动填充它。然后再次按创建分支按钮。

    编辑:这个答案只是解释了怎么做才能让Gerrit接受更改。它没有解释,为什么在前面的方法(解释有问题)中,Gerrit声称,没有变化并且不接受代码,而实际上它根本没有代码(对于那个特定的分支)。对我而言,这是一个巨大的bug,会导致代码损失。 (根据下面的评论不正确)


    I have just created a new change, that I wish to pull to Gerrit. I did it (I hope) the usual way, i.e. create new branch, do magic, commit. Now, I want to push changes to Gerrit. So...

    git checkout 82-changes-and-fixes-to-files-view
    git push origin HEAD:refs/for/82-changes-and-fixes-to-files-view
    

    (crunch, crunch)

    ! [remote rejected] HEAD -> refs/for/82-changes-and-fixes-to-files-view (branch 82-changes-and-fixes-to-files-view not found)
    

    Branch not found? Hm... Something came to my mind, that docs said something about manually creating a branch, via Gerrit UI, before pushing changes. Am I right? Anyway, I'm doing so. I'm creating a branch, through UI, giving it above name (82-changes-and-fixes-to-files-view) and corresponding revision, taken from git status (2b25fe7612f1563a78c9dc2d1574ae3dcfe9d5a1). And, again...

    git push origin HEAD:refs/for/82-changes-and-fixes-to-files-view
    

    (crunch, cruch)

    ! [remote rejected] HEAD -> refs/for/82-changes-and-fixes-to-files-view (no new changes) 
    

    Eee... What am I missing? How can Gerrit claim, that there are no changes, if I actually haven't pushed any code to it yet (there is no such change, of course, of above name, recorded in neither open nor merged changes in Gerrit UI)?

    解决方案

    The solution to this problem is to always use current HEAD's last commit ID, not the one from commit made to your branch. Using branch's last commit ID is wrong. Why -- this is beyond my imagination.

    So, correct path is:

    1. Create branch using UI and giving HEAD's revision.
    2. Push changes (that branch) to Gerrit, don't forget about correct refs.
    3. Visit page, which URL Gerrit gave you as a result of your push and review your change or wait for someone else to review it.

    As alternative, you can simply click Create Branch with Initial Revision field empty, so Gerrit will auto-fill it. Then push Create Branch button again.

    EDIT: This answer only explains, what to do, to get change accepted by Gerrit. It doesn't explains, why in previous approach (explained in question), Gerrit is claiming, that there are no changes and does not accept the code, while it actually have not code at all (for that particular branch). For me, this is a huge bug, that leads to a code losses. (incorrect as per comment below)

    这篇关于Gerrit不接受新创建的变更/分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆