如何忽略HG中的某些文件夹?

发布于 2024-12-07 02:30:40 字数 594 浏览 2 评论 0原文

此处开始, 我现在正在努力解决这个问题。我有两个文件夹:Source 和 SQL。源有多个项目文件夹。 Source 和 SQL 中的项目文件夹有 bin 文件夹。我想忽略 Source 下 bin 文件夹中的所有文件,但不忽略 SQL 下的所有文件。我认为其中一个可能会成功:

glob:Source\*\bin\
glob:Source\*\bin
glob:Source\*\bin\*
glob:Source\*\bin*
glob:Source*\bin\
glob:Source\*bin\

但以上所有都没有骰子。

看来我必须为 Source 下的每个文件夹输入一行,我希望其中有一个 bin 文件夹(然后每当我添加新项目时更新我的​​ .hgignore 文件)。

glob:Source\Project1\bin\
glob:Source\Project2\bin\
#etc

如果不是这种情况,任何建议将不胜感激。

Starting here,
I'm wrestling with this right now. I've got two folders: Source and SQL. Source has multiple project folders. The project folders in Source and SQL have bin folders. I want to ignore all files in bin folders under Source, but not under SQL. I thought one of these might do the trick:

glob:Source\*\bin\
glob:Source\*\bin
glob:Source\*\bin\*
glob:Source\*\bin*
glob:Source*\bin\
glob:Source\*bin\

But no dice on all of the above.

It seems I'll have to enter a line for each folder under Source where I expect to have a bin folder (and then update my .hgignore file whenever I add a new project).

glob:Source\Project1\bin\
glob:Source\Project2\bin\
#etc

If this is not the case, any advice would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

找个人就嫁了吧 2024-12-14 02:30:40

您是否尝试过正则表达式:

syntax: regex
^Source/.*/bin

另外,请记住,您已经添加的任何内容都不受忽略规则的影响,因此您需要取消跟踪文件来测试这些内容。

最后,考虑让每个项目成为一个单独的存储库——这是 DVCS 领域的标准建议,无论是 Mercurial 还是 git。在 svn 中,同一个存储库中的多个项目并不是一个坏主意,因为您可以将工作目录的不同部分更新为不同的修订版本,但使用 DVCS,所有文件都会更新/签出到相同的修订版本,这使得将多个项目放在一起在同一个回购协议中,通常会很麻烦,并且在某些情况下是一个非常糟糕的主意。

Have you tried a regexp:

syntax: regex
^Source/.*/bin

Also, do remember that anything you've already added isn't affected by ignore rules, so you need the files to be untracked to test this stuff.

Lastly, consider making each project a separate repo -- that's the standard advice in DVCS land be it Mercurial or git. In svn multiple projects in the same repo isn't such a bad idea because you can have different parts of the working directory updated to different revisions, but with a DVCS all files are updated/checkedout to the same revision, which makes putting multiple Projects in the same repo a hassle in general and a really bad idea in some circumstances.

初雪 2024-12-14 02:30:40

看看我的 .hgignore 文件,我的斜杠似乎是相反的(正斜杠而不是反斜杠)。即:

glob:*/bin/*

也许尝试一下?

Looking at my .hgignore file, my slashes seem to to be the other way around (a forwrad slash instead of a backslash). i.e:

glob:*/bin/*

Try that maybe?

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