0

I have a folder set up like the following:

  • project/latest_kml/file.kml
  • project/.hgignore
  • project/.hg/...

My .hgignore file looks like this:

syntax: glob
*.kml
*.kmz
**nohup.out
log/**

After a bit of googling I found out that I should have used "**.kml' What I am not understanding is why *.kml is ignoring the .kml files. If I add a new .kml file to the latest_kml folder it doesn't get added when I run addremove, or appear in hg status.

If I remove the *.kml line then hg status shows the new .kml file.

The confusing part: If I remove the '*.kml' line from .hgignore and run hg status 'glob:**.kml' it shows the new kml file that was added to project/latest_kml/. If I instead use hg status 'glob:*.kml', it shows nothing.

What is the cause of this behaviour?

1 Answer 1

2

hg help patterns states clearly

Globs are rooted at the current directory; a glob such as "*.c" will only match files in the current directory ending with ".c".

The supported glob syntax extensions are "**" to match any string across path separators

...

 glob:*.c       any name ending in ".c" in the current directory
 *.c            any name ending in ".c" in the current directory
 **.c           any name ending in ".c" in any subdirectory of the
                current directory including itself.
3
  • Exactly. So that doesn't explain why somehow *.kml in the hgignore file is ignoring .kml files in a sub-directory. It shouldn't be behaving like that.
    – Smills
    Oct 30, 2014 at 5:20
  • 1
    @Smills - just because patterns in (only !!!) .hgignore are not rooted, contrary to all other patterns (used by you in command-line) Oct 30, 2014 at 17:50
  • Ah, I understand. Thanks, I hadn't seen mention of the .hgignore not being rooted.
    – Smills
    Oct 31, 2014 at 2:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.