简体   繁体   English

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

[英]How to ignore some folders in HG?

Starting here , I'm wrestling with this right now. 这里开始,我现在正在努力解决这个问题。 I've got two folders: Source and SQL. 我有两个文件夹:Source和SQL。 Source has multiple project folders. Source有多个项目文件夹。 The project folders in Source and SQL have bin folders. 源和SQL中的项目文件夹具有bin文件夹。 I want to ignore all files in bin folders under Source, but not under SQL. 我想忽略Source下的bin文件夹中的所有文件,但不在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). 看来我必须为Source下的每个文件夹输入一行,我希望有一个bin文件夹(然后每当我添加一个新项目时都会更新我的.hgignore文件)。

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

If this is not the case, any advice would be appreciated. 如果不是这种情况,我们将不胜感激。

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. 最后,考虑将每个项目作为一个单独的回购 - 这是DVCS土地的标准建议,无论是Mercurial还是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. 在svn中,同一个repo中的多个项目并不是一个坏主意,因为你可以将工作目录的不同部分更新到不同的版本,但是使用DVCS将所有文件更新/签出到同一版本,这使得放置多个项目在同一个回购中一般都是麻烦,在某些情况下是个坏主意。

Looking at my .hgignore file, my slashes seem to to be the other way around (a forwrad slash instead of a backslash). 看看我的.hgignore文件,我的斜线似乎是另一种方式(转发斜杠而不是反斜杠)。 ie: 即:

glob:*/bin/*

Try that maybe? 试试吧?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM