Bitbucket / Mercurial:无法推送命名分支(关闭之前的同名分支)

时间:2013-08-02 21:46:55

标签: mercurial push bitbucket remote-branch

我正在尝试将包含命名分支的变更集推送到Bitbucket上托管的Mercurial存储库,并且我收到push creates a new remote head (did you forget to merge?)错误。无论是否指定--new-branch的{​​{1}}选项,都会发生这种情况。

(Mercurial文档建议在这种情况下“在推送之前拉动并合并”,但是当我运行hg push时,它报告“未发现任何变化”,即Bitbucket仓库中没有任何内容在我当地的回购中。)

正如标题所示,我的情景可能与我所看到的行为有关,我将尝试在下面解释:

我想要推送到Bitbucket仓库的分支的名称实际上与我之前成功推送的分支的名称相同,但后来通过hg incoming关闭,因为我错误地创建了它与错误的父级修订。

(这是一个很长的故事,为什么新的分支名称必须与旧分支名称相同 - 但确实如此。)

我不记得第一次推动分支有任何问题。我相信我使用hg commit --close-branch来做这件事,但实际的命令已经滚动到我的命令行历史缓冲区的顶部,所以我无法证明这一点。但是,无论如何,hg push --new-branch选项这次都没有解决问题。

以下是修订历史图表:

--new-branch

我已经能够将r0到r4提交到Bitbucket仓库,但是试图推送r5(有或没有 0 0. Baseline of production code |\ 1 \ 1. Fixes to production code | \ 2 \ 2. More fixes to production code /|\ | 3 | | | 3. Import new feature drop from offshore developer (*), | | | | to named branch "drop1". (But I goofed! Parent | | | | revision should have been r0.) | | | | 4 | | | 4. "hg commit --close_branch" to prune the | | | original "drop1" branch created in error. | | | | | 5 5. Import new feature drop again, | | | this time with correct parent revision. | | | Named branch via "branch -f drop1" | | | (to shadow the name of the closed branch). | \| | 6 6. Merge bug fixes from production into drop1 | | | 7 7. Fixes to drop1 code | 8 8. Ongoing maintenance of production code 选项)给了我:

--new-branch

所以问题是:

  1. 除了使用abort: push creates new remote head 439d23090786 on branch 'drop1'! (did you forget to merge? use push -f to force) 让r5进入Bitbucket仓库,我有什么选择吗?
  2. Bitbucket的Mercurial版本是否有可能不理解原来的“drop1”分支被成功推送r4关闭,从而导致push -f失败?
  3. (*)为什么离岸开发者还没有直接使用Mercurial和Bitbucket,而不是通过电子邮件将代码丢弃作为zip存档,这个故事太难说了。]

1 个答案:

答案 0 :(得分:1)

你正在创建第二个'drop1'头,即使另一个已关闭。只需使用-f作为错误消息说明。