Ask or alert the user that she is changing a specific file, which we seldom want to change (but still want in our version control)
We have an XML file which contains the settings of a tool we use. The tool is n开发者_C百科ice, but if you change some settings when using it it's quite easy to save those settings to the XML-file by mistake (you get a question, but it's easy to answer yes).
Is there a way to alert the user someway that she is commiting a change to this specific file? We want it versioned, but we also want centralized and we want the settings to be quite stable.
It's a file versioned in Windows on an NTFS partition, if that matters. Trying to set the file to "read only" doesn't seem to work (after I set it, hg st still says no changes). Any ideas?
The way this is usually handled is to put that file in your .hgignore and to not version it. Instead, you should version a template file. i.e., config.xml.template.
That way, the only way changes will get committed to it is for someone to consciously bring those changes into the template.
If you really want to catch it during commit, you'll need to write some hooks and get your users to install those locally.
精彩评论