A few hours after all the suggestions here and others found on the Internet, I found out that I always did this correctly .hgignore, but .hgignore will not ignore files that are currently being tracked using mercurial.
You have to do
hg forget mydir/myfile.ext
Or adding a file to .hgignore is not affected.
syntax: glob mydir/myfile.ext
Then the above will work.
source share