回购内的 Mercurial 回购
是否可以在现有的 Mercurial 存储库中创建 Mercurial 存储库?
这个想法是将存储库的子目录作为不同的存储库来处理,你是如何做到的?
我不是在谈论子存储库(至少,如果我理解子存储库的目的......),但如果这就是子存储库的存在方式,那么我错了,我会尽力改正:)
谢谢 ~Aki
编辑:更清楚地说,我想知道在不指定模块/子存储库的情况下在另一个存储库中拥有一个存储库会发生什么、实践和影响。 换句话说:如果我这样做:
hg init globalRepo
hg init globalRepo/subRepo
并按原样使用这两个存储库会发生什么?
Is it possible to create a mercurial repository inside an existing mercurial repository?
The idea is to handle subdirectories of a repository as different repositories, how do you do that?
I'm not talking about subrepos (at least, if I understood the purpose of subrepos...), but if this is how subrepos do exist for, I got it wrong and I'll try to get it right :)
Thanks
~Aki
EDIT: To be more clear, I'd like to know what happens, the practices and the implications of having a repository inside another one, without specifying modules/subrepos.
In other words: what happens if I just do:
hg init globalRepo
hg init globalRepo/subRepo
and use these two repositories as-are?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
效果很好。早在 Mercurial 1.3 中添加子存储库支持之前,许多人就将其整个主目录保存在 Mercurial 存储库中,以跟踪他们的
.bashrc
文件等。然后在他们的主目录中,他们会有许多其他存储库的克隆。每当您调用 Mercurial(不带
-R
选项)时,它都会在当前目录中查找.hg
目录,然后继续向上查找目录,直到找到为止。因此,如果您所在的存储库位于另一个存储库中,您的命令将始终作用于您所在的最里面的存储库。需要注意的是,您要确保不要将文件添加到最终位于内部的外部存储库中。内部仓库。然后您将有两个存储库更新相同的文件。
It works well. Long before the subrepo support was added in Mercurial 1.3, lots of folks kept their entire home directories in a mercurial repo for tracking their
.bashrc
files and the like. Then within their home dir they'd have many clones of other repos.Whenever you invoke mercurial (without the
-R
option) it looks in the current directory for a.hg
directory and then just keeps going up directories until it finds one. So if you're in a repo that is in a repo, your commands will always act on the innermost repo you're in.The caveat is that you want to make sure not to have files added to the outer repo that end up inside the inner repo. Then you'll have two repos updating the same files.
正如您在此 SO 问题中看到的,您可以进行这种嵌套的
hg init
,即使它通常保留用于定义 subRepo (这不是您想要的)。通常它应该作为两个独立的存储库,但我建议添加一个
hgignore<
globalRepo
中的 /code>规则,以便完全忽略
subRepo
内容。As you can see in this SO question, you can make that kind of nested
hg init
, even though it is usually reserved for defining subRepo (which is not what you are after).Normally it should work as two independant repos, but I would advise adding an
hgignore
rule in theglobalRepo
in order to ignore thesubRepo
content altogether.以下是有关嵌套存储库的一些文档。
Here are some docs on nested repositories.