By default, patterns are python regular expressions. Expressions are executed in each component of the path. So you probably want \.pyc$ match files ending in .pyc
$ hg init test-ignore $ cd test-ignore $ touch foo.pyc $ mkdir bar $ touch bar/bar.pyc $ echo "\.pyc$" > .hgignore $ hg st ? .hgignore
Note that ".pyc $" ignores "foopyc" because the undefined dot matches any character. Similarly, ".pyc" will match "foo.pyche.bar"
If you don't like the syntax of regular expressions, you can switch to global ones. For example, the current .hgignore in the Mercurial repository starts with:
syntax: glob *.elc *.orig *.rej *~ *.mergebackup *.o *.so *.pyd *.pyc *.swp *.prof \#*\# .\#*
Everything is explained in man 5 hgignore
Nicdumz
source share