【发布时间】:2013-08-02 21:46:55
【问题描述】:
我正在尝试将包含命名分支的变更集推送到托管在 Bitbucket 上的 Mercurial 存储库,我收到了 push creates a new remote head (did you forget to merge?) 错误。无论我是否将--new-branch 选项指定为hg push,都会发生这种情况。
(在这种情况下,Mercurial 文档建议“在推送之前进行拉取和合并”,但是当我运行 hg incoming 时,它会报告“未找到任何更改”,也就是说,Bitbucket 存储库中没有任何内容不在我的本地仓库)。
正如标题所暗示的那样,我的场景可能与我所看到的行为有关,我将在下面尝试解释:
我尝试推送到 Bitbucket 存储库的分支名称实际上与我之前成功推送但后来通过 hg commit --close-branch 关闭的分支名称相同,因为我错误地创建了它错误的父版本。
(为什么新分支名称必须与旧分支名称相同,这是一个很长的故事 - 但它确实如此。)
我不记得第一次推送分支有什么问题。我相信我使用hg push --new-branch 来做到这一点,但实际命令现在已经滚动到我的命令行历史缓冲区的顶部,所以我无法证明这一点。不过无论如何,--new-branch 选项这次并没有解决问题。
这是修订历史的图表:
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
我已经能够将 r0 到 r4 提交到 Bitbucket 存储库,但尝试推送 r5(带或不带 --new-branch 选项)给了我:
abort: push creates new remote head 439d23090786 on branch 'drop1'!
(did you forget to merge? use push -f to force)
所以问题是:
- 除了使用
push -f将 r5 放入 Bitbucket 存储库之外,我还有其他选择吗? - 是否可能是 Bitbucket 的 Mercurial 版本不理解原始的“drop1”分支因 r4 的成功推送而关闭,从而导致
hg push --new-branch --rev 5失败?
(*) 为什么离岸开发人员尚未直接使用 Mercurial 和 Bitbucket,而不是通过电子邮件将代码删除作为 zip 存档发送给我,这是一个太可怕的故事。]
【问题讨论】:
标签: mercurial push bitbucket remote-branch