推送 Mercurial 仓库而不推送子仓库
我正在使用 Mercurial 1.6。我有一个带有几个子存储库的存储库 (11)。我想将父存储库推送到默认远程存储库,而不推送子存储库。想要这样做的原因包括:
- 我正在使用 SSH 存储库,需要很长时间才能建立连接并且不向每个子存储库推送任何内容。
- 我在子存储库中有提交,但我不想传播到远程存储库(还)。
- 子存储库已指定不应传播到 repot 存储库的分支(并且显然无法将分支名称传递给子存储库的推送操作)。
但是,我一直无法找到实现此目标的方法。我尝试删除 .hgsub 和 .hgsubstate 的内容(不提交),但 Mercurial 仍然坚持推送子存储库。
如何将更改从本地存储库推送到远程存储库并暂时忽略子存储库?
I'm using Mercurial 1.6. I have a repo with a few subrepos (11). I would like to push the parent repo to the default remote repo without pushing the child repos. Reasons for wanting to do this include:
- I'm using SSH repos, and it takes a long time to establish a connection and push nothing to each of the subrepos.
- I have commits in subrepos I don't want propagated to the remote repos (yet).
- Subrepos have named branches that should not be propagated to the repote repos (and there's apparently no way to pass branch names to the push operation of the subrepos).
However, I've been unable to find a way to accomplish this. I tried deleting the content of .hgsub and .hgsubstate (without committing), but still mercurial insists on pushing the subrepos.
How can I push the changes from the local repo to the remote repo and ignore the subrepos temporarily?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您需要制作子存储库的本地克隆。
推送主存储库而不推送子存储库的问题在于,子存储库的内容不是主存储库的一部分 - 只有它们的状态才是。内容是从
.hgsub
中指定的原始位置引用的。因此,您的主存储库的.hgsubstate
表示“子存储库 A 的版本为 abcd1234”,但 abcd1234 是您所做的更改,您不想推送...现在如果您克隆了会发生什么主要回购?它会尝试从原始位置克隆子存储库并将其更新为 abcd1234,但原始位置不存在该修订版本,因此克隆将失败。相反,您可以对每个外部存储库进行本地克隆,并将这些外部存储库引用为子存储库的外部位置。然后,当您推送主存储库时,子存储库更改将仅传播到您的本地克隆。当您准备好共享这些更改时,只需转到本地克隆并从那里推送,您就可以传递分支名称等。
I think you'll need to make local clones of the subrepos.
The problem with pushing the main repo without pushing the subrepos is that the contents of the subrepos are not part of the main repo - only their states are. The contents are referenced from the original location specified in
.hgsub
. So your main repo's.hgsubstate
says "subrepo A is at revision abcd1234", but abcd1234 is a change you made that you don't want to push... and now what would happen if you cloned the main repo? It'd try to clone the subrepo from its original location and update it to abcd1234, but that revision doesn't exist in the original location, so the clone would fail.Instead, you can make local clones of each external repository and reference those as the external locations of the subrepos. Then when you push the main repo, the subrepo changes will only propagate to your local clones. When you're ready to share those changes, just go over to the local clones and push from there, and you'll be able to pass branch names and so on.