There's a particular file in my repository, libraries/database.php, that I need ignored. However, I can't get the syntax to recognize the file - I've tried **/libraries/**/database.php
and libraries/database.php
in glob, and ^.libraries/database.php
in regex, but neither of them work. What should I do?
views:
113answers:
2
+1
A:
syntax: re
^libraries/database\.php$
That will work.
But, frankly, I've always found the .hgignore syntax to be a little obscure myself. I don't really understand what glob will and won't match.
Omnifarious
2010-08-06 17:37:46
As far as I know glob will just try to match the whole line given within the relative (to the repository's root) path. As an example "glob:makefile" will exclude everything that has "makefile" in its path and/or name
Mario
2010-08-06 17:41:59
the correct syntax is: syntax: regexp
David
2010-08-06 17:44:48
@David - The actual names of the two supported syntaxes are `relre` and `relglob`. But `re` and `regexp` are aliases for `relre`, and `glob` is an alias for `relglob`. This is explicitly so in `ignore.py`. This has been the case since this syntax for `.hgignore` files was introduced in changeset fc3b41570082.
Omnifarious
2010-08-06 18:13:34
@Omnifarious - thank you, I will try to be less cocky next time :-) I was stating from the documentation.
David
2010-08-06 18:57:52
@Dave - *grin* Well, I noticed the documentation said that, and I knew that `syntax: re` worked, and had worked for me forever. So I did some code spelunking to figure out if it simply worked by accident or if it was supposed to work. It turns out (not too surprisingly) that the documentation is incomplete.
Omnifarious
2010-08-06 19:44:53
+1
A:
From the mercurial QuickStart guide:
"Mercurial will look for a file named .hgignore in the root of your repository which contains a set of glob patterns and regular expressions to ignore in file paths"
is your .hgignore at the right place ?
So
syntax: glob
libraries/database.php
should work.
David
2010-08-06 17:43:42