If the files you want to omit from the "hg commit" command are already "tracked", you should use the -X option. The pattern passed to -X is pretty flexible, making it possible to run for example:
% hg stat
A etc/foo.conf
M src/bar.c
M lib/libbar/loader.c
% hg commit -X '**.conf'
to avoid committing any file with a ".conf" extension, regardless of how deep in the source tree it lives. In the workspace shown above this would commit "src/bar.c" and "lib/libbar/loader.c" but not "etc/foo.conf".
To exclude multiple patterns of filenames, use multiple -X options, i.e.:
% hg commit -X '**.conf' -X '**.sh'
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…