It's not easy. Mercurial does not push and pull files that it pushes and pulls changes. Your only way is to never transfer these files. Ignoring them is not an option, since they are already tracked (added) and tracked are always ignored.
, .
hg commit -X a-file-I-changed -X another-file
, hgrc:
[alias]
mycommit = -X a-file-I-changed -X another-file
, , . , database.conf ( ), database.conf.sample, script database.conf.sample database.conf, . .