如何防止不同的水银分支合并?
我有一个存储在 Mercurial 中的项目,该项目已经远远超出了其最初的职责范围,现在我想将存储库拆分为两个单独的项目。假设文件树看起来像这样:
src/
a/
a.h
a.c
b/
b.h
b.c
假设我已经 hg clone
d 这个存储库两次,并且在第一次克隆中我执行了 hg rm src/b/*
,第二次我执行了 hg rm src/a/*
。这为我提供了我想要的两个独立的源代码树,每个分支中都保留了历史记录和修订编号。
我现在遇到的问题是,如果将来我不小心从 a/ 克隆拉入 b/ 克隆,会发生什么。我希望 Mercurial 能够简单地拒绝从另一个分支拉出或推送到另一个分支(如果我尝试这样做),就好像两者从未共享过历史一样。
这可能吗?如果没有,是否有一种规范的方法可以从一个原始项目创建两个并行项目,从而保留历史记录和修订编号?
I have a project stored in mercurial which has grown well beyond its original remit, and now I want to split the repository into two separate projects. Say the file tree looks something like this:
src/
a/
a.h
a.c
b/
b.h
b.c
Say I've hg clone
d this repository twice, and in the first clone I've performed an hg rm src/b/*
, and in the second I've performed an hg rm src/a/*
. This gives me the two separate source trees I want, with history and revision numbering preserved in each branch.
The problem I now have is what happens if, in the future, I ever accidentally pull from the a/ clone into the b/ clone. What I'd like is for mercurial to simply refuse to pull from, or push to, the other branch, if I ever try to do so, as if the two had never shared history.
Is this possible? If not, is there a canonical way to create two parallel projects from one original which preserves history and revision numbering?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
规范的方法是使用 hg Convert 与这样的文件映射:(
然后使用
a
和b
的角色颠倒以创建第二个存储库)这样您最终会得到两个不相关的存储库(Mercurial 将拒绝在不使用强制的情况下推/拉)仅包含单个目录的历史记录。
另请参阅此问题以供参考。
The canonical way would be to use hg convert with a filemap like this:
(and afterwards with the roles of
a
andb
reversed to create the second repository)This way you end up with two unrelated repositories (which Mercurial will refuse to push/pull without the use of force) only containing the history of a single directory.
Also see this question for reference.