Mercurial 存储库:忽略包含自己存储库的所有文件夹?

发布于 2024-09-28 18:43:04 字数 660 浏览 5 评论 0原文

我大约 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

银河中√捞星星 2024-10-05 18:43:04

它已经可以开箱即用地执行此操作。尝试以下演示:

hg init demo
cd demo
hg init foo
cd foo
echo foo>>foo.txt
hg stat
? foo.txt
cd ..
hg stat
# Nothing!

您可能应该考虑设置主存储库以使用 子存储库 来跟踪更改在已经有自己的存储库的文件夹中。如果您不这样做,当您在 main 中提交时,这些项目之一中的更改将不会自动提交。

It will already do this out of the box. Try the following demonstration:

hg init demo
cd demo
hg init foo
cd foo
echo foo>>foo.txt
hg stat
? foo.txt
cd ..
hg stat
# Nothing!

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文