In git we do:
$ git check-ignore -v build .gitignore:3:/build build
Is there any way to determine why a file is being ignored by hg?
hg