Mercurial 存储库:忽略包含自己存储库的所有文件夹?
我大约 6 个月前加入,当我到达时,我的团队没有使用任何形式的版本控制。我已经说服 mgmt 在新项目中使用 Mercurial,因此我们的网络服务器上有以下结构:
-MainFolder (which includes files for the main project)
+Subfolder A, which contains (old) project A with NO hg repo
+Subfolder B, which contains (old) project B with NO hg repo
+Subfolder C, which contains (NEW) project C AND a hg repo
+Subfolder D, which contains (NEW) project D AND a hg repo
请注意,当前拥有存储库的唯一文件夹是子文件夹 C 和 D,它们代表单独的项目。
我想添加一个存储库来跟踪当前未跟踪的所有内容,但想忽略当前拥有自己存储库的文件夹。我知道如何使用 .hgignore 文件,但据我了解,这需要我显式忽略包含存储库的每个文件夹。在上面的示例中这不是问题(只有两个现有存储库),但我们的实际设置有比这更多的项目。
有没有办法告诉 Mercurial 动态忽略其中包含存储库的所有文件夹,并跟踪其他所有内容?
I came on board about 6 months ago, and when I arrived, my group was using NO form of versioning. I have since convinced mgmt to use Mercurial in new projects, so we have on our webserver the following structure:
-MainFolder (which includes files for the main project)
+Subfolder A, which contains (old) project A with NO hg repo
+Subfolder B, which contains (old) project B with NO hg repo
+Subfolder C, which contains (NEW) project C AND a hg repo
+Subfolder D, which contains (NEW) project D AND a hg repo
Note that the only folders which currently have a repo are subfolders C and D, which represent seperate projects.
I would like to add a repo to track everything which is currently not tracked, but want to ignore the folders which currently have their own repositories. I know about using .hgignore
files, but from what I understand that would require me to explicitly ignore every folder which contains a repo. This isn't a problem in the above example (with only two existing repos), but our actual setup has more projects than this.
Is there any way to tell Mercurial to dynamically ignore all folders which have a repo in them, and track everything else?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它已经可以开箱即用地执行此操作。尝试以下演示:
您可能应该考虑设置主存储库以使用 子存储库 来跟踪更改在已经有自己的存储库的文件夹中。如果您不这样做,当您在 main 中提交时,这些项目之一中的更改将不会自动提交。
It will already do this out of the box. Try the following demonstration:
You should probably look into setting up the main repos to use subrepositories for tracking changes in the folders that already have their own repos. If you don't do that, changes in one of those projects wouldn't automatically be committed when you commit in the main.