合并后无法推送到远程仓库
分支出去 -
[default]$ hg branch talks
[talks]$ <... some commits ...>
[talks]$ hg update default
合并回来 -
[default]$ hg merge talks
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
推送到远程仓库 -
[default]$ hg commit -m "merging talks to default"
[default]$ $ hg push
abort: push creates new remote branches: talks!
(use 'hg push --new-branch' to create new remote branches)
进一步调查显示远程仓库不希望我在远程端有多个头。但我只是做了一次合并,将两个头合并为一个,不是吗?
来自 hgserve
的图表似乎也同意我的观点(我希望)
但是,我还看到来自 hg faces
的两个头像
[default]$ hg branches
default 9:85752ecd6326
talks 8:2b00714d76d5 (inactive)
branching out -
[default]$ hg branch talks
[talks]$ <... some commits ...>
[talks]$ hg update default
merging back -
[default]$ hg merge talks
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
pushing to remote repo -
[default]$ hg commit -m "merging talks to default"
[default]$ $ hg push
abort: push creates new remote branches: talks!
(use 'hg push --new-branch' to create new remote branches)
Further investigation revealed that remote repo doesn't want me to have multiple heads at the remote end. But I just did a merge to merge the two heads into one, isn't it?
The graph from hg serve
also seems to agree with me (I hope)
However, I also see two heads from hg heads
[default]$ hg branches
default 9:85752ecd6326
talks 8:2b00714d76d5 (inactive)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
解决方案在中止消息中:
use 'hg push --new-branch'
。您已经创建了一个名为talks
的命名分支,因此它需要这个额外的开关,无论您是否已将命名分支合并回默认状态。The solution is in the abort message:
use 'hg push --new-branch'
. You've created a named branch calledtalks
so it needs this extra switch, regardless if you have merged the named branch back to default.我猜您误解了分支功能。您刚刚创建了一个分支,其名称将永远存在于存储库中。我怀疑你并不是真的想这么做。您可能想要研究本地分支的书签功能,这些分支的名称最终不会永远存在于存储库中。
Mercurial 会拒绝将新的全局分支名称添加到要推送到的存储库中,因为这很少是您真正想要做的事情。
hg push --new-branch
将告诉 Mercurial 是的,您确实打算这样做。您看到的两个头具有误导性。请注意其中一个头如何被列为“(非活动)”。这仅意味着这是全局分支上的最后一个更改,但不是实际的头部。您经常希望看到分支的头,即使这些头实际上有子项并且不是真正的头。
顺便说一句......我不久前编写了将该功能添加到“heads”命令中的代码。 :-)
I'm guessing you've misunderstood the branch feature. You've just created a branch who's name will live forever in the repository. I suspect you didn't really want to do this. You might want to investigate the bookmarks feature for local branches that don't end up with names that live forever in the repository.
Mercurial balks at pushes that add new global branch names to the repository being pushed to because that's so very rarely what you really want to do.
hg push --new-branch
will tell Mercurial that yes, you really mean to do that.The two heads you're seeing are misleading. Notice how one head is listed as '(inactive)'. That just means it's the last change on the global branch, but not an actual head. You frequently want to see the heads of branches, even if those heads actually have children and are not really heads.
As a small aside... I wrote the code that added that feature to the 'heads' command awhile back. :-)