1

In my .hgignore file, I am trying to ignore all generated xll files. I (unfortunately) have a directory called "xll" within the domain of the repository, and I do not want to ignore the directory itself.

I have tried:

syntax: regex
\.xll$

which I thought should mean "match all that ends in '.xll'" and

syntax: regex
*.\.xll$

which I thought should mean "match all that have at least one arbitrary character, followed by '.xll'".

With either of the above, the directory is not ignored (yay) but neither is a file foobar.xll (darn). If I use a bare "xll" with regex, or "*.xll" with glob, both the directory and the file are ignored.

This is in linux (Ubuntu 10.04.4) with hg 2.6 (TortoiseHG 2.8) (I'm observing the effect in Nautilus via the presence or absence of "X" icons).

Thanks in advance!

EDIT (adding comments in here as they are too long to fit in a comment...) Thanks for all the responses. Turns out I was misinterpreting some things. So: - because I used "regex" instead of "regexp" (and I had "glob" at top of file), whatever I put on the line that referred to "xll" was being interpreted by "glob", so the line did have an effect (which made me think, incorrectly, that the "syntax: regex" line was doing what I thought it was - by coincidence, all the files in my "xll" directory were filtered out (as they should have been) by other lines in .hgignore, and not by the "*.xll" line - consequently, in Nautilus, the xll directory was marked as "ignored", not because the filter ignoring the entire directory, but instead because other filters were filtering all files within that directory

Bottom line, the *.xll I had under "syntax: glob" was actually filtering out files exactly as desired. The feedback in Nautilus was just different than I expected.

4

2 回答 2

2

.*\.xll$,不是*.\.xll$

于 2013-05-23T21:09:35.753 回答
1

使用 glob 语法对我来说效果很好:

syntax: glob
*.xll

当我创建一个以xll未跟踪文件命名的目录时,我仍然在以下输出中看到该文件hg status

$ mkdir xll
$ touch a.xll x.txt xll/b.xll xll/y.txt
$ echo 'syntax: glob\n*.xll' > .hgignore
$ hg status
? .hgignore
? x.txt
? xll/y.txt

使用\.xll$withsyntax: regexp也很适合我。

于 2013-05-24T06:49:37.530 回答