如何仅将汞推入一个分支? [英] How to only push to one branch in Hg?

查看:88
本文介绍了如何仅将汞推入一个分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Hg仓库,其中有3个分支,但是其中两个处于非活动状态(因为我已经将它们合并到默认分支中). hg头显示3个头,每个分支一个,即使 hg分支将这些分支中的2个表示为不活动".

I have a Hg repo with 3 branches in it, but two of them are inactive (since I have already merged them into my default branch). hg heads shows 3 heads, one for each branch, even though hg branches shows 2 of those branches as 'inactive'.

当我尝试将默认分支(使用 hg push --branch default http://... )推送到另一个存储库时,合并中止,并显示消息中止:推送创建"新的远程分支机构:!"

When I try to push my default branch (using hg push --branch default http://...) to another repo, the merge is aborted with the message "abort: push creates new remote branches: !"

在Hg推入手册页中,默认情况下,推入将不允许在目标位置创建新的头部,因为多个头部将使其不清楚要使用哪个头部.在这种情况下,建议先拉并合并推."

From the Hg push man pages, "By default, push will not allow creation of new heads at the destination, since multiple heads would make it unclear which head to use. In this situation, it is recommended to pull and merge before pushing."

我已经这样做了,但是我仍然不能在不中断--branch default的情况下使用它.

I've already done that, but I still cant push --branch default without it getting aborted.

感谢您的帮助.谢谢!

推荐答案

如果default上的变更集在其他分支上具有祖先变更集,则也必须推送这些变更集.没有所有变更集也都存在的仓库中,变更集是不可能存在的.

If changesets on default have ancestor changesets on other branchs you have to push those changesets too. It's not possible for a changeset to exist in a repo without all of its changesets also existing.

所以尝试:

hg push --branch default --new-branch

上面写着是的,我知道此推送发送的是远程仓库之前从未见过的分支名称"(它也需要Mercurial 1.6或更高版本的IIRC)>

which says "yeah, I know this push sends across a branch name that the remote repo hasn't previously seen before" (it also requires Mercurial 1.6 or later IIRC)>

此外,您可以使用以下这些无效的头使它们成为封闭的头:

Also, you can take those inactive heads and make them closed heads with:

hg update thebranch
hg commit --close-branch -m 'closing'

因为命名分支永远存在",所以许多人选择保留它们以保存稳定"和实验性"等长期存在的概念,并使用书签,匿名分支或功能,发行版和其他暂时性事物的克隆.有关其他选项,请参见指南.

Because "named branches are forever" many folks choose to reserve them for long lived concepts like "stable" and "experimental" and use bookmarks, anonymous branches, or clones for features, releases, and other transitory things. See this for a guide on those other options.

这篇关于如何仅将汞推入一个分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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